solving algebraic equations

10
Solving Algebraic Equations S. Awad, Ph.D. M. Corless, M.S.E.E. D. Cinpinski E.C.E. Department University of Michigan- Dearborn Math Review with Matlab: Single Variable Transcendental Equations

Upload: hea

Post on 10-Jan-2016

45 views

Category:

Documents


1 download

DESCRIPTION

Math Review with Matlab:. Solving Algebraic Equations. Single Variable Transcendental Equations. S. Awad, Ph.D. M. Corless, M.S.E.E. D. Cinpinski E.C.E. Department University of Michigan-Dearborn. Solving Transcendental Equations. Solve Command Polynomial Transcendental Example - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Solving Algebraic Equations

Solving AlgebraicEquations

S. Awad, Ph.D.

M. Corless, M.S.E.E.

D. Cinpinski

E.C.E. Department

University of Michigan-Dearborn

Math Review with Matlab:

Single Variable Transcendental Equations

Page 2: Solving Algebraic Equations

U of M-Dearborn ECE DepartmentMath Review with Matlab

2

Solving Algebraic Equations: Transcendental Equations

Solving TranscendentalEquations

Solve Command

Polynomial Transcendental Example

Poly2sym Command

Exponential Transcendental Example

Complex Solution Example

Page 3: Solving Algebraic Equations

U of M-Dearborn ECE DepartmentMath Review with Matlab

3

Solving Algebraic Equations: Transcendental Equations

Solve Command

The Symbolic Toolbox’s solve command is used to solve both transcendental and algebraic equations

solve(f) solves f in terms of the independent symbolic variable closest to x. f must be a symbolic expression or a entered as a text string enclosed by single quotes

solve(f1,f2,...,fn) is used to solve multiple equations by separating the symbolic equations by commas as follows

Page 4: Solving Algebraic Equations

U of M-Dearborn ECE DepartmentMath Review with Matlab

4

Solving Algebraic Equations: Transcendental Equations

Polynomial Transcendental Equation Example

Use Matlab’s Symbolic Toolbox solve command to solve the transcendental equation:

0232 xx

» syms x» xs_sym=solve(x^2-3*x+2)xs_sym =[ 1][ 2]

2

1

2

1

x

x

» xs_dbl=double(xs)xs_dbl = 1 2

Page 5: Solving Algebraic Equations

U of M-Dearborn ECE DepartmentMath Review with Matlab

5

Solving Algebraic Equations: Transcendental Equations

Poly2Sym Command

The sym2poly command converts a symbolic polynomial expression to a polynomial coefficient vector

The poly2sym(f) command converts a polynomial coefficient vector to symbolic polynomial expression in terms of the default symbolic variable x

The poly2sym(f,'v') command converts a polynomial coefficient vector to symbolic polynomial expression in terms of the symbolic variable v

Page 6: Solving Algebraic Equations

U of M-Dearborn ECE DepartmentMath Review with Matlab

6

Solving Algebraic Equations: Transcendental Equations

» p=[5,2,-1,1,10];

Poly2sym Example

1025 234 xxxxy Example:

» sym_exp=poly2sym(p)

sym_exp =5*x^4+2*x^3-x^2+x+10

Polynomial

Vector

Symbolic

Expression

» poly_vec=sym2poly(sym_exp)

poly_vec = 5 2 -1 1 10

Polynomial

Vector

Page 7: Solving Algebraic Equations

U of M-Dearborn ECE DepartmentMath Review with Matlab

7

Solving Algebraic Equations: Transcendental Equations

Exponential Transcendental Equation Example

05432 xx ee

» xs_sym=solve(exp(2*x)+3*exp(x)-54)xs_sym =[ log(-9)][ log(6)]

Complex Solution

Real Solution

Use the solve command to solve the transcendental equation:

» xs_dbl=double(xs)xs_dbl = 2.1972 + 3.1416i 1.7918

Page 8: Solving Algebraic Equations

U of M-Dearborn ECE DepartmentMath Review with Matlab

8

Solving Algebraic Equations: Transcendental Equations

Verify Loge(-9)

je

jj ee lnlnln

je

ejj

lnln

lnln

In this case - = -9, so: 1416.31972.2)9ln( j

In Matlab, log is the natural log of base e:

Verify ln(-) is a complex number :

)ln(log e

Page 9: Solving Algebraic Equations

U of M-Dearborn ECE DepartmentMath Review with Matlab

9

Solving Algebraic Equations: Transcendental Equations

Complex Solution Example Solve the nonlinear equation:

052 xex» syms x

» rt = solve('x^2+exp(x)+5')

rt =

3.5668799472626199482146544957277+

4.8873680198538466074569067078051*i

Verify the result

» z=subs('x^2+exp(x)+5',rt) z = .2e-30 0102.0 30 z

Page 10: Solving Algebraic Equations

U of M-Dearborn ECE DepartmentMath Review with Matlab

10

Solving Algebraic Equations: Transcendental Equations

Summary

The solve command can be used to solve symbolic transcendental equations with real or complex solutions

poly2sym and sym2poly commands can be used to convert polynomial vectors to/from symbolic expressions