Problem involving NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg86822] Problem involving NDSolve
- From: Grandpa <acloninger at wustl.edu>
- Date: Sat, 22 Mar 2008 00:53:24 -0500 (EST)
- Organization: The Math Forum
So here's my dilemma. I am trying to solve a differential equation with complex roots. Mathematica is taking the incorrect root at certain points when the function crosses over itself. I generated a set of all points at which this occurs. The set is ProblemList={2.8, 5.599, 8.398} I now want to use these points in a function. My function is ComplexRoot[t_]:= If[Abs[t - ProblemList[[1]]] > .01 && Abs[t - ProblemList[[2]]] > .01 && Abs[t - ProblemList[[ 3]]] > .01, Evaluate[I*(2 + 1/2)(I*x[t])^(1 + 1/2)], Evaluate[p'[t - .01]]] The goal here is to have Mathematica take the correct root for all t other than the problem t values, and at those t values simply continue in the direction it was heading previously. So I want to then plug into the differential equation solution=NDSolve[{x'[t] == 2p[t], x[0] == 0, p'[t]==ComplexRoot[t], p[0] == 1}, {x, p}, {t,0,10}, WorkingPrecision -> 30, MaxSteps -> Infinity][[1]]; and not get an error. Right now it gives me an error saying that I haven't "literally matched the independent variables." If it works, the following graph should have two loops and look like an infinity sign with one of the loops being smaller than the other. ParametricPlot[{Re[p[t]] /. solution, Im[p[t]] /. solution}, Evaluate[{t,0,10}],PlotRange -> {{-2, 2}, {-2, 2}}] What can I do to fix this issue? Any and all help is greatly appreciated. Thanks, Alex