0% found this document useful (0 votes)
114 views

DSolve Function of Mathematica

The document discusses using the dsolve and DEplot commands in Maple to solve and graph various differential equations, including the exponential growth model, Newton's law of cooling, and the logistic growth equation. It provides examples of using dsolve to find the general and particular solutions of differential equations, and using DEplot to graph the solutions with different initial conditions and parameter values.

Uploaded by

mmrmathsiubd
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views

DSolve Function of Mathematica

The document discusses using the dsolve and DEplot commands in Maple to solve and graph various differential equations, including the exponential growth model, Newton's law of cooling, and the logistic growth equation. It provides examples of using dsolve to find the general and particular solutions of differential equations, and using DEplot to graph the solutions with different initial conditions and parameter values.

Uploaded by

mmrmathsiubd
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Differential Equations in Maple.

Using the dsolve and DEplot commands.


The exponential growth model is .
> de := diff(y(t),t) = k*y(t);

To solve a differential equation in Maple use the dsolve command


> dsolve( de, y(t) );

That is the general solution. Maple uses _C1 instead of c for the constant of integration.
Here is how you specify an initial value e.g. to obtain a particular solution.
> dsolve( {de,y(0)=5}, y(t) );

Note, the solve command does not work


> solve( de, y(t) );
Error, (in solve) cannot solve expressions with diff(y(t), t) for y(t)

The differential equation for Newton's law of cooling is where


is the temperature of the body at time t,
is the Ambient temperature (assumed to be constant) and
is the cooling rate constant.
> NLC := diff(T(t),t) = k*(Am-T(t));

> dsolve( NLC, T(t) );

> dsolve( { NLC, T(0)=60 }, T(t) );

To graph the solution we need to fix values for the parameters


> Am := 20;
k := 0.1;

> NLC;

> sol := dsolve( {NLC,T(0)=60}, T(t) );

Notice that dsolve returns the solution as an equation. To graph the solution we need to
extract the right-hand-side of the equation.
> plot( rhs(sol), t=0..30, y=0..70 );

Let's generate a plot for several different initial values.


> initTemps := [0,10,20,30,40,50,60];

> for i to nops(initTemps) do


initval := initTemps[i];
sol[i] := dsolve({NLC,T(0)=initval}, T(t)) ;
od;
> sols := [seq( rhs(sol[i]), i=1..nops(initTemps) )];

> plot( sols, t=0..30 );

This plot together with the field plot can be generated using the DEplot command in the
DEtools package.
> with(DEtools);
> initTemps := [T(0)=10, T(0)=20, T(0)=40, T(0)=60];

> DEplot( NLC, T(t), t=0..30, initTemps );

There are many options. Three are illustrated here


> DEplot( NLC, T(t), t=0..30, T=0..70, initTemps, linecolor=blue,
arrows=medium );

You can also get an animation by specifying animatecurves = true


> DEplot( NLC, T(t), t=0..30, T=0..70, initTemps, linecolor=blue,
arrows=medium, animatecurves=true );
Here is the Logistic growth equation
is the carrying capacity of the population
is the constant such that is the natural growth rate.
> LG := diff(y(t),t) = a*y(t)*(Ym-y(t));

> a := 0.01;
Ym := 20;

> dsolve( LG, y(t) );

> sol := dsolve( {LG,y(0)=1}, y(t) );

> plot( [Ym,rhs(sol)], t=0..50, y=0..22, color=[purple,blue], thickness=


[3,2] );

> initPops := [ y(0)=0.1, y(0)=1, y(0)=10, y(0)=15, y(0)=25 ];

> c o l s : = [blue,green,black,cyan,navy];

> DEplot( LG, y(t), t=0..50, initPops, linecolor=cols, arrows=large );

You might also like