| |
|
|
p.specht
|
Window Title "Lösungen the general Polynoms 6. Grades to Bairstow"
Cls:declare a![6],xn!,x!,c$,Grad&
lup:
a![6]=1:a![5]=1:a![4]=1:a![3]=1:a![2]=1:a![1]=1:a![0]=-6'default
print "\n Please Koeffizienten to fallendem strain prompt:"
print "--------------------------------------------------"
print " a6 = ";:input c$:case c$ > "" :a![6]=val(c$)
print " a5 = ";:input c$:case c$ > "" :a![5]=val(c$)
print " a4 = ";:input c$:case c$ > "" :a![4]=val(c$)
print " a3 = ";:input c$:case c$ > "" :a![3]=val(c$)
print " a2 = ";:input c$:case c$ > "" :a![2]=val(c$)
print " a1 = ";:input c$:case c$ > "" :a![1]=val(c$)
print " a0 = ";:input c$:case c$ > "" :a![0]=val(c$)
print "--------------------------------------------------"
Grad&=sizeof(A![])-1
WhileLoop Grad&,0,-1
Set("NumWidth",1) :set("Decimals",0)
if &Loop<Grad&:print " +";:else:print " ";:endif
Print "X^";&Loop,
Set("NumWidth",26):set("Decimals",15):Print " time ";A![&Loop]
EndWhile
Print:Print " for Berechnungsstart Please Button pressing!"
WaitInput
CLS
Set("NumWidth",1) :set("Decimals",0)
Print "Das given Polynom of strain ";Grad&;" has following Nullstellen:":Print
Bairstow(A![])
WaitInput
goto "lup"
Proc Bairstow : Parameters A![]:Var Grad&=SizeOf(A![])-1
Declare i&,R!,P!,P1!,Q!,Q1!,Ce!,s!,t!,B![Grad&],C![Grad&]
set("NumWidth",20):set("Decimals",15)
While Grad&>2:R!=0:P1!=1:Q1!=-1:B![Grad&]=A![Grad&]:C![Grad&]=A![Grad&]
Repeat :P!=P1!:Q!=Q1!:B![Grad&-1]=B![Grad&]*P!+A![Grad&-1]
C![Grad&-1]=B![Grad&-1]+B![Grad&]*P!
Whileloop Grad&-2,0,-1:i&=&Loop:B![i&]=B![i&+2]*Q!+B![i&+1]*P!+A![i&]
C![i&]=C![i&+2]*Q!+C![i&+1]*P!+B![i&]
EndWhile
Ce!=C![2]*C![2]-C![1]*C![3]:case Ce!=0:Print "Andere Startwerte necessary!"
P1!=P!-(B![1]*C![2]-B![0]*C![3])/Ce!:Q1!=Q!-(B![0]*C![2]-B![1]*C![1])/Ce!:R!=R!+1
If R!>4000:Print "\n\n 4000 rounds, no Konvergenz!":WaitInput :End :EndIf
Until Abs(B![0])+Abs(B![1])<10^-12:s!=P1!/2:t!=P1!*P1!+4*Q1!
If t!<0:Print s!;" + ";0.5 * Sqrt(-t!);"*i ";: comment
Print s!;" - ";0.5 * Sqrt(-t!);"*i ";: comment
Else :Print s!+0.5*Sqrt(t!):Print s!-0.5*Sqrt(t!)
EndIf :whileloop 2,Grad&:i&=&Loop:A![i&-2]=B![i&]:endwhile :Grad&=Grad&-2
EndWhile
If Grad&=1:Print -A![0]/A![1]:Else :s!=-0.5*A![1]/A![2]:t!=A![1]*A![1]-4*A![2]*A![0]
If t!<0:Print s!;" + ";0.5*Sqrt(-t!)/A![2];"*i ";: comment
Print s!;" - ";0.5*Sqrt(-t!)/A![2];"*i ";: comment
Else :Print s!+0.5*Sqrt(t!)/A![2]:Print s!-0.5*Sqrt(t!)/A![2]
EndIf
EndIf
ENDPROC
Proc comment :if nearly(s!,0,9):print "(Imaginär)":else :print "(Komplex)":endif
endproc
|
|
|
| Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/19/21 ▲ |
|
|
|