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
jf
12/20/12 7:11pm

What you want is that the right side of "Data10 = ..." gets evaluated each time Data10 is used.

The way to tell Mathematica this is by using ":=" instead of "=".

Pension = 1000000; Risky = 0.6; Riskless = 0.4; riskfree = 0.04; mu =
0.12; sigma = 0.3; draw = 150000;
Data10 :=
Data9*(Risky*Exp[mu + sigma*RandomReal[NormalDistribution[0, 1]]] +
Riskless*Exp[riskfree]) - draw

Do[Print[Data10], {100}]

-150000+1.1205 Data9
-150000+1.13287 Data9
-150000+1.02558 Data9
...

See reference.wolfram.com/mathematica/ref/SetDelayed.html.


URL: reference.wolfram.com/mathematica/ref/SetDelayed.html,

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