Class Notes (835,342)
United States (324,093)
Chemistry (859)
CHEM 5 (21)
Lecture

07 DSolve, NDSolve, Chemical Kinetics.pdf
Premium

15 Pages
126 Views
Unlock Document

Department
Chemistry
Course
CHEM 5
Professor
Douglas Tobias
Semester
Fall

Description
LECTURE #8 DIFFERENTIAL EQUATIONS Differential Equation: the determination of a function that satisfies an equation containing derivatives of an unknown function. There are many classes: 1: “Ordinary” differential equations 2 2 Contain only ordinary derivatives dy/dx and d yëdx 2: Partial differential equations 2 2 Contain partial derivaives ▯yê▯x and ▯ y/▯x The “order” of an ordinary differential equation is the order of the highest derivative that appears in the equation. examples: 1: Newton’s second law of motion in one dimension can be written as an ordinary, second order differen- tial equation dp/dt = F[t,x(t),p(t)] where p(t) = mv(t) = mdx/dt is the momentum. 2: The diffusion equation in one-dimension is an example ofa partial differential equation that is second order in teh spatial variable, x, and first-order in time, t: 2 2 ▯cê▯t = D▯ cë▯x where c is the concentration of the diffusing species, and D is its diffusion constant. Differential equations are also classified accoring to whetehr they are “linear” or “nonlinear”. The differ- ential equation 2 2 HnL HnL f(x, y, dy/dx, d yëdx , .......d yëdx M= 0 2 2 HnL HnL is said to be linear if f is a linear function of y, dy/dx, d yëdx , .......dyëdx . A general form for a linear differential equation of order n is: 2 2 HnL HnL g(x) +a0HxLy + a 1xLdyêdx + a H2Ld yëdx + ....+a HxLdn yëdx = 0 For example: The two forms of Newton’s second law given above are linear differential equations. The following are Printed by Wolfram Mathematica Student Edition examples of nonlinear differential equations: dy/dx +xy = 0 2 HnL is said to be linear if f is a linear function of y, dy/dx, d yëdx , .......d Hnyëdx . A general form for a linear differential equation of order n is: 2 Untitled-2 g(x) +a HxLy + a HxLdyêdx + a HxLd yëdx + ....+a HxLd Hnyëdx HnL= 0 0 1 2 n For example: The two forms of Newton’s second law given above are linear differential equations. The following are examples of nonlinear differential equations: 2 dy/dx +xy = 0 2 2 d yëdx + sinHx + yL= sinx 2 2 2 x I1 + y Md yëdx + xdyêdx + y = e Mathematica has several commands for solving a wide variety of differential equations (and systems of differential equations). DSolve Example #1: dy Solve the linear, first order, ordinary differential equation, y'= = 3x y, storing the solution in the dx variable solution 2 In[1]:=olution = DSolveAy'@xD ã 3 * x * [email protected], [email protected], xE 3 Out[1][email protected] Ø ‰ x [email protected]== c [1] = arbitrary constant Example #2: if we specify initial values for both y and y’ , we get a specific solution that does not contain the arbitrary constant say y(0)=1 and y’(0)=0 In[2]:=SolveA9y'@xD ã 3 * x * [email protected], [email protected] ã 1=, [email protected], xE x3 Out[2][email protected] Ø ‰ == Example #3: solve a first order, nonlinear differential equation, yy’=-x In[3]:[email protected]@xD * y'@xD ã -x, [email protected], xD 2 2 Out[3]=:[email protected] Ø - -x + 2 [email protected] >, :[email protected] Ø -x + 2 [email protected] >> Example #4: Solve a second order, linear differential equation: In[4]:=olution = [email protected]''@xD + [email protected] ã 0, [email protected], xD Out[4][email protected] Ø [email protected] [email protected] + [email protected] [email protected]<< we can use the replacement rule to evaluate the solution for particular values of the arbitrary con- stants. Here we generate and plot a family of particular solutions Printed by Wolfram Mathematica Student Edition Untitled-2 3 In[5]:[email protected]; particularSolutions = [email protected]@xD ê. solution ê. [email protected] Ø i, [email protected] Ø j> 2 2 In[10]:=HermiteH [email protected], xD gives the Hermite polynomialnH H à. In[11]:=Hypergeometric1F1 [email protected], b, zD is the Kummer confluent hypergeometric functio1 1 Ha; b;  à. Just like the Solve command, there are many differential equations that cannot be solved exactly using the DSolve command. Example #6: Here is an example of a first-order differential equation that cannot be solved analytically Printed by Wolfram Mathematica Student Edition 4 Untitled-2 In[12]:[email protected]'@xD ã [email protected] * [email protected], [email protected], xD Solve::ifun : Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. à Solve::ifun : Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. à £ Out[12][email protected] @xD ã [email protected] [email protected], [email protected], xD In this case where exact solutions are not available, numerial solutions can be obtained using NDSolve. NDSolve To use NDSolve we need to specify initial conditions (the number of which is at least the order of the equation) and an interval over which to evaluate the solution: Example #1: [email protected]'@xD ã [email protected] * [email protected], [email protected] ã [email protected]<< The output is given in terms of a strange looking object called an interpolating function, which is a recipe for representing the solution numerically. The following shows hwo to translate the interpolating function into a table of values or a plot In[20]:=lution = [email protected]'@xD ã [email protected] * [email protected], [email protected] ã [email protected], [email protected] Ø [email protected], 10.<[email protected]<< we see the interpolating functions again as outputs... lets store them in the functions f(t) and g(t) In[28]:=t_D := [email protected] ê. [email protected]@1DD; [email protected]_D := [email protected] ê. [email protected]@1DD; [email protected]@tD, [email protected]
More Less

Related notes for CHEM 5

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit