Next: bitwise-pkg, Previous: augmented_lagrangian-pkg, Up: Top [Contents][Index]
• Functions and Variables for Bernstein: |
Previous: Bernstein-pkg, Up: Bernstein-pkg [Contents][Index]
Provided k
is not a negative integer, the Bernstein polynomials
are defined by bernstein_poly(k,n,x) = binomial(n,k) x^k
(1-x)^(n-k)
; for a negative integer k
, the Bernstein polynomial
bernstein_poly(k,n,x)
vanishes. When either k
or n
are
non integers, the option variable bernstein_explicit
controls the expansion of the Bernstein polynomials into its explicit form;
example:
(%i1) load("bernstein")$ (%i2) bernstein_poly(k,n,x); (%o2) bernstein_poly(k, n, x) (%i3) bernstein_poly(k,n,x), bernstein_explicit : true; n - k k (%o3) binomial(n, k) (1 - x) x
The Bernstein polynomials have both a gradef property and an integrate property:
(%i4) diff(bernstein_poly(k,n,x),x); (%o4) (bernstein_poly(k - 1, n - 1, x) - bernstein_poly(k, n - 1, x)) n (%i5) integrate(bernstein_poly(k,n,x),x); (%o5) k + 1 hypergeometric([k + 1, k - n], [k + 2], x) binomial(n, k) x ---------------------------------------------------------------- k + 1
For numeric inputs, both real and complex, the Bernstein polynomials evaluate to a numeric result:
(%i6) bernstein_poly(5,9, 1/2 + %i); 39375 %i 39375 (%o6) -------- + ----- 128 256 (%i7) bernstein_poly(5,9, 0.5b0 + %i); (%o7) 3.076171875b2 %i + 1.5380859375b2
To use bernstein_poly
, first load("bernstein")
.
Default value: false
When either k
or n
are non integers, the option variable
bernstein_explicit
controls the expansion of bernstein(k,n,x)
into its explicit form; example:
(%i1) bernstein_poly(k,n,x); (%o1) bernstein_poly(k, n, x) (%i2) bernstein_poly(k,n,x), bernstein_explicit : true; n - k k (%o2) binomial(n, k) (1 - x) x
When both k
and n
are explicitly integers, bernstein(k,n,x)
always expands to its explicit form.
The multibernstein polynomial multibernstein_poly ([k1, k2, ...,
kp], [n1, n2, ..., np], [x1, x2, ..., xp])
is the product of
bernstein polynomials bernstein_poly(k1, n1, x1)
bernstein_poly(k2, n2, x2) ... bernstein_poly(kp, np, xp)
.
To use multibernstein_poly
, first load("bernstein")
.
Return the n
-th order uniform Bernstein polynomial approximation for the
function (x1, x2, ..., xn) |--> f
.
Examples
(%i1) bernstein_approx(f(x),[x], 2); 2 1 2 (%o1) f(1) x + 2 f(-) (1 - x) x + f(0) (1 - x) 2 (%i2) bernstein_approx(f(x,y),[x,y], 2); 2 2 1 2 (%o2) f(1, 1) x y + 2 f(-, 1) (1 - x) x y 2 2 2 1 2 + f(0, 1) (1 - x) y + 2 f(1, -) x (1 - y) y 2 1 1 1 2 + 4 f(-, -) (1 - x) x (1 - y) y + 2 f(0, -) (1 - x) (1 - y) y 2 2 2 2 2 1 2 + f(1, 0) x (1 - y) + 2 f(-, 0) (1 - x) x (1 - y) 2 2 2 + f(0, 0) (1 - x) (1 - y)
To use bernstein_approx
, first load("bernstein")
.
Express the polynomial e
exactly as a linear combination of multi-variable
Bernstein polynomials.
(%i1) bernstein_expand(x*y+1,[x,y]); (%o1) 2 x y + (1 - x) y + x (1 - y) + (1 - x) (1 - y) (%i2) expand(%); (%o2) x y + 1
Maxima signals an error when the first argument isn’t a polynomial.
To use bernstein_expand
, first load("bernstein")
.
Previous: Bernstein-pkg, Up: Bernstein-pkg [Contents][Index]