| |
|
|
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 ▲ |
|
|
|