Docsity

Representación y manipulación de polinomios en SCILAB, Apuntes de Métodos Numéricos

Toggle sidebar
bg1
POLYNOMIALS
Representation of Polynomial
n is degree of polynomials
Example:
Degree of 2
Degree of 0
Representation of Polynomial s in SCILAB
Two way of declaring polynomials in SCILAB
i. Using %s
Example :
ii. Using function poly
Example :
Usage of function poly
There are 3 methods to use function poly to create polynomials:
i. Declaring variable as a symbolic variable
Example 1:
s=poly (0,’s’)
s1=s^2+4*s+5
Example 2:
x=poly (0,’x’)
x1=x^4- 21*x^3 + 43*x^2 + 10*x +4
ii. By using polynomial coefficients
•Polynomials can be represented by row vector in which elements are the coefficients
•Must include all coefficient , even if 0
pf3
pf4
pf5

Vista previa parcial del texto

¡Descarga Representación y manipulación de polinomios en SCILAB y más Apuntes en PDF de Métodos Numéricos solo en Docsity!

POLYNOMIALS

Representation of Polynomial

n is degree of polynomials Example: Degree of 2 Degree of 0 Representation of Polynomial s in SCILAB Two way of declaring polynomials in SCILAB i. Using %s Example : ii. (^) Using function poly Example :

Usage of function poly There are 3 methods to use function poly to create polynomials: i. Declaring variable as a symbolic variable Example 1: s=poly (0,’s’) s1=s^2+4*s+ Example 2: x=poly (0,’x’) x1=x^4- 21x^3 + 43x^2 + 10*x +

ii. By using polynomial coefficients

  • Polynomials can be represented by row vector in which elements are the coefficients
  • Must include all coefficient , even if 0

Example: a) p = 10 + 4x p=poly ([10 4], ‘x’,’c’) b) q=2x^3 -5x + 7 q=poly ([7 -5 0 2],’x’,’c’)

iii. By using roots of polynomials SCILAB can be calculate the polynomial coefficients from the roots of polynomial (which are the values of argument for which the polynomial is equal to zero) Example: roots = -3, + x= -3 or x= 0 = x +3 0 = x - 2 0 = (x + 3)(x +2) f(x) = x^2 + x - 6 r = poly([ -3 2],’x’) Answer: r = -6 + x + x^2

SCILAB can be computing the roots of a function. r = roots(p)

Arithmetic Operation of Polynomials i. Added or subtracted Example: f1 (x) + f2(x) f1(x) = 3x^2 + 15x – 40 f2(x) = 5x + 20 SCILAB code: x=poly (0,’x’) f1= 3x^2 + 15x – 40 f2 = 5*x + f1 + f

ii. Multiplied Example: f = (2x^2 +x – 3)*(x + 1) SCILAB code: x = poly (0,’x’) f = (2x^2+x-3)(x+1)

iii. Divided Example: f = (x^2 -9x-10) / (x+1) SCILAB code: x = poly (0,’x’) f = (x^2 -9*x -10)/(x+1)

Useful function for Polynomials i. Function coeff

  • To get the coefficients of matrix polynomials Example: B = x^2 + 4*x + C = coeff (B)

ii. (^) Function derivat

  • To get the rational matrix derivative Example: D = 2x^3 + 4x^2 – 5 E = derivat(D)