Autor Beitrag
Fluffy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Mi 09.02.05 15:36 
Also, wir berechnen Punkte.
In der ersten Schleife funktioniert der Vorgang
g:=0;
For-Schleife
Rest

IN der zweiten gehts nicht, obwohl vom Aufbau her alles gleich ist.
UND: Ja, g soll nach jedem einzelnen Schleifendurchlauf 3 Felder nach rechts gehen. Alle Werte aus dem Stringgrid werden multipliziert bzw. als Potenz genommen.
(Dieser Teil funktionierte allerdings noch).
Lossy eX
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1048
Erhaltene Danke: 4



BeitragVerfasst: Mi 09.02.05 15:47 
Okay. Vielleicht war das ein bisschen verwirrend. Die erste FOR Schleife berechnet den ersten Punkt. Vor der While Schleife setzt du g noch einmal auf 0 und dort sollte dann der erste Durchgang auch noch klappen. Allerdings der Zweite nicht. Ziehe das g := 0 wie markiert mal in die while Schleife.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
  y:=0;
   while abs(x)>1/10 do
    begin
      s:=z-(p*a-p*z)/(x-p);
      a:=s;
      g:=0;
      for i:= 1 to n-1 do
        begin
          g:=g+3;
          if stringgrid1.cells[g-3,0]<>'-' then
              y:=power(a,(strtoint(stringgrid1.cells[g-1,0])))*(strtoint(stringgrid1.cells[g-2,0]))
           else
              y:=-power(a,(strtoint(stringgrid1.cells[g-1,0])))*(strtoint(stringgrid1.cells[g-2,0]));
         x:=x+y;
       end;
    end;


PS: Irgendwie habe ich von deinem letzten Post nur maximal die Hälfte verstanden.

_________________
Nur die Menschheit ist arrogant genug, um zu glauben sie sei die einzige intelligente Lebensform im All. Wo nicht mal das nachhaltig bewiesen wurde.
Fluffy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Mi 09.02.05 15:58 
Danke für deinen Hinweis,...
wenigstens rechnet er jetzt wenigstens, wenn auch falsch
Fluffy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 10.02.05 11:00 
Wir haben mittlerweile (antwortet ja keiner... :cry: ) einige Sachen hingekriegt, sind im Moment aber dabei, die erste Ableitung auf Nullstellen zu prüfen. (Ein Abbruchkriterium.)
Die Schleife soll einen bestimmten Bereich überprüfen, ob in diesem Intervall die Funktion irgendwann mal 0 wird (z.B. ob 3x^2 +5=0 möglich ist)

Das Problem ist folgendes: Bei einer Schleife kann man (?) doch nur Integer-Werte durchlaufen lassen, wie kann man mit kleineren Abständen prüfen lassen (z.B. 0,1)???

Bitte meldet euch :!:
OneOfTen
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 10.02.05 11:15 
indem man die Zählvariable in der Schleife teilt:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
 for n := 1 to 1000 do
begin
  temp := n/10;
end;


wobei temp zb vom typ double ist..
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6386
Erhaltene Danke: 146

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 10.02.05 11:23 
Oder man nimmt eine while-Schleife (Repeat..until geht natürlich auch) und sorgt selbst für das Hochzählen.
Fluffy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 10.02.05 11:33 
Danke davör...
sind noch am ausprobieren, könnt aber klappen!! :D
Fluffy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 10.02.05 11:44 
Ok, hier das aktuellste Problem: :gruebel:

for n:= Ax to Bx do
....

wobei Ax und Bx vom Typ Real sind.

Eigentlich sollte n nun in 0,1-Schritten laufen, wie geht das mit Real??
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6386
Erhaltene Danke: 146

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 10.02.05 11:48 
gar nicht.
Ax und Bx müssen Cardinal sein. Also Integer, Word o.ä.
Lies doch mal den Beitrag von OneOfTen.
Fluffy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 10.02.05 11:54 
Cardinal-Werte sind nur im positiven Bereich verfügbar, unsere Variablen sollen aber negativ sein, WIE IST DAS REALISIERBAR??????? :bawling:
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6386
Erhaltene Danke: 146

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 10.02.05 12:04 
Kleiner Fehler meinerseits.
Nimm Integer. Hatte ich aber auch dazu geschrieben.
Fluffy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 10.02.05 12:34 
Wie kann man eine Schleife abbrechen, sobald eine if Bedingung erfüllt ist??
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6386
Erhaltene Danke: 146

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 10.02.05 12:35 
Break
Oder eine while-Schleife verwenden


Zuletzt bearbeitet von jasocul am Do 10.02.05 12:41, insgesamt 1-mal bearbeitet
Fluffy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 10.02.05 12:40 
Danke!! :D