English
Source / code snippets

Umkehrung the Faktoriellen-function: The Lambert-W-function (aka Omegafunktion)

 

p.specht

Accurate said deals it itself here around the attempt, The Eulersche Gammafunktion To invertieren. there sustain one but each circa 1 too much to the Faktoriellen-function.
Window Title "Mittels Newton-Raphson in the accuracy improved Lambert-W-Funktion"
Cls:Set("decimals",17)
print $profver:waitinput 7000

proc Wu :parameters y!

    declare Wu!

    if y!>1

        Wu!=ln(y!)-ln(ln(y!)) + 0.5*ln(ln(y!))/ln(y!)

    else

        Wu!=1

    endif

    return Wu!

endproc

proc where :parameters x!

    declare where!
    where!=ln(x!)-ln(ln(x!))+ exp(1)/(exp(1)-1)*ln(ln(x!))/ln(x!)
    return where!

endproc

Declare xn!,x!,y!,epsilon!,i&,max&
y!=1.295' steady first on the master-branch

Repeat

    if  y! > if($profver="11.2a-NT",10^305 , 10^53)

        sound 500,200:sound 300,200
        waitinput 20000:end

    endif

    y!=y!*1.1
    max&=4000'Verbesserungs-runs
    epsilon!=5/10^16:case y!>227.93:epsilon!=5.687/10^14
    xn!=Wu(y!)'Startwert (To small) for Newton-Raphson
    i&=0

    Repeat

        inc i&
        x!=xn!

        if ((x!+1)*exp(x!)) = 0

            xn!=(Wu(y!)+where(y!))/2'then even ex here from Näherungsformel... ex x~18.56
            break

        else

            xn! = x!-(x!*exp(x!)-y!)/((x!+1)*exp(x!))

        endif

    until (abs(xn!-x!)<=epsilon!) or (i&>max&)

    if i&>max&

        print " x-Search for y=";stature$("%g",y!);" nach",i&,"Durchläufen aborted!"
        print tab(2);i&,
        print tab(10);"Y=";stature$("%g",y!),
        print tab(23);"x=";stature$("%g",xn!),
        print tab(50);"err=";stature$("%g",abs(x!-xn!))
        '   print tab(50);"Y2=";format$("%g",xn!*exp(xn!))
        sound 2000,200:waitinput

    else

        print i&,
        print tab(5);"Y=";stature$("%g",y!),
        print tab(29);"x=";stature$("%g",xn!),
        print tab(52);"err=";stature$("%g",abs(x!-xn!))
        '   print tab(50);"Y2=";format$("%g",xn!*exp(xn!))

    endif

    if %csrlin>22:waitinput :locate 1,1:endif' cls:endif

    Until %key=27

    END
 
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/15/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.340 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