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

Next Comment >Help | Reply To Topic
Author Comment/Response
Randy Silvers
11/06/01 02:27am

I am trying to find a solution and let Mathematica do the work, but something seems to go wrong when I enter the commands in the For loop. I specify initial values outside the For command, then an initial value for the incremented variable within the For command. I have a compound expression that is evaluated, which includes a Solve[] command.

When I manually run each command, then increment q_{s2} myself, then repeat, everything works fine, though this is not what I want to do. I get a solution for sol, and with a different value of q_{s2}, I get a new solution for sol.

As soon as I run the For loop, it executes it once, and then I can no longer get a solution for sol, within or outside the For loop. Even though I reset the values to their original ones.

I am perplexed and frustrated, since this is supposed to save me time, but has actually cost me more time, I'm guessing.

I've attached the file. As can be seen, the first 13 steps symbolize a couple values and then set the primitives. The next four commands yield the first solution. Then, the For loop is executed, rather rapidly. Suddenly, there is no solution (sol is empty), the identical Solve command that is identical to the one both in the For loop and prior to the For loop now no longer yields a solution, and the C2N and test statistic cannot yield a value.

Thanks.

Attachment: temp.nb, URL: ,

Subject (listing for 'For loops')
Author Date Posted
For loops Randy Silvers 11/06/01 02:27am
Re: For loops Henry Lamb 11/09/01 02:14am
Next Comment >Help | Reply To Topic