Re: About NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg91846] Re: About NDSolve
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Wed, 10 Sep 2008 05:07:55 -0400 (EDT)
- Organization: University of Bergen
- References: <ga5kq2$r9j$1@smc.vnet.net>
P_ter wrote: > Hello, > Daniel Lichtblau wrote in "Re: phase-space versus controlling parameter surface": > > k = .3; > > Clear[g]; > g[b_?NumberQ] := > g[b] = {x[t], v[t], b} /. First[NDSolve[{x'[t] == v[t] , > v'[t] == -x[t]^3 - k*v[t] + b*Cos[t], x[0] == 1, v[0] == 0}, {x, > v}, {t, 0, 2000}, MaxSteps -> Infinity]] > pts = Table[ > Evaluate[Table[g[b], {b, 0.2, 0.6, .01}]], {t, 1950, 2000}]; > > If I use h[s_]:= s^3 and replace x[t]^3 by h[x[t]], NDSolve in pts complains. Why can't I do this? > Piecewise or Which (e.g., Which[x[t] < -1, -1, x[t] > 1, 1, True, x[t]]) on the place of x[t]^3 also gives problems. > Any suggestions? > P_ter > I tried this, but didn't get any errors.