Mathematica 9 is now available
Student Support Forum
Student Support Forum > General > > "List"

Post Reply:
Email Address:

Please send email when my message is replied to.

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

Original Message (ID '180246') By jf:
In Response To 'Additional questions' --------- 1. a) The documentation on Count talks about patterns, so you need to read up on patterns. The first few sections of should help. 1. b) In[1]:= data10 = RandomReal[{-1, 1}, {10}] This pattern says to match one of anything, so long as it is a negative number. In[3]:= Count[data10, _?Negative] Out[3]= 3 If the values you are looking for are deeper than the first level, use a "level specification" to say how deep to drill. In[4]:= Count[Table[data10, {100}], _?Negative, 2] Out[4]= 300 2) Coefficient for first iteration. dat = Pension; The ":=" (SetDelayed) is not needed because the whole line will be evaluated each iteration. Do[ dat = dat*(Risky*Exp[mu + sigma* RandomReal[NormalDistribution[0, 1]]] + Riskless*Exp[riskfree]) - draw, {10}] "dat" will have the final value after the loop finishes. Starting user-variable names with capital letters risks conflict with current or future built-in names.