| |
|
|
p.specht
| Zufallsgeneratoren for Normalverteilung (cue "Gaußsche Glockenkurve") there some. One langsameres, but for qualitative right good take action having Box and Muller 1958 pictured:
Window Title "Box-Muller: Normalverteilte Zufallszahlen, zB. with µ=0, "+chr $(240)+"=1"
'(CL) jan. 2012 by P.woodpecker, Demoware without jegliche Gewähr!
'{ Win7 Printbereich arrange. who no Win7 has: CLS reicht!
Font 2:randomize:cls rnd(8^8)
var xr%=(%WinRight- %WinLeft-width(%Hwnd))+1
var yr%=(%WinBottom-%WinTop-height(%Hwnd))+1
var u%=640:var v%=480:var xf!=0.797:var yf!=0.72
Window (u%-xr%)*xf!+xr%,(v%-yr%)*yf!+yr%
SetWindowPos %HWnd=(%maxx-u%)/2,((%maxy-v%)/2) - u%,v%
'}
set("decimals",16)
var pi2!= 6.283185307179586476925286766559
var fa! = 1/sqrt(pi2!)
declare r1!,r2!,z1!,z2!,s2!,s3!,n&
declare mw!,vz!,sa!,my$,my!,si5!,sigma!,s$
print " Wieviele Testzahlen go needed?: ";:input n&:case n&=0:n&=10000
print " where lying the reale story?: ";:input my$:my!=val(my$)
print "\n into undertow. Sigmagrenzen entrapments The folg.%-Sätze the values:"
print " 1"+chr $(240)+":68.27% 2:95.45% 3:99.73% 4:99.9937% 5:99.9999%"
print "\n difference Mittelpunkt to that worth, the on the weitesten lane lying,"
print " [no unplausibler Ausreisser!] (5"+chr $(240)+") ?: ";
input si5!
sigma!=abs(si5!)/5
s$="":clearclip
r1!=rnd()' gleichverteilt
Whileloop n&
r2!=rnd()
s2!=sqrt(-2*ln(r1!))
's3!=pi2!*r2!
z1! = s2! * cos(pi2!*r2!)'..cos(s3!) ' standard-normalverteilt
'z2! = s2! * sin(s3!)
s$=s$+st$(z1!*sigma!+my!)
casenot &Loop=n&:s$=s$+","
mw!=mw!+z1!
vz!=vz!+sqr(z1!)
r1!=r2!
EndWhile
beep
putclip s$
print "\n you've now "+st$(n&)+" Testwerte in the filing!"
mw!=mw!/n&
vz!=(vz!-mw!*mw!)/(n&-1)
sa!=sqrt(vz!)
print "\n control: "
print " story: ";mw!*sigma!+my!
'print " SP-Varianz: ";vz!
print " SP-Varianz: ";(sa!*sigma!)^2
print " stood.Abw.: ";sa!*sigma!
WaitInput
End
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 04/25/21 ▲ |
|
|
|