1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47:
| procedure TForm1.extremwerte; var xm1, xm2, y, y1,y2, p, q:extended; begin y2:=6*x3*xm1+2*x2; y:=x3*power(xm1,3)+x2*power(xm1,2)+x1*xm1+x0; y1:=x3*power(xm2,3)+x2*power(xm2,2)+x1*xm2+x0; p:=(2*x2)/(3*x3); p:=round(p*100)/100; q:=x1/(3*x3); q:=round(q*100)/100; if (p/2)*(p/2)-q=0 then begin xm1:=-(p/2);
if y2<0 then begin maxx_edt.text:=floattostrf(xm1,fffixed,10,3); maxy_edt.text:=floattostrf(y,fffixed,10,3); end else begin minx_edt.text:=floattostrf(xm1,fffixed,10,3); miny_edt.text:=floattostrf(y,fffixed,10,3); end; end else
if (p/2)*(p/2)-q<0 then begin minx_edt.text:=''; maxx_edt.text:=''; end else begin xm1:=-(p/2)+sqrt((p/2)*(p/2)-q); xm1:=round(xm1*100)/100; xm2:=-(p/2)-sqrt((p/2)*(p/2)-q); xm2:=round(xm2*100)/100; if y2<0 then begin maxx_edt.text:=floattostrf(xm1,fffixed,10,3); maxy_edt.text:=floattostrf(y,fffixed,10,3); minx_edt.text:=floattostrf(xm2,fffixed,10,3); miny_edt.text:=floattostrf(y1,fffixed,10,3); end else begin maxx_edt.text:=floattostrf(xm2,fffixed,10,3); maxy_edt.text:=floattostrf(y1,fffixed,10,3); minx_edt.text:=floattostrf(xm1,fffixed,10,3); miny_edt.text:=floattostrf(y,fffixed,10,3); end; end; end; |