MathGroup Archive 2003

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

Search the Archive

NDSolve, delta functions, strategy and speed

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42786] NDSolve, delta functions, strategy and speed
  • From: Goyder Dr HGD <H.Goyder at rmcs.cranfield.ac.uk>
  • Date: Fri, 25 Jul 2003 11:54:54 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Dear MathGroup,

I am applying a sequence of random delta functions to a system. The delta
functions are applied periodically with a period of ts. 
I use NDSolve to work out the response following each delta function,
determine the final conditions, modify them by adding the delta function and
then reuse them as initial conditions for the next period.

Here are the random amplitudes for the delta function

ii = 10000; ts = 0.001;
ran = Table[Random[] - 0.5, {i, ii}];

and this is my solution for a simple test case.

Timing[
  {x0, v0} = {0, ran[[1]]};
  res = {{x0, v0}};
  Do[ {x0, v0} = {x[ts], v[ts]} /. First[NDSolve[
            {x'[t] == v[t], v'[t] == -0.1 
      Pi v[t] - 4Pi^2  (x[t] + 10 x[t]^3), x[0] == x0, v[0] == v0},
            {x, v}, {t, 0, ts}]];
    v0 = v0 + ran[[i]]; res = {res, {x0, v0}}, {i, 2, ii}]]

This works but is slow. Are there better methods?

Thanks 

Hugh Goyder



  • Prev by Date: Re: Delete cases nested list
  • Next by Date: RE: Two Argument ArcTan Function
  • Previous by thread: Re: Re: MatrixExponential
  • Next by thread: Re: NDSolve, delta functions, strategy and speed