## Mathematics & Science
Learning Center |
|||

## Solving Systems## Solving the Preliminary Example
The command should have returned the following result:
prelimsol=
NDSolve[{x'[t]== y[t]- x[t]- E^(3t),
y'[t]==3 y[t]+2 x[t]-2 E^(-t),
x[0]==1,y[0]==1},
{x[t],y[t]},{t,-2,2}]
We've seen this form of
solution before, and you may even have been expecting it. One difference, of
course, from your previous labs is that the solution actually consists of In the past we have repeatedly used something that I've referred to as the
"[[1,1,2]] trick." Now that the solution has two parts, we
need to be a little more careful. Remember, [[1,1,2]] refers
to the result's first row, first column, second part. Looking carefully at our
answer, you should be able to see that this refers to the x[t]
value. So how would we grab the y[t] value? Well, y[t]
is in the first row, So let's get down to the job of grabbing the parts of the solution that we wish to use. We're going to pull the expressions for x[t] and y[t] into two separate variables, say prelimx and prelimy respectively. We can do so with the following pair of commands:
prelimx=prelimsol[[1,1,2]] Go to Now let's look at what you should have gotten... |
|||

ODE Laboratories: A Sabbatical Project by Christopher A. Barker©2017 San Joaquin Delta College, 5151 Pacific Ave., Stockton, CA 95207, USA e-mail: cbarker@deltacollege.edu |