Solving Initial Value Problems with Mathematica's Solver

Hopefully you recall asking Mathematica to give the syntax of its DSolve command in an earlier laboratory exercise. We're going to be using the command again today, so it would be a good idea to be reminded of the details. I'll save you the trouble of asking Mathematica yourself—here's the result we got before:

?DSolve
DSOLVE Syntax

Notice the third form of the command shown: it describes how to solve a list of equations.

Now consider a very simple initial value problem—one that you could practically solve in your head:

dy/dx = 2x,  y(0) = 5.

Clearly, direct integration gives the general solution:

y = x2 + C

and the initial condition soon yields C = 5, so the solution to the initial value problem is:

y = x2 + 5

But, look at the initial value problem again! Isn't it really just a list of two equations? (A very short list, admittedly.) So the initial value problem, in a sense, fits the second form of the DSolve command that we read above. In other words, to solve an initial value problem we simply use DSolve with a list of equations, the first of which is the differential equation itself, and the remaining equations in the list being the initial conditions.

Go ahead and solve the initial value problem above, using Mathematica, with the command:

DSolve[{y'[x]==2x,y[0]==5},y[x],x]


Mathematica LogoYou can switch to Mathematica by clicking on the button at left. This will open up a fresh notebook for you. Remember that it will take it a while to start up! Don't forget to come back here when you're done! See you in a few minutes.

Welcome back! Let's move on to discuss your result..

 

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.