Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum > General > > "Loop doesn't work"

Post Reply:
Name:
Email Address:

Please send email when my message is replied to.

Url (optional):
Subject:
Message: view original message?
Attachment (optional):
Please answer this:1+3 =



Original Message (ID '182417') By Bill Simpson:
Code: Short-Version doesn't work: ... pension = pension*(Risky* Exp[mu + sigma*RandomReal[NormalDistribution[0, 1]]] + Riskless*Exp[riskfree]) - draw Long-Version Works: ... year10 := year9*(Risky*Exp[mu + sigma*RandomReal[NormalDistribution[0, 1]]] + Riskless*Exp[riskfree]) - draw The difference between not working and working is = versus := = calculates one number now and uses that same number 100 times in your Table. := saves then definition of year10 and calculates a new number each time you use year10 in your Table. Study this and then think how to modify your code. http://reference.wolfram.com/mathematica/tutorial/ImmediateAndDelayedDefinitions.html