English
Source / code snippets

Allgemeines Polynom 6. Grades solve: Vereinfachtes Bairstow-take action

 

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  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.453 Views

Untitledvor 0 min.
p.specht11/21/21
R.Schneider11/20/21
Uwe Lang11/20/21
Manfred Barei11/19/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie