Presentation is loading. Please wait.

Presentation is loading. Please wait.

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:

Similar presentations


Presentation on theme: "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:"— Presentation transcript:

1

2 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: Algebraic Equations with Multiple Variables

3 Solving Algebraic Equations:Multiple Variables 2 Solving Algebraic Equations with Multiple Variables n Solve Command for Equations of Multiple Variables Solve Command for Equations of Multiple Variables n Single Equation of Two Variables Example Single Equation of Two Variables Example n Two Variable Complex Solution Example Two Variable Complex Solution Example n System of Equations Example System of Equations Example n System of Equations with Symbolic Constant Example System of Equations with Symbolic Constant Example

4 Solving Algebraic Equations:Multiple Variables 3 The solve command can be used to solve symbolic expressions with more than one variable: Solve Command for Equations of Multiple Variables solve(f) solves the symbolic expression f using the symbolic variable closest to x as the independent variable solve(f, v) solves the symbolic expression f in terms of the independent variable v

5 Solving Algebraic Equations:Multiple Variables 4 Single Equation of Two Variables Example n Given the equation: 1)Find the solution of the equation assuming that c is the solution variable 2)Find the solution of the equation assuming that b is the solution variable

6 Solving Algebraic Equations:Multiple Variables 5 n Solve for c as the independent variable n c is the default variable since it is closest to x Default Solution » syms b c » f=b^2+4*c+2*b; » sol_c=solve(f) sol_c = -1/4*b^2-1/2*b

7 Solving Algebraic Equations:Multiple Variables 6 Solve for b » sol_b=solve(f,b) n Solve for b as the independent variable n b must be explicitly specified on the command line sol_b = [ -1+(1-4*c)^(1/2)] [ -1-(1-4*c)^(1/2)]

8 Solving Algebraic Equations:Multiple Variables 7 n Given the equation of two variables: Two Variable Complex Solution Example n Solve for x in terms of y using Matlab: » syms x y » xs=solve(x^2+9*y^4) xs = [ 3*i*y^2] [ -3*i*y^2] Roots are Complex Conjugates

9 Solving Algebraic Equations:Multiple Variables 8 System of Equations Example n Solve the system of consistent linear equations: » syms x1 x2 x3 » f1='3*x1-x2+2*x3=12'; » f2='x1+2*x2+3*x3=11'; » f3='2*x1-2*x2+x3=2'; » [x1 x2 x3]=solve(f1,f2,f3) x1 = 7 x2 = 5 x3 = -2

10 Solving Algebraic Equations:Multiple Variables 9 System of Equations with Symbolic Constant Example n Solve the two equations: » syms x y a » s=solve(x+6*y-a,2*x-3*y-9) s = x: [1x1 sym] y: [1x1 sym] s is a structure n x and y are independent variables n a is a constant

11 Solving Algebraic Equations:Multiple Variables 10 n The solution is a structure with named fields x and y representing symbolic expressions Viewing Structures s = x: [1x1 sym] y: [1x1 sym] » xs=s.x xs = 18/5+1/5*a » ys=s.y ys = -3/5+2/15*a n View each symbolic expression separately n Expressions are in terms of symbolic variable a

12 Solving Algebraic Equations:Multiple Variables 11 Summary The solve command can be used to solve: n A single equation in terms of an independent variable n A system of multiple consistent equations n A system of equations having symbolic variables and symbolic constants


Download ppt "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:"

Similar presentations


Ads by Google