1 @c -----------------------------------------------------------------------------
2 @c File : bernstein.de.texi
3 @c License : GNU General Public License (GPL)
4 @c Original : bernstein.texi revision 19.07.2011
6 @c Revision : 23.07.2011
8 @c This file is part of Maxima -- GPL CAS based on DOE-MACSYMA
9 @c -----------------------------------------------------------------------------
12 * Functions and Variables for Bernstein::
15 @c -----------------------------------------------------------------------------
16 @node Functions and Variables for Bernstein, , bernstein, bernstein
17 @section Functions and Variables for Bernstein
18 @c -----------------------------------------------------------------------------
20 @c -----------------------------------------------------------------------------
21 @deffn {Function} bernstein_poly (@var{k}, @var{n}, @var{x})
23 Provided @code{k} is not a negative integer, the Bernstein polynomials
24 are defined by @code{bernstein_poly(k,n,x) = binomial(n,k) x^k
25 (1-x)^(n-k)}; for a negative integer @code{k}, the Bernstein polynomial
26 @code{bernstein_poly(k,n,x)} vanishes. When either @code{k} or @code{n} are
27 non integers, the option variable @code{bernstein_explicit} controls the
28 expansion of the Bernstein polynomials into its explicit form; example:
31 (%i1) load("bernstein")$
33 (%i2) bernstein_poly(k,n,x);
34 (%o2) bernstein_poly(k, n, x)
35 (%i3) bernstein_poly(k,n,x), bernstein_explicit : true;
37 (%o3) binomial(n, k) (1 - x) x
40 The Bernstein polynomials have both a gradef property and an integrate property:
43 (%i4) diff(bernstein_poly(k,n,x),x);
44 (%o4) (bernstein_poly(k - 1, n - 1, x)
45 - bernstein_poly(k, n - 1, x)) n
46 (%i5) integrate(bernstein_poly(k,n,x),x);
49 hypergeometric([k + 1, k - n], [k + 2], x) binomial(n, k) x
50 ----------------------------------------------------------------
54 For numeric inputs, both real and complex, the Bernstein polynomials evaluate
58 (%i6) bernstein_poly(5,9, 1/2 + %i);
60 (%o6) -------- + -----
62 (%i7) bernstein_poly(5,9, 0.5b0 + %i);
63 (%o7) 3.076171875b2 %i + 1.5380859375b2
66 To use @code{bernstein_poly}, first @code{load("bernstein")}.
69 @c -----------------------------------------------------------------------------
70 @defvr {Variable} bernstein_explicit
71 Default value: @code{false}
73 When either @code{k} or @code{n} are non integers, the option variable
74 @code{bernstein_explicit} controls the expansion of @code{bernstein(k,n,x)}
75 into its explicit form; example:
78 (%i1) bernstein_poly(k,n,x);
79 (%o1) bernstein_poly(k, n, x)
80 (%i2) bernstein_poly(k,n,x), bernstein_explicit : true;
82 (%o2) binomial(n, k) (1 - x) x
85 When both @code{k} and @code{n} are explicitly integers, @code{bernstein(k,n,x)}
86 @emph{always} expands to its explicit form.
89 @c -----------------------------------------------------------------------------
90 @deffn {Function} multibernstein_poly (@var{[k1, k2, @dots{}, kp]}, @var{[n1, n2, @dots{}, np]}, @var{[x1, x2, @dots{}, xp]})
92 The multibernstein polynomial
93 @code{multibernstein_poly (@var{[k1, ..., kp]}, @var{[n1, ..., np]},
94 @var{[x1, ..., xp]})} is the product of bernstein polynomials
95 @code{bernstein_poly(k1, n1, x1) * ... * bernstein_poly(kp, np, xp)}.
97 To use @code{multibernstein_poly}, first @code{load("bernstein")}.
100 @c -----------------------------------------------------------------------------
101 @deffn {Function} bernstein_approx (@var{f}, @var{[x1, x1, @dots{}, xn]}, @var{n})
103 Return the @code{n}-th order uniform Bernstein polynomial approximation for the
104 function @code{(x1, x2, ..., xn) |--> f}.
109 (%i1) bernstein_approx(f(x),[x], 2);
111 (%o1) f(1) x + 2 f(-) (1 - x) x + f(0) (1 - x)
113 (%i2) bernstein_approx(f(x,y),[x,y], 2);
115 (%o2) f(1, 1) x y + 2 f(-, 1) (1 - x) x y
118 + f(0, 1) (1 - x) y + 2 f(1, -) x (1 - y) y
121 + 4 f(-, -) (1 - x) x (1 - y) y + 2 f(0, -) (1 - x) (1 - y) y
124 + f(1, 0) x (1 - y) + 2 f(-, 0) (1 - x) x (1 - y)
127 + f(0, 0) (1 - x) (1 - y)
130 To use @code{bernstein_approx}, first @code{load("bernstein")}.
133 @c -----------------------------------------------------------------------------
134 @deffn {Function} bernstein_expand (@var{e}, @var{[x1, x1, @dots{}, xn]})
136 Express the @emph{polynomial} @code{e} exactly as a linear combination of
137 multi-variable Bernstein polynomials.
140 (%i1) bernstein_expand(x*y+1,[x,y]);
141 (%o1) 2 x y + (1 - x) y + x (1 - y) + (1 - x) (1 - y)
146 Maxima signals an error when the first argument isn't a polynomial.
148 To use @code{bernstein_expand}, first @code{load("bernstein")}.
151 @c --- End of file bernstein.de.texi -------------------------------------------