Re: NDSolve, Do loop, and Plot
- To: mathgroup at smc.vnet.net
- Subject: [mg77374] Re: NDSolve, Do loop, and Plot
- From: chuck009 <dmilioto at comcast.com>
- Date: Thu, 7 Jun 2007 04:00:25 -0400 (EDT)
- Organization: The Math Forum
Your code worked fine on my machine (5.2). Also, to get it to work on a list of w values, I just defined your code as a pure function and then used the Map construct applied to a list of w values (the {2,3,4} list at the end): Map[mysol[#] = NDSolve[{x'[ t] == -y[t] - x[t]^2, y'[t] == # x[t] - y[t]^3, x[0] == y[0] == 1}, {x, y}, {t, 20}]; Plot[{Evaluate[x[t] /. mysol[#]], Evaluate[y[t] /. mysol[#]]}, {t, 0, 20}] &, {2, 3, 4}]