Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


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

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

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

3 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

4 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}]

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

6 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

7 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 instead of 0 so that the ODE will not be undefined

8 Sources Solving ODEs with Mathematica (wiki): /Solving_ODEs_with_Mathematica


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

Similar presentations


Ads by Google