| |
|
|
p.specht
|
Título de la ventana "Lösungen des Allgemeinen Polynoms 6. Grades después de Bairstow"
Cls:declarar 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
imprimir "\n Bitte Koeffizienten después de fallendem Grad eingeben:"
imprimir "--------------------------------------------------"
imprimir " a6 = ";:input c$:caso c$ > "" :a![6]=val(c$)
imprimir " a5 = ";:input c$:caso c$ > "" :a![5]=val(c$)
imprimir " a4 = ";:input c$:caso c$ > "" :a![4]=val(c$)
imprimir " a3 = ";:input c$:caso c$ > "" :a![3]=val(c$)
imprimir " a2 = ";:input c$:caso c$ > "" :a![2]=val(c$)
imprimir " a1 = ";:input c$:caso c$ > "" :a![1]=val(c$)
imprimir " a0 = ";:input c$:caso c$ > "" :a![0]=val(c$)
imprimir "--------------------------------------------------"
Grad&=sizeof(A![])-1
WhileLoop Grad&,0,-1
Conjunto("NumWidth",1) :set("Decimals",0)
if &Loop<Grad&:imprimir " +";:más:imprimir " ";:endif
Imprimir "X^";&Loop,
Conjunto("NumWidth",26):set("Decimals",15):Imprimir " veces ";A![&Loop]
EndWhile
Imprimir:Imprimir " Für Berechnungsstart Por favor, Taste drücken!"
WaitInput
CLS
Conjunto("NumWidth",1) :set("Decimals",0)
Imprimir "Das gegebene Polynom vom Grad ";Grad&;" ha folgende Nullstellen:":Imprimir
Bairstow(A![])
WaitInput
goto "lup"
Proc Bairstow : Parámetros A![]:Var Grad&=SizeOf(A![])-1
Declarar i&,R!,P!,P1!,Q!,Q1!,Ce!,s!,t!,B![Grad&],C![Grad&]
set("NumWidth",20):set("Decimals",15)
Mientras que 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]:caso Ce!=0:Imprimir "Andere Startwerte nötig!"
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:Imprimir "\n\n 4000 Runden, 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:Imprimir s!;" + ";0.5 * Sqrt(-t!);"*i ";: comment
Imprimir s!;" - ";0.5 * Sqrt(-t!);"*i ";: comment
Más :Imprimir s!+0.5*Sqrt(t!):Imprimir s!-0.5*Sqrt(t!)
EndIf :whileloop 2,Grad&:i&=&Loop:A![i&-2]=B![i&]:endwhile :Grad&=Grad&-2
EndWhile
If Grad&=1:Imprimir -A![0]/A![1]:Más :s!=-0.5*A![1]/A![2]:t!=A![1]*A![1]-4*A![2]*A![0]
If t!<0:Imprimir s!;" + ";0.5*Sqrt(-t!)/A![2];"*i ";: comment
Imprimir s!;" - ";0.5*Sqrt(-t!)/A![2];"*i ";: comment
Más :Imprimir s!+0.5*Sqrt(t!)/A![2]:Imprimir s!-0.5*Sqrt(t!)/A![2]
EndIf
EndIf
ENDPROC
Proc comment :if nearly(s!,0,9):imprimir "(Imaginär)":más :imprimir "(Komplex)":endif
ENDPROC
|
|
|
| Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 19.05.2021 ▲ |
|
|
|