chapter 13: solving equations

28
Chapter 13: Solving Equations MATLAB for Scientist and Engineers Using Symbolic Toolbox

Upload: hyacinth-patton

Post on 30-Dec-2015

75 views

Category:

Documents


0 download

DESCRIPTION

Chapter 13: Solving Equations. MATLAB for Scientist and Engineers Using Symbolic Toolbox. You are going to. See that MuPAD solves algebraic equations and differential equations Plot the solution curve of the differential equations - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 13: Solving Equations

Chapter 13:

Solving Equations

MATLAB for Scientist and Engineers

Using Symbolic Toolbox

Page 2: Chapter 13: Solving Equations

2

You are going to See that MuPAD solves algebraic equations

and differential equations Plot the solution curve of the differential

equations Experience some chaotic systems described

by a set of nonlinear differential equations.

Page 3: Chapter 13: Solving Equations

3

Polynomial Equations

solve does it all Solution Target

=0 is the default

Not a simple closed form solution

Numerical values

Page 4: Chapter 13: Solving Equations

4

Set of Linear Equations

Under-determined equations

Verifying the solutions

evalAt operator

Page 5: Chapter 13: Solving Equations

5

Set of Nonlinear Equations

Page 6: Chapter 13: Solving Equations

6

Solving with Assumptions

Give some constraints on solutions

Page 7: Chapter 13: Solving Equations

7

Exercise 1

Compute the general solution of the system of linear equations

How many free parameters does the solution have?

Page 8: Chapter 13: Solving Equations

8

Infinite Number of Solutions

General Solutions

No Symbolic Solution? Try Numerical Solution.

Page 9: Chapter 13: Solving Equations

9

Inequalities

Some Region is the Solution

Checking the Region

Page 10: Chapter 13: Solving Equations

10

Differential Equations

ode and solve 1st Order

2nd Order

Page 11: Chapter 13: Solving Equations

11

ODE with Initial Conditions

Initial Conditions

with different Initial Values

Page 12: Chapter 13: Solving Equations

12

Exercise 2

Solve the following ODE for different values of a=-2, 0,+2 and plot the solutions.

Page 13: Chapter 13: Solving Equations

13

Set of Differential Equations

Page 14: Chapter 13: Solving Equations

14

Numerical ODE Solver

Original ODE Matrix Form

Matrix form ODE function

Numeric solution at t=1 initial value

time duration

Page 15: Chapter 13: Solving Equations

15

Plotting Numerical ODE Solution

plot::Ode2d

with Mapping function

Page 16: Chapter 13: Solving Equations

16

Ode3d with 3D Mapping

plot::Ode3d

Page 17: Chapter 13: Solving Equations

17

Chaotic System

Lorenz attractor

Parameters of Lorenz attractor

Initial Condition

Plot Generator

Page 18: Chapter 13: Solving Equations

18

Ode2d - Plot

Lorenz attractor (cont.)

Initial points are nearly the same.

Page 19: Chapter 13: Solving Equations

19

Ode3d

Lorenz attractor (cont.)

Page 20: Chapter 13: Solving Equations

20

Numerical Solution at a Point

Lorenz attractor (cont.)

1t

10t

100t

Chaotic System

Page 21: Chapter 13: Solving Equations

21

Exercise 3

Compute the general solution y(x) of the differen-tial equation y′ = y2/x .

Determine the solution y(x) for each of the follow-ing initial value problems:

Page 22: Chapter 13: Solving Equations

22

Exercise 4

Draw the 3-D trajectory of the solution of the fol-lowing system of ordinary differential equations in x(t), y(t), z(t) assuming the initial conditions of x(0)=1, y(0)=0.1, z(0)=-1.

Page 23: Chapter 13: Solving Equations

23

Difference Equations

Arithmetic Sequence

Page 24: Chapter 13: Solving Equations

24

Difference Equation - Geometric

Page 25: Chapter 13: Solving Equations

25

Difference Equations

General Solution

With Initial Conditions

Page 26: Chapter 13: Solving Equations

26

Exercise 5

The Fibonacci numbers are defined by the recurrence Fn = Fn−1 + Fn−2 with the initial val-ues F0 = 0, F1 = 1. Use solve to find an ex-plicit representation for Fn.

Page 27: Chapter 13: Solving Equations

27

Key Takeaways

Now, you are able to solve a set of linear and non-linear algebraic

equations, solve a set of ordinary differential equations, solve a set of nonlinear differential equations nu-

merically and plot them in 2D as well as in 3D space

and to solve difference equations.

Page 28: Chapter 13: Solving Equations

28

Notes

solve(x^2+x=y/4,x) solve({x+y+z=3,x+y=2,x-y-z=1},{x,y,z})

solve(sin(x)=1/2)

ode({y'(x)=y(x),y(0)=1}, y(x))

solve( x^2 < 1, x )

plot::Ode2d(..)solve(ode(y''(t)=-3*y'(t)-2*y(t)+2*t^2, y(t)))

numeric::odesolve(f, 0..1,Y0)

plot::Ode3d(..) eqn := rec(y(n+2)=y(n+1)+2*y(n), y(n))

plot::Curve2d(..)