MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NDSolve, Do loop, and Plot


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}]


  • Prev by Date: Re: Mapping a pure function with 2 conponents.
  • Next by Date: Re: Mapping a pure function with 2 conponents.
  • Previous by thread: Re: NDSolve, Do loop, and Plot
  • Next by thread: Re: NDSolve, Do loop, and Plot