# Solving ODEs with Mathematica Anchors: Scandiumδ Jocelyn Anleitner Diane Feldkamp.

## Presentation on theme: "Solving ODEs with Mathematica Anchors: Scandiumδ Jocelyn Anleitner Diane Feldkamp."— Presentation transcript:

Solving ODEs with Mathematica Anchors: Scandiumδ Jocelyn Anleitner Diane Feldkamp

Mathematica Basics  Purpose: Mathematica solves difficult mathematical formulas  Focus: solving ordinary differential equations (ODEs) of 1 st and higher order using Mathematica

Mathematica Syntax  Details about important syntax for Mathematica can be reviewed on the wiki page titled “Solving ODEs with Mathematica”  For entering ODEs, use double equal signs (==) to define the functions  When finished with a line, use “Shift”+ “Enter” for Mathematica to compute the answer

Dsolve and NDSolve  For ODEs without initial conditions, use Dsolve  For ODEs with initial conditions, use NDSolve Type of EquationSyntaxExample Equation(s)Dsolve for Example One ODEDsolve[eqn,y,x]y''+16y=0Dsolve[y''[x]+16y[x]==0,y,x] Multiple ODEsDsolve[{eqn1,eqn2,…},{y1,y2,…},x] y1'-y2-x=0 y2'-y1-1=0 Dsolve[{y1'[x]-y2[x]-x==0,y2'[x]-y1[x]- 1==0},{y1,y2},x] Type of EquationSyntaxExample Equation(s)Dsolve for Example One ODE NDSolve[{eqn,i1,i2…},y,{x,xmin,xma x}] y''+16y=0,y(0)=1, y'(0)=0 NDSolve[{y''[x]+16y==0,y[0]==1,y'[0]==0},y,{x, 0,30}] Multiple ODEs NDSolve[{eqn1, eqn2,..., i1, i2, …},{y1,y2},{x,xmin,xmax}] y1'-y2-x=0 y2'-y1-1=0 y1(0)=0,y2(0)=0 NDSolve[{y1'[x]-y2[x]-x==0,y2'[x]-y1[x]- 1==0,y1[0]==y2[0]==0},{y1,y2},{x,20}]

Example: Semi-batch Reactor (Worked Out Example 2) Reaction: A  B First-order ODE with Initial Conditions Use NDSolve in Mathematica Given Variables:

Entering in Mathematica  Open Mathematica (Version shown here is Mathematica 6)  Use the following steps to solve the ODE in Mathematica: 1.Input ODE 2.Define given variables

Entering in Mathematica (cont.) 3.Define a variable to NDSolve and enter inputs 4.Plot the solution X is conversion, and X[0] is entered as 0.0001 instead of 0 so that the ODE will not be undefined

Sources Solving ODEs with Mathematica (wiki): http://controls.engin.umich.edu/wiki/index.php /Solving_ODEs_with_Mathematica

Download ppt "Solving ODEs with Mathematica Anchors: Scandiumδ Jocelyn Anleitner Diane Feldkamp."

Similar presentations