MathGroup Archive 2013

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

Search the Archive

how can I solve my system of differential equations?

hi guys,

I have a question pertaining to my code below: for a problem that i'm working on, I require to find the values of the roots E2 that will set the function f1[E2] - f2[E2] to zero. I know how to obtain the roots one at a time: for instance finding a a root of E2 lying between, say 0 and 2. But I would like to know whether it is possible to get Mathematica to generate all the roots that lie within a certain interval at once, say all the possible ones lying between say 0 and 10. I have tried using NSolve and Reduce, but I got nothing out of them , so any help in refining the code to do this  will be most appreciated!

raj n

xmin = -6.500;
xmax = 6.500;
xmatch = 1.50;
eq1[x_, x0_, E2_] := (y''[x]) + (E2 - x^2) y[x] == 0, 
   y[x0] == 0, Derivative[1][y][x0] == 1/10^6};

y1[x_, E2_] := 
 y[x] /. NDSolve[eq1[x, xmin, E2], y, {x, xmin, xmatch}][[1]]; 
f1[E2_] := Abs[\!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\ \(y1[x, E2]\)\)/   y1[x, E2] /. 
   x -> xmatch];
y2[x_, E2_] := 
 y[x] /. NDSolve[eq1[x, xmax, E2], y, {x, xmax, xmatch}][[1]]; 
f2[E2_] := Abs[\!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\(y2[x, E2]\)\)/y2[x, E2] /. 
   x -> xmatch]
f[E2_?NumericQ] := f1[E2] - f2[E2];
NSolve[f[E2_?NumericQ] == 0 && 0 < E2 < 10, E2]
rts = Reduce[f == 0 && 2.5 < E2 < 10.0, E2]
c2 = N[E2 /. {ToRules[rts]}]
Print["The value of E2   was=", c2]

  • Prev by Date: Re: delayed (numerical) matrix inversion in NDSolve?
  • Next by Date: Re: hangup with Export
  • Previous by thread: Re: delayed (numerical) matrix inversion in NDSolve?
  • Next by thread: Re: hangup with Export