Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Dynamic Simulation for Bank - Exercise 3 in 1.7
n= 50 start1 = 0 start2 = 0 start3 = 0 start = 0 end1 = 0 end2 = 0 end3 = 0 end4 = 0 t2 = 0 TABE1 =" " TABE2 = " " TABE3 = " " TABE4 = " " TABE5 = " " TABE6 = " " TABE7 = " " TABE8 = " " TABE9 = " " TABE10 = " " print(" Customer A_i t_i Counter 1 Counter2 Counter3 Counter4 ") print(" Start S_i End Start S_i End Start S_i End Start S_i End W_i ") for(i in 1:50){ u = runif(1, min = 0, max = 1) A = ceiling((-2)*log(u)) x = runif(1, min = 0, max = 1) if(i == 1){ # اولی t1 = 0 } else{ #بقیه t2 = t1 + A t1 = t2 } if(x < 0.33){ #حساب جاری j = runif(1, min =0 , max = 1) Y = floor(2*j) + 1 #انتخاب باجه 1 یا 2 if( Y == 1){ # باجه 1 if(t2 > end1){ start1 = t2 j1 = runif(1, min = 0, max =1) S = floor(3*j1) + 2 end1 = start1 + S W = 0 cat(TABE1,i, TABE2, A, TABE2, t2, TABE3, start1, TABE3, S, TABE3, end1, TABE4, W, TABE1 ) print("-") }else{ W = end1 -t2 start1 = end1 + W j1 = runif(1, min = 0, max =1) S = floor(3*j1) + 2 end1 = start1 + S cat(TABE1,i, TABE2, A, TABE2, t2, TABE3, start1, TABE3, S, TABE3, end1, TABE4, W,TABE1 ) print("-") } }else{ # باجه 2 if(t2 > end2){ start2 = t2 j2 = runif(1, min = 0, max =1) S = floor(3*j2) + 2 end2 = start2 + S W = 0 cat(TABE1, i, TABE2, A, TABE2, t2,TABE5, start2 ,TABE3, S, TABE3, end2, TABE6, W,TABE1 ) print("-") }else{ W = end2 -t2 start2 = end2 + W j2 = runif(1, min = 0, max =1) S = floor(3*j2) + 2 end2 = start2 + S cat(TABE1, i, TABE2, A, TABE2, t2,TABE5, start2 ,TABE3, S, TABE3, end2, TABE6, W,TABE1 ) print("-") } } } else { # حساب پس انداز p = runif(1, min = 0, max = 1) Q = floor(2*p) + 3 if( Q == 3){ #باجه 3 if(t2 > end3){ start3 = t2 p3 = runif(1, min = 0, max = 1) S = floor(3*p3) + 1 end3 = start3 + S W = 0 cat(TABE1, i, TABE2, A, TABE2, t2, TABE7, start3, TABE3,S, TABE3, end3, TABE8, W,TABE1) print("-") }else{ W = end3 - t2 start3 = end3 + W p3 = runif(1, min = 0, max = 1) S = floor(3* p3) + 1 end3 = start3 + S cat(TABE1, i, TABE2, A, TABE2, t2, TABE7, start3, TABE3,S, TABE3, end3, TABE8, W,TABE1) print("-") } }else{ # باجه 4 if(t2 > end4){ start4 = t2 p4 = runif(1, min = 0, max = 1) S = floor(3*p4) + 1 end4 = start4 + S W = 0 cat(TABE1, i, TABE2, A, TABE2, t2, TABE9, start4, TABE3, S, TABE3, end4, TABE10, W,TABE1 ) print("-") }else{ W = end4 -t2 start4 = end4 + W p4 = runif(1, min = 0, max = 1) S = floor(3* p4) + 1 end4 = start4 + S cat(TABE1, i, TABE2, A, TABE2, t2, TABE9, start4, TABE3, S, TABE3, end4, TABE10, W,TABE1 ) print("-") } } } }
run
|
edit
|
history
|
help
0
Scatterplot using Ggplot Sample
Análise de experimento em DIC e teste de Tukey
AjusteNaoLinear-alpha-c
ax² + bx + c = 0 (Solução e gráfico com as raízes)
Football weights
taylorsen7
test
SEIR-Modell
14-09-2020QRajustelinear
asdf