| |
|
|
p.specht
|
Titre de la fenêtre " Asym-Erf(), qui Gauss-Fehlerfunktion dans asymptotischer Näherung "
' source: https://jean-pierre.moreau.pagesperso-orange.fr/Basic/asymerf_bas.txt
' (D) Demo 2016/11 transponiert pour XProfan 11.2a by P. Specht, Vienna / Austria
' aucun cependant geartete Gewähr! No warranty whatsoever!
'****************************************************
'* Program to demonstrate ASYMERF *
'* ------------------------------------------------ *
'* Reference: BASIC Scientific Subroutines, Vol. II *
'* by F.R. Ruckdeschel, BYTE/McGRAWW-HILL, 1981 [1].*
'* ------------------------------------------------ *
'* SAMPLE RUN: *
'* Find le value of ERF(X)=2*Exp(-X*X)/SQRT(PI) *
'* *
'* Contribution X ? 3 *
'* ERF(X)= .9999779 with error estimate= -.00000000 *
'* Number of terms evaluated quoi 10 *
'* *
'* Contribution X ? 4 *
'* ERF(X)= 1.0000000 with error estimate= 0.0000000 *
'* Number of terms evaluated quoi 17 *
'****************************************************
' DEFINT I-N : DEFDBL A-H, O-Z
Fenêtre Style 24:CLS:font 2:Déclarer x!,y!,e!,n&:Set("decimals",17)
Tests:
Imprimer "\n\n qui Gauss-Fehlerfunktion Erf(x) pour la valeur x = ";:Contribution x!
'Gosub S1000"
S1000
Imprimer
Imprimer "\n Erf(x) pour la valeur x= ";x!;" beträgt: ";format$("0.######",y!)
PRINT " avec einer Fehleabschätzung trop ";format$("##0.##########",e!)
PRINT
PRINT " ";n&;" Terme wurde berücksichtigt.";
WaitInput
Goto "Tests"
'***********************************************************
'* Asymptotic series expansion of le integral of *
'* 2 EXP(-X*X)/(X*SQRT(PI)), le normalized error function *
'* (ASYMERF). This program determines le values of le *
'* above integrand using à asymptotic series which is *
'* evaluated to le level of maximum accuracy. *
'* The integral is à partir de 0 to X. The input paramètre, X *
'* must être > 0. The results sont returned dans Y and Y1, *
'* with le error measure dans E. The number of terms used *
'* is returned dans N. The error is roughly equal to first *
'* term neglected dans le series summation. *
'* ------------------------------------------------------- *
'* Reference: A short table of integrals by B.O. Peirce, *
'* Ginn and Company, 1957. *
'***********************************************************
Proc S1000
Déclarer c1!,c2!,y1!
n& = 1 : y! = 1 : c2! = 1 / (2 * Sqr(x!))
'G1100:
Repeat
y! = y! - c2!
n& = n& + 2: c1! = c2!
c2! = -c1! * n& / (2 * x! * x!)
'Test for divergence - The pause point is roughly N=X*X
Cas ABS(c2!) > Abs(c1!) : BREAK':= Goto "G1200"
' Continue summation
Until 0':= Goto "G1100"
' G1200:
n& = (n& + 1) / 2
e! = EXP(-x! * x!) / (x! * 1.772453850905516)
y1! = y! * e!
y! = 1 - y1!
e! = e! * c2!
RETOUR
'Fin of file Asymerf.prf
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 22.05.2021 ▲ |
|
|
|