Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

How to solve a differential equation which consists of variables depending upon another differential equation?

share|improve this question
7  
At least give an example problem which shows you really have a problem at hand and you tried something already ... –  PlatoManiac Sep 25 '12 at 16:09
4  
@Julia - Begging doesn't help. There are enough competent people here willing to help you, but something has to come from you. Provide an example of what you want to do and what you already tried. –  stevenvh Sep 25 '12 at 16:24
4  
@Julia, welcome to this site! I'd like to suggest you that when you post a question, be prepared to stay online at least for an hour or so, answering comments, commenting on answers and editing your question. That way you'll receive quicker and better answers –  belisarius Sep 25 '12 at 16:41
add comment

1 Answer

NDSolve doesn't yield a symbolic solution so you can't directly derive variable values from it. If you have an idea of the solution you could try to fit the output of NDSolve to that model.

If your question is "Can I use the numerical solution from a NDSolve in an DSolve?" the answer is "Yes, sort of".

Let's demonstrate this with an example.

A simple harmonic oscillator can be specified with this DE: y''[t] == -y[t]. With some boundary and initial conditions it can be solved both numerically and symbolically:

g[t_] = y[t] /. First@NDSolve[{y''[t] == -y[t], y[0] == 0, y'[0] == 1}, y[t], {t, 0, 30}]

Mathematica graphics

h[t_] = y[t] /. First@DSolve[{y''[t] == -y[t], y[0] == 0, y'[0] == 1}, y[t], t]

Sin[t]

A simple driven harmonic oscillator is given by: y''[t] == -k^2 y[t] + d[t] where d[t] is the driving force function. Let's have the driven harmonic oscillator be driven by another harmonic oscillator. Let's pick k^2=2.

In a pure symbolic situation (symbolically solved driven oscillator + symbolically solved driver h[t]) this would lead to the following:

solDD[t_] = y[t] /. First@DSolve[{y''[t] == -2 y[t] + h[t], y[0] == 0, y'[0] == 1}, y[t], t]

Cos[Sqrt[2] t]^2 Sin[t] + Sin[t] Sin[Sqrt[2] t]^2

In a pure numerical situation (numerically solved driven oscillator + numerically solved driver g[t]) we get:

solNN[t_] = 
  y[t] /. First@NDSolve[{y''[t] == -2 y[t] + g[t], y[0] == 0, y'[0] == 1}, y[t], {t, 1, 30}]

Mathematica graphics

These two are easily plotted and appear identical:

 Plot[{solDD[t], solNN[t]}, {t, 0, 30}]

Mathematica graphics

A mixed situation (symbolically solved driven oscillator + numerically solved driver g[t]), which seems to be the target of your question yields:

solDN[t_] = y[t] /. First@DSolve[{y''[t] == -2 y[t] + g[t], y[0] == 0, y'[0] == 1}, y[t], t]

Mathematica graphics

This result can be readily evaluated or plotted, though the latter will be fairly slow because a numerical integral needs to be calculated for every single point in the plot.

The following plot took an estimated 15 minutes, but is the same as the two above.

Mathematica graphics

share|improve this answer
    
Thanks ..I will keep in mind to frame the question properly –  student_curious Sep 26 '12 at 5:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.