MathGroup Archive 2009

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

Search the Archive

Iterative solution difficulty

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99942] Iterative solution difficulty
  • From: James <jborrell at umd.edu>
  • Date: Tue, 19 May 2009 07:17:00 -0400 (EDT)

I am trying to solve a system of ODEs using NDSolve until a desired ending condition is reached, then the value at the final time x[tf-] is "linearly" related to the new initial conditions, x[tf+] and the ODEs are solved until the ending condition again and so on.  

The following code is the numerical solution to the equation of motion of a simple pendulum.  Physically, the pendulum is released from horizontal and then stopped at the vertical and returned to horizontal and solved again.  I expect the output to look periodic, similar to a capacitor discharging.

ICx1 = Pi/2;
ICxprime1 = 0;

output = NDSolve[{x''[t] == -g/L Sin[x[t]], x[0] == ICx1, x'[0] == ICxprime1} /. {g ->9.8, L -> 1}, x, {t, 0, 10},Method -> {EventLocator, "Event" -> x[t] > 0,EventAction :> Throw[t1 = t; ics1 = x[t];,StopIntegration"]}]

x1 = x[t1] + Pi/2 /. output[[1]]
x1p = x'[t1] + 5 /. output[[1]]


  • Prev by Date: Re: problem in expression
  • Next by Date: Re: Use of names
  • Previous by thread: Re: ColorFunction Range (Mathematica v7)
  • Next by thread: Re: Iterative solution difficulty