Autor Beitrag
110022
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 287

XP SP2
Delphi 7
BeitragVerfasst: Sa 08.03.08 23:50 
Ich will n Programm schreiben mitdem ich die Nullstellen einer parabel berechnen kann.
halt son zeuch mit der p q Formel.
nur hab ich keine Ahnung wie ich das machen machen soll.
was soll ich machen?

sowas wie:
7x²+27x-89=0 oder
2x²=57x-3

ps: is bestimmt im falschen bereich gepostet :D

110022


Moderiert von user profile iconChristian S.: Topic aus VisualCLX (Component Library for Cross Platform) verschoben am So 09.03.2008 um 00:05
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: So 09.03.08 00:00 
Schonmal was von der Mitternachtsformel gehört?

user defined image

_________________
Hallo Mutti
110022 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 287

XP SP2
Delphi 7
BeitragVerfasst: So 09.03.08 00:01 
ka was das is
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: So 09.03.08 00:01 
Hi,

In diesem Fall hilft dir sicherlich die Suche:
Suche bei Google NULLSTELLENBERECHNUNG.

(Ansonsten setze doch einfach mal in deine Formel 0 ein!!!^^)
y = aX² + bX + c
X-Achse: aX² + bX + c = 0;
Y-Achse: Y = a*0² + b*0 + c
Y = c;

mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)
110022 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 287

XP SP2
Delphi 7
BeitragVerfasst: So 09.03.08 00:03 
ich weiß wie man die berechnet aber wie mache ich das bei delphi?
habs schon versucht aber der Versuch ging in die Hose...
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: So 09.03.08 00:52 
user profile iconHidden hat folgendes geschrieben:
Hi,

In diesem Fall hilft dir sicherlich die Suche:
Suche bei Google NULLSTELLENBERECHNUNG.

(Ansonsten setze doch einfach mal in deine Formel 0 ein!!!^^)
y = aX² + bX + c
X-Achse: aX² + bX + c = 0;
Y-Achse: Y = a*0² + b*0 + c
Y = c;

mfG,


user profile icon110022 hat folgendes geschrieben:
ich weiß wie man die berechnet aber wie mache ich das bei delphi?
habs schon versucht aber der Versuch ging in die Hose...


Woran hapert es denn? Am Umgang mit Variablen?
www.christian-stelzm...rtikel/crashkurs.htm

Ich gehe es jetzt mal durch:
ausblenden Quelltext
1:
2:
3:
4:
  aX² + bX + c = 0
  X² + bX / a + c / a = 0
  X = -b/2a +- sqrt(b*b/(4*a*a) - c/a)
  X = -b/2a + sqrt(b*b/(4*a*a) - c/a) v. X = -b/2a - sqrt(b*b/(4*a*a) - c/a)

Womit du die zwei Nullstellen deiner Parabel hättest.
Diskriminante(Zahl unter der Wurzel) < 0 heißt keine Nullstellen
D = 0: eine
D > 0: zwei

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
  procedure Nullstellen(a,b,c: Extended);
  var
    D: Extended;
  begin
    D := b*b/(4*a*a) - c/a
    if D < 0 then
      //wieauchimmer du sie ausgeben willst; hier ergebnis gleich [](leere Menge)
    else begin
      Ausgabe(-b/2a + sqrt(D), -b/2a + sqrt(D));  //Deine Ausgabe sollte gleiche Ergebnisse nur einmal ausgeben und an einer bestimmten stelle(einstellbar?) runden.
    end;
  end;


mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)
110022 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 287

XP SP2
Delphi 7
BeitragVerfasst: So 09.03.08 14:12 
mein problem ist der Aufbauder Variablen
ich weiß einfch nicht wie ich das aufbauen soll.
und wie ich die einzelnen rechenschritte in ner listbox zeigen lasse weiß ich auch nich.
das soll auch so simpel wie möglich werden.
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: So 09.03.08 14:30 
erstmal durch einen Mini-Parser. Du zerschneidest erstmal den Eingabestring.

5x²+3x-100=0
5x² | +3x | -100

dann schneidest du die Werte für a, b, c ab:

a=5 b=3 c=-100;

und ab damit in die Mitternachtsformel von oben => 2 Ergebnisse


anderes Beispiel:

5x²=3x-100
alles nach dem = wird mit einem - versehen
5x² | -3x | +100
a=5 b=-3 c=100

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: So 09.03.08 17:10 
user profile iconHidden hat folgendes geschrieben:

Woran hapert es denn? Am Umgang mit Variablen?
www.christian-stelzm...rtikel/crashkurs.htm

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)