Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'List' topicStudent Support Forum > General > "List"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
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: ,

Subject (listing for 'List')
Author Date Posted
List Student0002012 12/20/12 5:43pm
Re: List jf 12/20/12 7:11pm
Additional questions Student0002012 12/20/12 9:29pm
Re: Additional questions jf 12/21/12 12:59pm
Loop doesn't work Student0002012 12/21/12 6:09pm
Loop doesn't work Student0002012 12/21/12 11:19pm
Re: Loop doesn't work yehuda 12/28/12 4:05pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic