Solving Differential Equations with Mathematica's Solver

(continued fromÌýlast page...)

2xÌýex2ÌýdxÌý=Ìýsin2yÌýcosyÌýdy

Your latest, hopefully successful, foray intoÌýMathematicaÌýshould have gone a little like this:

DSolve[2x E^(x^2) == Sin[y[x]]^2 Cos[y[x]] y'[x], y[x],x]

DSOLVE Warning

DSolve Output

Now for a few notes about this result:

  • The first and third solutions are actuallyÌýcomplex solutionsÌýin disguise. (Notice the presence of negative numbers raised to a rational exponents!) In its usual efforts at completenessÌýMathematicaÌýhas provided every possible answer. Where did they come from? Remember earlier when we talked about getting an explicit solution from the implicit solution we had found? One of the steps was taking the cube root of both sides! Now, contrary to what you may have learned in the past, there are always three cube roots of a number--one real, and two complex. (In general, there are alwaysÌýnÌýnth roots of any number.) We would normally ignore the two complex solutions in common applications.
    Ìý
  • The solution was put inÌýexplicit form. (It would match the one we found earlier by integrating, if we had bothered to isolateÌýy.)
    Ìý
  • In this type of problemÌýMathematicaÌýdoes supply the constant, though it calls itÌýC[1]Ìýrather than justÌýC. This is because the differential equation solver routines inÌýMathematicaÌýare generalized for any order of equation, and in a higher order equations, more constants would be needed, and these would be namedÌýC[2]Ìýand so on. i.e. it forms an array of constants.

We can verify the complex nature of the previous output by applyingÌýMathematica'sÌýN[...]Ìýfunction to it. The functionÌýN[...]Ìýtakes the decimal value of whatever is inside the brackets. We'd like to apply this function to the last output we got fromÌýMathematicaÌýwithout having to retype the whole set of answers we just got. FortunatelyÌýMathematicaÌýhas a short-hand for its last output, namelyÌý%. That's right! The percent symbol means the value of the last output, so to get the decimal value of the last output we'd just type:ÌýN[%].

Go ahead and try this little command now, then come back here...

Did you see presence ofÌýImaginary i Ìýin the first and third solutions? TheÌýImaginary i ÌýinÌýMathematicaÌýis equivalent to the lower-caseÌýiÌýin most written mathematics, i.e. it stands for the square-root of negative 1—complex numbers, as we said before.

Let's go on andÌýsolve some moreÌýdifferential equations...

Compass If you're lost, impatient, want an overview of this laboratory assignment, or maybe even all three, you can click on the compass button on the left to go to the table of contents for this laboratory assignment.