Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

stepwise ode. why does this fail?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48415] stepwise ode. why does this fail?
  • From: sean_incali at yahoo.com (sean kim)
  • Date: Fri, 28 May 2004 00:51:04 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Why does this fail? I don't understand. I think it's because the
function defining the a0 is delayed...  is that right?

if so, how do i define a stepwise ode in Mathematica? I wanted to make a0= 0
at time 0, then 1/20 for given time then 0 and again opver next time
frame then 1/20 again for the rest of the time.

below is my attempt. but it brings back 

NDSolve::ndnum: Encountered non-numerical value for a derivative at t
== 0.


k1 = 1/10;
k2 = 1/20;
a0 := 0 /; t < 0 ;
a0 := 1/20 /; 0 <= t <= 200 ;
a0 := 0 /; 200 <= t <= 600 ;
a0 := 1/20 /; 600 <= t <= 1000; 

ndsolution =
NDSolve[{b'[t] == -k2 b[t] y[t], x'[t] == -k1 a0 x[t] + k2 b[t] y[t],
y'[t] == k1 a0 x[t] - k2 b[t] y[t], b[0] == 1, x[0] == 1, y[0] == 0},
{b, x, y}, {t, 0, 1000}]

thanks all very much in advance for any and all comments. 

sean


  • Prev by Date: RE: simple questions about splinefit
  • Next by Date: Re: color and pointsize in listplot
  • Previous by thread: Re: point intersection in space
  • Next by thread: Re: stepwise ode. why does this fail?