English
Source / code snippets

Eulersche gamma-function

 

p.specht

The function "Faktorielle"ist only for positive GANZE numbers definiert: 5 ! = 1 * 2 * 3 * 4 * 5 = 120. what but is z.B. 5.2 ! How should to the calculate? too above has mr Leonard Euler already A.D. 1729 thoughts made: it found a function, The like The Fakultät functions, but in the whole (in the nachstehenden Program only positive) Float-Zahlenbereich Results supply:

gamma( x+1 ) yields then very x ! . wants one means The Fakultät of 5.2 know, berechne one The gamma-function for 6.2: The response: 5.2! = gamma(6.2) = 169.406099462... clear, tappt im dunkeln had to Yes larger as 120 and small as 6!=720 his...

uses becomes the z.B. in the Versicherungsmathematik to Bestimmung small and mittlerer Schadenswahrscheinlichkeiten, or in the Nachrichtentechnik, where tappt im dunkeln The basis the undertow. Gammaverteilung darstellt, The in Verkehrsauslastungsgleichungen (Netzwerkkapazitäts-Dimensionierung) to application comes. The Gammafunktion-1 standing incidentally in Date-Sucheingabefeld available: simply ' 5.2 ! ' prompt...
Window Title "Gamma-function for Reelle values > 0 "
' Fortran90-Source: https://jean-pierre.moreau.pagesperso-orange.fr/Fortran/gamma_f90.txt
' Migriert to XProfan11.2a 2014-10 by P.woodpecker, Wien; without jedwede Gewähr!
' details: https://de.wikipedia.org/wiki/Gammafunktion   or.
' https://en.wikipedia.org/wiki/Stirling%27s_approximation#Versions_suitable_for_calculators
Window Style 24:font 2:randomize
Window %maxx/4,%maxy/4-%maxx/2,%maxy/2
Main:
Test_Gamma
Waitinput
End
'*********************************************
'* Program to demonstrate the gamma Function *
'* ----------------------------------------- *
'* Reference:                                *
'* "Numerical Recipes, by W.H. Press, B.P.   *
'*  Flannery, s.A. Teukolsky and T. cousin-  *
'*  ling, cambridge University Press, 1986"  *
'*  [BIBLI 08].                              *
'* ----------------------------------------- *
'* SAMPLE RUN:                               *
'*                                           *
'*       X        gamma(X)                   *
'*  -------------------------                *
'*    0.5000    1.772453851                  *
'*    1.0000    1.000000000                  *
'*    1.5000    0.886226925                  *
'*    2.0000    1.000000000                  *
'*    2.5000    1.329340388                  *
'*    3.0000    2.000000000                  *
'*    3.5000    3.323350970                  *
'*    4.0000    5.999999999                  *
'*    4.5000   11.631728395                  *
'*    5.0000   23.999999996                  *
'*                                           *
'*********************************************

PROC Test_Gamma

    declare x!,y!
    declare i&
    print
    print  "      X        gamma(X)    "
    print  "  __________________________________ "
    x!=0

    whileloop 100

        x!=x!+0.1
        y! = gamma(x!)
        Print "\n";stature$("     ##0.0####",x!),tab(14);stature$("%g",round(y!,15))
        case %csrlin>20:waitinput

    endwhile

    print
    waitinput

endproc

proc gamma :parameters xx!

    '*******************************************
    '*           FUNCTION  GAMMA(X)            *
    '* --------------------------------------- *
    '* Returns the value of gamma(x) in double *
    '* precision as EXP(LN(GAMMA(X))) for X>0. *
    '*******************************************
    case xx!<=0:return 0
    declare cof![6],x!,tmp!,ser!,stp!,helped!,one!,fpf!,j&,gamma!
    cof![1]=76.18009173:cof![2]=-86.50532033:cof![3]=24.01409822
    cof![4]=-1.231739516:cof![5]=0.00120858003:cof![6]=-0.00000536382
    stp!=2.50662827465:helped!=0.5:one!=1.0:fpf!=5.5
    x!=xx!-one!
    tmp!=x!+fpf!
    tmp!=(x!+helped!)*LN(tmp!)-tmp!
    ser!=one!

    whileloop 6:j&=&Loop

        x!=x!+one!
        ser!=ser!+cof![j&]/x!

    endwhile

    gamma! = EXP(tmp!+LN(stp!*ser!))
    return gamma!

endproc

 
XProfan 11
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.384 Views

Untitledvor 0 min.
Sven Bader08/31/23
p.specht11/21/21
R.Schneider11/20/21
Uwe Lang11/20/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