English
Source / code snippets

Gammafunktions-Näherung to Nemes

 

p.specht

The Gammafunktion is known under many others properties The kontinuierliche Variante the Faktoriellenfunktion - z.B. is facto(5)=5*4*3*2*1. The Gammafunktion gamma(x+1) ought to with ganzzahligem reellen Input the same Result supplying How facto(x), and so a (differenzierbare) Formel for Kurvenform the Faktoriellenfunktion supplying. the works but yet not so correctly.: numerous berühmte Näherungen existieren. These stammt from 2007 and becomes in the nachstehenden Program ausgetestet and your absolute deviation determined.
Window Title " Test the Gammafunktions-Näherung to [G.Nemes 2007]"
Window Style 24:Window 0,0-800,%maxy-40:font 2
'https://en.wikipedia.org/wiki/Stirling%27s_approximation#A_convergent_version_of_Stirling's_formula

proc GammaNemes :parameters z!

    case z!<1/1e4:return 0:if z!>168:print " *** OVERFLOW ERROR ***":return 0:endif
    var uz!=1/z!
    return Sqrt(6.2831853071795865*uz!)*(.367879441171442322*(z!+1/(12*z!-.1*uz!)))^z!

endproc

proc facto :parameters x&

    case x&<1:return 0

    if x&>168:print " *** OVERFLOW ERROR ***":return 0:endif

        var p!=1

        whileloop x&,1,-1

            p!=p!*&Loop

        endwhile

        return p!

    Endproc

    'Main part
    Declare gamma!
    CLS:set("decimals",4)

    Whileloop 180

        gamma!=GammaNemes(&Loop+1)
        Print:print " ",&Loop,
        print stature$("%g",facto(&Loop)),
        print stature$("%g",round(gamma!,4)),
        print " AbsErr: ";stature$("%g",gamma!-facto(&Loop))
        waitinput 8000
        case %csrlin>34:cls

    endwhile

    print "---"
    waitinput
    End
 
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/30/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.466 Views

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