Neuigkeiten:

Wenn ihr euch für eine gute Antwort bedanken möchtet, im entsprechenden Posting einfach den Knopf "sag Danke" drücken!

Mobiles Hauptmenü

Ausdrucksgenerator rechnet falsch!?

Begonnen von Arthur, September 10, 2010, 14:42:59

⏪ vorheriges - nächstes ⏩

Arthur

Hallo,

habe hier ein Problem, an welches ich schon fast zwei Wochen sitze:
Ich versuche mir eine Abfrage zu erstellen, welche die Koeffizienten einer kubischen Regressionsgraden berechnet. Ich habe dafür alles Vorbereitet (Formeln erstellt, Variablen berechnet,...) jetzt muss ich nur noch die Formel in die Zeile "Feld" der Abfrage eintragen. Insgesamt 4 Stück a,b,c,d (y'=a+b*x+c*x²+d*x³) Die Formeln haben jeweils eine länge von ca 730 Zeichen.  Allerdings werde Sie falsch berechnet! Ich habe schon alles erdenkliche ausprobiert, auch nochmal alles neugeschrieben, aber es kommt immer der selbe misst raus!
Hat jemand eine Idee woran das liegen kann? Gibt es eine Zeichenbeschränkung? Ich bin hier am Verzweifeln, das ist meine Diplomarbeit, und ich hänge schon viel zu lange an diesem Problem, welches nur ein kleiner Teil der Diplomarbeit einnimmt!
Um es vorneweg zu nehmen, die Formeln sind richtig!!! ich habe sie schon bei Excel benutzt und da haben sie funktioniert! Die verschiedenen "x" und "y" sind auch korrekt berechnet.
Die Formeln hänge ich am Schluss dieses Posts an.

Gruss Arthur

a:-(x4^3 *y - 2* x3 *x4* x5 *y + x2* x5^2* y + x3^2* x6 *y - x2 *x4* x6 *y -
     x3* x4^2* yx + x3^2 *x5 *yx + x2 *x4* x5* yx - x1 *x5^2* yx -
     x2 *x3* x6 *yx + x1 *x4* x6* yx + x3^2 *x4* yx2 - x2* x4^2 *yx2 -
     x2 *x3 *x5 *yx2 + x1 *x4 *x5 *yx2 + x2^2 *x6* yx2 - x1* x3 *x6* yx2 -
     x3^3* yx3 + 2* x2* x3* x4* yx3 - x1* x4^2 *yx3 - x2^2 *x5 *yx3 +
     x1* x3* x5 *yx3)/(
    n (x3^4 - 3* x2 *x3^2 *x4 + x2^2* x4^2 + 2 *x1* x3* x4^2 - x4^3 +
       2* x2^2* x3* x5 - 2* x1* x3^2 *x5 - 2 *x1 *x2 *x4* x5 + 2 *x3 *x4 *x5 +
       x1^2 *x5^2 - x2* x5^2 - x2^3 *x6 + 2 *x1* x2 *x3 *x6 - x3^2 *x6 -
       x1^2* x4* x6 + x2 *x4* x6))
b:-(x3 *x4^2 *y - x3^2* x5 *y - x2* x4* x5 *y + x1 *x5^2* y + x2* x3 *x6 *y -
      x1* x4 *x6* y - x3^2* x4* yx + 2 *x2 *x3 *x5* yx - x5^2* yx - x2^2* x6* yx +
      x4* x6* yx + x3^3* yx2 - x2*x3 *x4* yx2 - x1*x3* x5* yx2 + x4 *x5 *yx2 +
     x1 *x2 *x6* yx2 - x3* x6* yx2 - x2* x3^2 *yx3 + x2^2* x4* yx3 +
     x1* x3* x4 *yx3 - x4^2 *yx3 - x1 *x2* x5* yx3 + x3* x5* yx3)/(-x3^4 +
     3 *x2* x3^2* x4 - x2^2 *x4^2 - 2 *x1* x3* x4^2 + x4^3 - 2* x2^2*x3* x5 +
     2* x1* x3^2* x5 + 2* x1* x2* x4* x5 - 2* x3* x4 *x5 - x1^2* x5^2 + x2 *x5^2 +
      x2^3* x6 - 2* x1* x2* x3* x6 + x3^2* x6 + x1^2* x4* x6 - x2 *x4 *x6)
c:-(-x3^2 *x4 *y + x2* x4^2* y + x2 *x3* x5 *y - x1 *x4* x5* y -
     x2^2 *x6* y + x1 *x3 *x6 *y + x3^3* yx - x2* x3 *x4* yx - x1* x3* x5 *yx +
     x4 *x5* yx + x1* x2 *x6 *yx - x3* x6* yx - x2 *x3^2 *yx2 +
     2* x1* x3* x4* yx2 - x4^2 *yx2 - x1^2 *x6 *yx2 + x2* x6 *yx2 +
     x2^2* x3* yx3 - x1 *x3^2 *yx3 - x1 *x2 *x4 *yx3 + x3* x4* yx3 +
     x1^2 *x5* yx3 - x2 *x5 *yx3)/(-x3^4 + 3* x2* x3^2* x4 - x2^2 *x4^2 -
     2 *x1* x3* x4^2 + x4^3 - 2* x2^2 *x3 *x5 + 2 *x1* x3^2* x5 +
     2 *x1* x2 *x4 *x5 - 2 *x3 *x4 *x5 - x1^2* x5^2 + x2 *x5^2 *+ x2^3* x6 -
     2 *x1* x2* x3 *x6 + x3^2* x6 + x1^2* x4 *x6 - x2* x4* x6)
d:-(-x3^3 *y + 2 *x2* x3 *x4* y - x1* x4^2* y - x2^2 *x5 *y + x1* x3* x5* y +
      x2 *x3^2 *yx - x2^2* x4 *yx - x1* x3 *x4* yx + x4^2* yx + x1* x2* x5 *yx -
     x3 *x5 *yx - x2^2* x3 *yx2 + x1 *x3^2 *yx2 + x1 *x2 *x4 *yx2 - x3 *x4* yx2 -
      x1^2* x5 *yx2 + x2* x5* yx2 + x2^3 *yx3 - 2 *x1 *x2* x3 *yx3 + x3^2* yx3 +
      x1^2* x4 *yx3 - x2* x4 *yx3)/(
    x3^4 - 3 *x2 *x3^2 *x4 + x2^2 *x4^2 + 2* x1* x3 *x4^2 - x4^3 +
     2 *x2^2* x3 *x5 - 2 *x1 *x3^2* x5 - 2 *x1 *x2* x4 *x5 + 2 *x3 *x4 *x5 +
     x1^2 *x5^2 - x2*x5^2 - x2^3 *x6 + 2* x1* x2 *x3* x6 - x3^2 *x6 -
     x1^2* x4* x6 + x2 *x4* x6)


oma

Hallo Diplomant,

stelle mal deine DB (abgespeckt; nur mit relevanter Abfrage u. relevante Daten; komprimiert u. gezippt) in Access2003 o. Access2000  ins Forum

Gruß Oma
nichts ist fertig!

DF6GL

#2
Hallo,

ja, es gibt tatsächlich eine Beschränkung in der Anzahl der Zeichen in der Abfrage....(irgenwas um die 2100 glaube ich).


Erstell 4 Public-Funktionen (a, b, c, d) in einem Standard(!) -Modul, die die jeweilige Formel enthält und das Ergebnis zurückliefert.




Public Function a (x as Double,y as Double, n as Long) as Double

a= -(x4^3 *y - 2* x3 *x4* x5 *y + x2* x5^2* y + x3^2* x6 *y - x2 *x4* x6 *y - _
 x3* x4^2* yx + x3^2 *x5 *yx + x2 *x4* x5* yx - x1 *x5^2* yx - _
    x2 *x3* x6 *yx + x1 *x4* x6* yx + x3^2 *x4* yx2 - x2* x4^2 *yx2 - _
    x2 *x3 *x5 *yx2 + x1 *x4 *x5 *yx2 + x2^2 *x6* yx2 - x1* x3 *x6* yx2 - _
    x3^3* yx3 + 2* x2* x3* x4* yx3 - x1* x4^2 *yx3 - x2^2 *x5 *yx3 + _
    x1* x3* x5 *yx3) / _
    (n * (x3^4 - 3* x2 *x3^2 *x4 + x2^2* x4^2 + 2 *x1* x3* x4^2 - x4^3 + _  'wobei hier n unklar ist und auch ein Sternchen fehlt.
      2* x2^2* x3* x5 - 2* x1* x3^2 *x5 - 2 *x1 *x2 *x4* x5 + 2 *x3 *x4 *x5 + _
      x1^2 *x5^2 - x2* x5^2 - x2^3 *x6 + 2 *x1* x2 *x3 *x6 - x3^2 *x6 - _
      x1^2* x4* x6 + x2 *x4* x6))

End Function



Diese Funktionen rufst Du in der Abfrage auf:

Select a([x],[y],[n]) as AErgebnis, b([x],[y]) as BErgebnis, c([x],[y]) as CErgebnis , D([x],[y]) as DErgebnis from Tabelle1


Arthur

Vielen Dank, genau das was ich gebraucht habe, jetzt funktioniert alles!  ;D
Er scheint als lag es wirklich an der Zeichenbegrenzung...