Autor Beitrag
GericasS
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 540

Windows Vista Home Premium
D2010, VisualStudio2008
BeitragVerfasst: So 27.04.08 13:34 
Moin Jungs,

ich hab heute einmal versucht in Delphi das umzusetzten was wir in Mathe momentan behandeln, Parabeln.
Dazu wollte ich ein Programm schreiben was die Polynomdarstellung in die Scheitelpunktform umformt.

Folgenden Ansatz hab ich bereits :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.Button1Click(Sender: TObject);
var
a,ax,b,bx,b1,b2,c,x : Real ;
begin
  ax := StrToFloat(edit1.Text);
  bx := StrToFloat(edit2.Text);
  c  := StrToFloat(edit3.Text);
    bx := bx/ax ;           // ax²+bx+c = bx : a
    c := c/ax ;            // ax²+bx+c = c : a
    b1 := sqr(bx/2);       // bx/0,5²
    bx := bx/2 ;
    c := (c-b1)*ax ;
  Edit4.Text := FloatTOStrF(ax,fffixed,10,2);
  Edit5.Text := FloatToStrF(bx,fffixed,10,2);
  Edit6.Text := FloatToStrF(c,fffixed,10,2);


Ich hatte mir ein einfach Beispiel genommen f(x)= 2x²+2x+2 damit hat das Programm auch super funktioniert aber sobald ich eine andere formel nehme z.B 3x²+2x+2 dann kommen falsche Ergebnisse raus :x.
Könnte mir jemand sagen wo da der Logik-Fehler liegt ?


LG

GericasS


EDIT : Okay hat sich schon erledigt =)

_________________
Alexander N.
Neue Bewaffnung Amilo xi2428 T9300