Group Abstract Group Abstract

Message Boards Message Boards

Solve an ODE by NDSolve an Interpolating function

I want to solve an ODE when it appears an Interpolating Function. First I obtain the function y[s] (or Y[s])

aa = .4; sol =  NDSolve[{-4 + 4/y[s]^2 - y[s]^2 + y[s]^4 + y'[s]^2 ==  0, y[0] == 1.207}, y[s], {s, 0, aa}];
ParametricPlot [Evaluate[{s, y[s]} /. sol[[2]]], {s, 0, aa},  PlotRange -> All]
Y[s_] = y[s] /. sol[[2]];

(with the function Y[s] I can plot the solution y[s])

Now, I want to solve the ODE w'[s]= Sqrt[y[s]^2 + 2] with initial condition w[0] = 0. My first attempt is

w1 = NDSolve[{w'[s] == Sqrt[Y[s]^2 + 2], w[0] == 0}, w[s], {s, 0, aa}]

Next, I put W[s_] = w[s] /. w1[[1]] and I plot the function W[s] by means of Plot[W[s], {s, 0, aa}]

Is it right? (thanks)enter code here

POSTED BY: Rafael López
8 Replies
Anonymous User
Anonymous User
Posted 7 years ago

i posted previously comments on y'[x]^2==y[x]^2 which i removed because of a sign error (when i woke up and rechecked it) made it unlike the other problem, it was not an envelope of the original problem to compare with.

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 7 years ago

i'm removing my comment since the simpler eq. i chose as an "envelope" may be wrong (i must have misread DSolve output - the orig eq it doesn't forwardly involve imaginary numbers)

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 7 years ago

I see carl wolf's graph doesn't change your answer (it shows both your graphs combined but doesn't answer if there is another solution line or points in another region to your 2nd diff eq). You said specifically you wished the solution of the second equation to operate using the interpolation function of the first, which the example removes. but it's a good idea to keep things together.

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 7 years ago

(Restating that: my guess is NDSolve will leave out some solutions (perhaps a whole line or more - as the person above suggests, which I didn't verify). you should check that guess with other forum users who know more about which approximations show what existence theorems. I'm sure some methods do miss "some particular solutions" - but unsure which mm uses).

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 7 years ago
POSTED BY: Anonymous User
Attachments:
POSTED BY: Rafael López

I would just include the ODE for w in your first ODE:

aa = .4; sol = 
 NDSolve[{-4 + 4/y[s]^2 - y[s]^2 + y[s]^4 + y'[s]^2 == 0, y[0] == 1.207, 
   w'[s] == Sqrt[y[s]^2 + 2], w[0] == 0}, {y[s], w[s]}, {s, 0, aa}];

Plot[Evaluate[{y[s], w[s]} /. sol[[1]]], {s, 0, aa}]

enter image description here

POSTED BY: Carl Woll
Anonymous User
Anonymous User
Posted 7 years ago

That's hardly a question. Right in what way? Right as Mathematica syntax usage?

POSTED BY: Anonymous User
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard