Masato Shimura jcd2773@nifty.com 28 3 9..................................................2............................................. 2.3............................ 3.4................................................ 7.5 script.................................................. 8.6................................................ 2 J 2 2................................................... 2 2.2................................................. 3 3 Reference 9 A 9 A.............................................. 9 A.2 2................................................ 9 B E.Show 9. (
f (x = λe λx E(x = λ V(x = λ 2 plot hist_count r59* exponentialrand 3 stick plot hist_count exponentialrand 3 25 2 5 5 2 3 4 5.2 lnn(µ, σ 2, N = xσ 2π exp 2 (x µ 2 σ 2 x (<x< N(µ, σ 2 s = σt + µ e s 35 3 25 2 5 5 5 5 2 25 3 2
plot hist_count 3 rand_normal_ln 4.345.48.2. Script rand_normal_ln=: 4 : NB. y is lnn( 4.345.48 NB. y is N (rno N MU VAR =: y NML=: rno ;, x xˆ MU + (%: VAR* NML NB. grouping for histgram hist_count=: 3 : NB. usage: plot ( hist_count rno 4.3.48 NB. x is pitch(times// y is random number ; # L: ( : <. tmp<;. tmp=. /: y : ; # L: ( : <.&.(x &* tmp<;. tmp=. /: y NB. ===========Norman thomson======================== rnd=: (%?@(e9&(# NB. uniformed random number ( run=: + (*rnd/ rn=:-:-+/@run@:( &,NB. Normal distribution NB. Usage: rno a b c//a(mean b(standard deviation c(number NB. e.g. nro 2 5 is N(2 5 rno=: 3 : ({. y +({y *({: y (rn &>@#2.3 issue: 2952 4889 27.448 59.54 97.78 4.34897
49.4 5895.53.4366 F(t + dt F(t = eλt e λ(t+dt F(t e λt = e λdt dt e λdt λ = 59.5 %59.5.686 λ =.68 Y = lnx µ σ 2 f (t = µ2 { (lnx e 2σ 2 } 2πσx e µ+σ2 2 (= e 2µ+σ2 97.78 e 2µ+2σ2 e 2µ+σ2 5895.53 ( e µ+σ2 2 = 97.78 e 2µ+2σ2 e 2µ+σ2 = 5895.53 2µ + σ 2 = 2 ln97.78 a = 2 ln97.8 = 2µ + σ 2 e 2µ+2σ2 = 5895.53 + e 2µ+σ2 2µ + 2σ 2 = ln(5895.53 + e a = ln(5895.53 + e 2 ln97.8 ( 2µ + σ 2 = 9.6544 2µ + 2σ 2 = 9.64578 a = 2 ln97.78 = 2µ + σ 2 2* ˆ. 97.78 9.6544 2µ + 2σ 2 = ln(5895.53 + e 2 ln97.8
ˆ. 5895.53+ x ˆ +: ˆ. 97.78 9.64578 dat=. 2 3 $ 2 9.6544 2 2 9.64578 dat 2 9.6544 2 2 9.64578 cr=: %.}:" cr dat _.22e_5 4.34255.77636e_5.4834 λ = =.68 59.5 4.34255.4834 machi_ DATW _.22e_5 4.34255.77636e_5.48342 a=. 59.54;97.78;49.4;5895.53 machi_ a _.22e_5 4.34255.77636e_5.48342 N.Thomson Script u : (, t = ln(u : λ N(m, σ 2 : ( s = σt + m e s : a=. 59.54;97.78;49.4;5895.53 machi_sim a NB. unit is second arrive(exparrive cumurative service(ln,real
NB. ------------------------------------.52249 38.653 38.653 4.7287 64.96.966477 2.35 4.685 4.6626 5.77.4976 42.2647 82.9452 3.8293 45.283.738259 8.68.3 4.659 58.2759.2473 84.5429 85.556 4.8632 29.44.464979 82.689 368.246 4.76546 7.385.88253 7.4428 375.686 4.2626 67.7795.87678 2.773 388.43 5.3786 23.946.833982 47.95 536.38 2.88564 7.95.345582 63.2628 599.57 5.727 76.39 x number of customers y machi_sim DATW NB.this type is also available plot fulfill DATW 6 5 4 3 2 5 5 2 25 3 3 machi_sim=:4 : if. 4=#y do. NB. 4 parameter MN_AR MN_SV VR_AR VR_SV =: y M M =:{:" machi_ y NB. parameter for ln normal random else. NB. native data
M M =:{: " machi_ y end. M=: x ˆS=: M + (%: M* rno,,x NB. ln normal random M2=: - MN_AR* ˆ. M=. rnd x NB. exponential random NB. -/lambda ln u M,.M2,.(; +/ L: <\ M2,.S,.M.4.4. 4 2 plot_machi DATW (or 2 plot_machi 5 machi_sim 59.54;97.78;49.4;5895.53 x (ATM y 2 plot machi 5 machi sim a 35 3 DATW N arr wait NB. 25 4 2 7 37 3 68 4 38 58 5 27 89 6 2 52 25 2 5 5-5 - -5 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 2 2 22 23 24 25 26 27 28 29 3 3 32 33 34 35 36 37 38 39 4 4 42 43 44 45 46 47 48 49 5 4 (.4.2. 2. (ATM 3. ( (FN
M M NR lastopen arrive service nextopen f st.nxt lastopen arrive service nextopen f st.nxt 65 F 232 N 65 296 68 464 F 232 64 58 662 N 2 464 63 89 72 N 662 633(w29 52 74 F 3 72 744 59 83 N 74 644(w5 6 774 F 4 83 789(w4 42 845 F 774 773(w 33 97 N 5 845 8(w35 3 958 N 97 826(w8 27 934 F 2 machi_anal DATW nr. arv svce start end wait NB. --------------------- 25 4 25 65 _25 95 37 95 232 _95 2 296 68 296 464 _23 3 64 58 64 662 _372 4 63 89 63 72 _67 5 633 52 662 74 29 6 664 6 74 774 5 7 744 59 744 83 _24 8 773 33 774 97 9 789 42 83 845 4 8 3 845 958 35 826 27 97 934 8 2 863 6 934 994 7 3 95 9 958 48 7 4 72 72 72 44 _78 NB. UNIT is sec. NB. number/arrive time /service time/start service/end_service/waiting NB. arrive start and end is cumurative(=real second NB. minus of wait is free time in operation 2 plot machi2 DATW 3 plot machi2 DATW.5 script NB. ----------main-------------------------
5 5 2 25 3 9 8 arrive quere service 7 6 5 4 3 2 5 ( 2 7 arrive quere service 6 5 4 3 2 5 5 2 25 3 6 ( 3 machi_anal=: 4 : NB. 2 machi_anal DATW NB. 3 machi_anal 5 machi_sim m;m;v;v NB. 59.54;97.78;49.4;5895.53 DAT=: 2 {" service y NB. del number index MACHINE=. +/" TMP=: x {. DAT NB. next free time ANS=. {(MACHINE,.(-{. " TMP,.TMP for_ctr. i. (# DAT - x do. COMBI=.({. MACHINE,(ctr + x {DAT WAIT NEXTOPEN RENEW =. calc_combi_sub COMBI ANS=. ANS,<NEXTOPEN,WAIT, RENEW MACHINE=. /: (}. MACHINE,NEXTOPEN end.
2 5 3 4{" (i. # DAT,.DAT,.;(",. ANS calc_combi_sub=: 3 : LAST_STAY NW_ARR NW_SVC =. y NB. last-open new-arrive new-servicetime WAIT=. -/ LAST_STAY,NW_ARR NB. include minus NXT_OPEN=. >./(LAST_STAY,NW_ARR + NW_SVC NB. next open WAIT;NXT_OPEN;(>./(LAST_STAY,NW_ARR,NW_SVC.6 file machi new.ijs catalogue main sub explanation usage plot plot machi 2 plot machi y plot machi 2 plot machi y plot machi2, 2 plot machi2 y analysis machi anal calc combi sub x machi anal y x machi anal x2 machi sim y fulfill fulfill fulfill y fulfill service fulfill quere x fulfill service y fulfill quere fulfill quere x fulfill quere y machi sim machi sim x machi sim y machi simx machi simx another x machi simx y machi machi moment sub mach y machi machi moment sub mach y rud run rn rno N.Thomson sample file touhoku wait.csv ATM DATW (
949 952 OR 955 A probrem in the theory of Queres Rep.Stat.Appl.Res.JUSE,vol.3 956 On the Server Quering Process withb a Particular Rep.Stat.Appl.Res.JUSE,vol.4 957 OR 958 6 2 (QR
2 J classes/packages/stats/ random.ijs,statdist.ijs Ver.6 New random number generators, including Mersenne Twister as the default RNG. 2 location parameter scale parameter 2. rand v rand generate y random numbers in interval (, generate y random numbers in interval (, binom binomialdist binomialprob binomialrand y has 2 elements p,n: normal normalprob normalrand y has 3 or 4 elements: = mean of distribution = standard deviation 2 = minimum result 3 = maximum result (rand with mean=, standard deviation=. Box Muller method Γ gammarand y has 2 elements p,n = power parameter = number of trials if p= this is the exponential distribution f (x = Γ(λ αλ x λ e αx
β betarand y has 3 elements p,q,n p is probability of success in one trial q is -p n is number of trials f (x = B(p, q xp ( x q E(x = p p + q pq V(x = (p + q 2 (p + q + Γ(pΓ(q B(p.q = Γ(p + q (p!(q! (p + q +! = poisson poissondist poissonprob poissonrand y has 2 elements: = mean of distribution = maximum value to show e.g. poissondist 2 = list of probabilities of values from to in poisson distribution of mean 2 exponential exponentialrand with mean=. F(x=-ˆ-x y = number of trials cauchy cauchyrand F(x =.5 + (arctan x%o. y is number of trials 2.2 binomial random numbers binomialrand.4 2 binomialrand=: 3 : p n =. y r=. 247483647 s=. <:p*r s>?n#<:r
normal random numbers Box Muller Method U, U 2 Z = 2logU cos(2πu 2 Z 2 = 2logU sin(2πu 2 stick plot hist count normalrand normalrand=: 3 : (2 o. +: o. rand y * %: - +: ˆ. rand y Z is cos without parameter.5.45.4.35.3.25.2.5..5 2 3 4 5 7 normalrand poisson random numbers f (x = λx e λ x! bar plot hist count poissonrand 3 poissonrand=: 3 : m n =. y roll=. -@ˆ.@rand r=. b=. m >: t=. roll n i=. i.n while. #i=. b#i do. b=. m >: t=. (b#t + roll #i r=. (b + i{r i } r end. r 2 5 5 2 3 4 5 6 7 8 9 2 3 4 8 poisson
exponential random numbers f (x = λe λx exponentialrand=: 3 : -ˆ.rand y f (x = e λx stick plot hist count exponentialrand.2.8.6.4.2 5 5 2 25 3 35 4 45 5 9 e gammarand=: 3 : Γ random numbers f (x = β α Γ(α xα e( x p n =. y β r=. n# k=. p-i=. <.p gammarand(p,n if. k do. p is λ(= α, β r=. betarand k,(-.k,n p= is exponential rand / r=. r * -ˆ.rand n n α = β (λ = end. β if. i do. α a = m r-ˆ.*/rand i,n 2, β = 2 m χ2 end. stick plot hist count gammarand 2 4 stick plot hist count gammarand 3 35 25 3 2 25 2 5 5 5 5 2 3 4 5 6 7 8 9 2 4 6 8 2 Γ(λ = 2 Γ(λ = 3
β randomnumbers f (x = B(a, b xa ( x b where, B(a, b = ta ( t b dt betarand(p,p2,n p is λ, p2 is λ 2 stick plot hist count betarand 2 3 2 betarand=: 3 : p q n =. y if. (>p *. >q do. b=. n# r=. n# whilst. e. b do. m=. +/b x=. (rand mˆ%p y=. x+(rand mˆ%q t=. >:y z=. (t#x%t#y i=. t#b#i.#b b=. i } b r=. (z+i{r i } r end. else. s%(gammarand q,n+s=. gammarand p,n end. stick plot hist count betarand 4 6.8 2.5.6.4 2.2.5.8.6.4.5.2 2 3 4 5 6 7 8 9 23456789222 2324252627282933323 3435363738394442434 4546474849555253545 5657585966626364656 6768697772737475767 7879888283848586878 8 99929394959697 2 3 4 5 6 7 8 923456789222223242526272829333233343536373839444243444546474849555253545556575859666263646566676869777273747576777879888283848586 2 β(λ = 2, λ 2 = 3 3 β(λ = 4, λ 2 = 6
stick plot hist count cauchyrand cauchy random numbers.45.4 NB. random numbers in a cauchy distribution NB. with F(x=.5+(arctan x%o. NB. NB. y = number of trials cauchyrand=: 3 : 3 o. o. _.5+rand y.35.3.25.2.5..5 2 4 6 8 2 4 6 8 2 4 cauchy discreterand ((i.4;..3.4.2; 3 2 2 2 3 2
Erlang Anger Krarup Erlang(878-929 Denmark CTT(Copenhagen Telephone and Telegram Jensen 98 CTT 99 The theory o f probability and telephone conversation Erlang British Post Office issue :(http://www-history.mcs.st-and.ac.uk/history/biographies/erlang.html/
3 Reference 22 A A. Discrete Uniform DIstribution P(X = k =, (k =, 2,, n k n=6 A.2 2 B(n, p P(X = k = n k pk ( p n k, (k =, 2,, n B E.Show plot npdf steps 5 5.4 plot ncdf steps 5 5.35.9.8.3.7.25.6.2.5.5.4.3..2.5. 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 5 normal pdf 6 normal cdf B.. Γ gamma.5 5 6 7.886227 24 2 72 6 ig 5 2 3 46.847.95 9.99 2
6 incgam 5 2 3.38439.93294.999928 B..2 Beta 4 beta 2 3 4.5.5.66667.74286.587 4 4 2 4 beta 2 3 4.5.5.66667.5.587 4 2 ib..6.7 2.3e_5.6848.264.5 4 2 incbet..6.7.46.33696.52822 B..3 others 5.2 bincdf i.6.32768.73728.9428.99328.99968 _. 5 chisqcdf.832 4.3546.75 2.55.25.5.95.999 3 fcdf.8458 3.7826 6.5523 2.5527.5.95.99.999 2.3 poissoncdf i.5.259.33854.59639.799347.96249