Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

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


  • 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