English
Source / code snippets

Moderne Alternativen to Gammafunktion (Kontinuierliche Faktorielle+1-function)

 

p.specht

jacob Bernoulli's suggestion of/ one kontinuierlichen function instead of the only for ganzzahlige positive values definierten Fakultät watts of Leonard Euler 1729 aufgegriffen and gipfelte in a very complicated, in the Negativen komplexwertigen function, the 'Gamma-Funktion'. These can To dato only with erheblichem hoisted more or less very numerisch approach accounts go.

That these function but not The only Possibility darstellt, reasonable Zwischenwerte between natürlichzahligen faculties To to charge, watts some Jahrzehnte later clear: Mathematiker How about Hadamard made Proposals, around the störenden Unendlichkeitsstellen and Diskontinuitäten on the negativen Page the Zahlenachse To eliminating.

regularly, and the To in ours days, go over ands over again try unternommen, The sperrige Gammafunktion finally through elegantere mutants To supplant. One suggestion of Herrn (p.t.) Peter Luschny from 2006 in example proposes a particularly elegant and slippery Funktionskurve with many interessanten mathematischen properties to. How always demand, has too these 'Luschny-L'-function The quality, on ganzzahligen Eingabewerten The suitable, too schulüblich ausmultiplizierbaren Fakultätswerte anzunehmen. The Berechnung results under application Another, however well erforschter zahlentheoretischer functions. enclosed a XProfan-Demoversion the suitable, on its Homepage published, C-Sharp-Program.

Info: the Urheberrecht lying entire with Herrn P. Luschny! One Info on its Homepage finds itself in the Programmtext.
Window Title "Die Luschny-L-function - glatter and eleganter as the Bernoulli/Euler-Gamma"
' C#-fountain: Appx.4 of https://www.luschny.de/math/factorial/hadamard/HadamardsGammaFunction.html
' deference: The filled Urheberrechte lying alone with Herrn (p.t.) Peter Luschny!
'(DT) demonstration-Translation to XProfan11.2a in 2014-10 by P.woodpecker, Wien (Austria); without Gewähr!
Window Style 24:Window 0,0-%maxx,%maxy-40:font 2:set("decimals",14)
var xh&=width(%hwnd)/2:var yh&=height(%hwnd)/2
line 0,yh&-2*xh&,yh&:line xh&,0-xh&,2*yh&
usepen 0,2,255
moveto 0,yh&-LFactorial(&Loop/10)

whileloop -100,100

    print " ";stature$("%g",&Loop/10),tab(10);stature$("%g",LFactorial(&Loop/10));mkstr$(" ",42-%pos)
    case %csrlin>42:locate 1,1
    lineto xh&+5*&Loop,yh&-10*LFactorial(&Loop/10)

endwhile

beep
waitinput
end

proc Psi :parameters x!

    declare psi!,piCotpix!,result!,C!,r!
    case (x!<=0) and (x!=Round(x!,0)):return -9999999

    if x!<0' reflection formula

        psi! = Psi(1-x!)
        piCotpix! = -Pi()/Tan(-Pi()*x!)
        return psi! - piCotpix!

    endif

    case x!<=val("1e-6"):return -0.57721566490153286 + 1.6449340668482264365 * x! - 1/x!
    result! = 0
    C! = 12

    while x!<C!

        result!=result!-1/x!
        x!=x!+1

    endwhile

    r! = 1/x!
    result!=result!+ Ln(x!) - 0.5 * r!
    r! = r!*r!
    r!=r!*(1/12-(r!*(1/120-(r!*(1/252-(r!*(1/240-(r!*1/132))))))) )
    return result!-r!

endproc'Psi

proc LnFactorial :parameters z!

    '//const double a0 = 1.0 / 12.0;
    '//const double a1 = 1.0 / 30.0;
    '//const double a2 = 53.0 / 210.0;
    '//const double a3 = 195.0 / 371.0;
    '//const double a4 = 22999.0 / 22737.0;
    '//const double a5 = 29944523.0 / 19733142.0;
    '//const double a6 = 109535241009.0 / 48264275462.0;
    var a0! = 0.0833333333333333333333333;
    var a1! = 0.0333333333333333333333333;
    var a2! = 0.252380952380952380952381;
    var a3! = 0.525606469002695417789757;
    var a4! = 1.01152306812684171174737;
    var a5! = 1.51747364915328739842849;
    var a6! = 2.26948897420495996090915;
    var sqrt2Pi! = 0.91893853320467274;
    z! = z! + 1
    return sqrt2Pi! + (Z! - 0.5) * Ln(Z!) - Z! +  \
    a0!/(Z!+a1!/(Z!+a2!/(Z!+a3!/(Z!+a4!/(Z!+a5!/(Z!+a6!/Z!))))))

endproc

proc Factorial :parameters x!

    case (x!<0) and (x!=Round(x!,0)):return -999999999
    case x!=0:return 1
    var y! = x!
    var p! = 1

    while y!<8:p!=p!*y!:y!=y!+1:endwhile

        var r! = Exp(LnFactorial(y!))

        if x!<8:r!=(r!*x!)/(p!*y!):endif

            return r!

        endproc

        proc LFactorial :parameters x!

            case x!=0:return 0.5
            var y! = if(x!<0,-x!*0.5,x!*0.5)
            var G! = y! * (Psi(y!+0.5) - Psi(y!)) - 0.5
            case x!<0:return G!/Factorial(-x!)
            y! = Pi()*x!
            var s! = Sin(y!)/y!
            return (1 - s! * G!) * Factorial(x!)

        endproc

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