| Author |
Comment/Response |
Student0002012
|
12/21/12 6:09pm
Dear sir,
i'm ashamed to ask you again, but you are the only one who responded with good and quick answers!
The task i had to solve is:
How often (in 100 times) will be the person solvent after 10 years? I'm done, but i need to make the mathematica "code" as short as possible, so i have to use loops.
Everything worked perfect and the literature helped me aswell!
But the loop doesn't work properly...
Do[pension =
pension*(Risky*
Exp[mu + sigma*RandomReal[NormalDistribution[0, 1]]] +
Riskless*Exp[riskfree]) - draw, {10}]
Count[{Table[pension, {100}]}, _?NonNegative, 2]/100 // N
If i let mathematica loop this 10 years it gives me the solution,
but if i let mathematica count 100 solutions it only uses 1 solution and doesn't compute it 100 different times....
And ":=" doesn't work in this loop!
Attachment: basic-new.nb, URL: , |
|