Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'not assigning a function value . . .' topicStudent Support Forum > General > Archives > "not assigning a function value . . ."

Next Comment >Help | Reply To Topic
Author Comment/Response
R Erwin
01/29/02 11:42pm

I have not been able to figure out why the toy code below successfully assigns values to a function for some parameter values, but not others. After assigning initial values for f1[n,d], I evaluate

For[d = 0, d <= 0.01, d = d + 0.001,
For[n = 1, n <= 10, n++,
f1[n, d] = 1 + f1[n - 1, d] + Random[Real, {-d,d}];
Print[n]; Print[d]; Print[f1[n, d]]];
f1burst = Table[f1[n, d], {n, 1, 10}]]
The end of the print job looks like
...
(n) 9
(d) 0.01
(f1)6.49024

10
0.01
7.48267

So far, so good. But when I try to call up f1 for various n and d, I only get values for d < .009:

In[141]:=f1[10,.008]
Out[141]=7.37297
In[142]:=f1[10,.009]
Out[142]=f1[10,0.009]
In[143]:=f1[10,.01]
Out[143]=f1[10,0.01]
I don't understand how this could be, especially since the number f1[10,.01] is right there, at the end of the print job. I suppose there must be something strange about the code, but what?

URL: ,

Subject (listing for 'not assigning a function value . . .')
Author Date Posted
not assigning a function value . . . R Erwin 01/29/02 11:42pm
Re: not assigning a function value . . . Forum Modera... 02/03/02 12:15pm
Next Comment >Help | Reply To Topic