Practical 7

Algebraic Operations

A table of the most common Symbolic Toolbox Algebraic Operations

pretty Formats output to look like type-set mathematics
simplify Performs algebraic and other function simplifications
simple Tries a number of simplification techniques including trigonometric identities. Running this command twice can further simplify complex expression.
collect Collects like terms
factor Attempts to factor the expression
expand Expands all terms
poly2sym Converts an array of polynomial coefficients into a symbolic expression with as the variable
sym2poly Converts symbolic polynomial into its coefficient array

 

 

> Exercise: Using Algebraic Operations

> Let

> Define in a script M-file called symPoly.m using the following commands:

syms x

p = x^2*(x+4)^2-8*x*(x+1)^2+13*x-6

> Now use the algebraic operations to help you create the following five cells.

  1. Expand p
  2. Find the factors of p
  3. Store the coefficient array of p in a variable called coeff_p
  4. Use the solve command to find when p = 0
  5. Now try the polynomial roots command together with double to find the roots of in standard MATLAB format.