Message Boards Message Boards

Solve two differential equations with NDSolve and DSolve?

Posted 4 years ago

I have a problem, I was working in the solution of two different differential equations, and in a given moment I start suspecting that the given answer was wrong, I think that is my fault, but I don't see where is my mistake.

First let's define some values:

c = -0.884;
H0 = 68;
G = 6.67*10^{-11};
Om = 0.3;
Rhom0 = (3 H0^2/(8 Pi G))*Om;

The first differential equation is this one:

co22 = NDSolve[{(1 + x)^3D[p[x]/(1 + x)^3, x] + 
     6*c(H0* ( (1 + c/1.5) (1 + x)^{3/2} - (c/1.5) ) )^2 == 0, 
   p[0] == Rhom0}, p, \{x, 0, 10\}]

And the second differential equation:

sol25 = DSolve[{(1 + x)^3*(-((3 p4[x])/(1 + x)^4) + 
       p4'[x]/(1 + x)^3) == 0, p4[0] == Rhom0}, p4, \{x, 0, 10\}]

And when I plot the solution of both they give me the same graph, the first time I think that this could be a coincidence, but then I introduce a third differential equation

sol24 = DSolve[{(1 + x)^3*(-((3 p3[x])/(1 + x)^4) + 
       p3'[x]/(1 + x)^3) == -6*c*(H0*(0.3*(1 + x)^3 + 0.7)^(1/2))^2, 
   p3[0] == Rhom0}, p3,\{x, 0, 10\} ]

And once again the same answer, you know where is the problem?

POSTED BY: Mauricio Cruz
2 Replies

Plot the difference of the two solutions:

Plot[Evaluate[p4[x] - p3[x] /. sol24 /. sol25], {x, 0, 1}]
POSTED BY: Gianluca Gorni
Posted 4 years ago

You are right. Thank you.

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

Group Abstract Group Abstract