28.4 Derivatives / Integrals / Transforms

Octave comes with functions for computing the derivative and the integral of a polynomial. The functions polyder and polyint both return new polynomials describing the result. As an example we’ll compute the definite integral of p(x) = x^2 + 1 from 0 to 3.

c = [1, 0, 1];
integral = polyint (c);
area = polyval (integral, 3) - polyval (integral, 0)
⇒ 12
: polyder (p)
: [k] = polyder (a, b)
: [q, d] = polyder (b, a)

Return the coefficients of the derivative of the polynomial whose coefficients are given by the vector p.

If a pair of polynomials is given, return the derivative of the product a*b.

If two inputs and two outputs are given, return the derivative of the polynomial quotient b/a. The quotient numerator is in q and the denominator in d.

See also: polyint, polyval, polyreduce.

: polyint (p)
: polyint (p, k)

Return the coefficients of the integral of the polynomial whose coefficients are represented by the vector p.

The variable k is the constant of integration, which by default is set to zero.

See also: polyder, polyval.

: polyaffine (f, mu)

Return the coefficients of the polynomial vector f after an affine transformation.

If f is the vector representing the polynomial f(x), then g = polyaffine (f, mu) is the vector representing:

g(x) = f( (x - mu(1)) / mu(2) )

See also: polyval, polyfit.

© 1996–2020 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/v6.3.0/Derivatives-_002f-Integrals-_002f-Transforms.html