Mathematical Principles for Scientific Computing and Visualization  
http://www.farinhansford.com/books/scv
by Gerald Farin and Dianne Hansford

This notebook demonstrates stability problems with the monomial (1,t, t^2, t^3,....) polynomials.

The Bernstein polynomials, defined below, are a more stable set of basis functions. Below you will find a plot of a degree 14 polynomials -- in monomial form and in Bernstein form.
A polynomial in terms of the Bernstein basis is a Bezier function.

For more on Bezier curves, see Farin and Hansford's Essentials of CAGD.


See Chapter 2: Computational Basics for details.

Updated May 2008

(* Define the Bernstein polynomials recursively *)

Bern[n_,0,t_]:=(1-t)^n
Bern[n_,n_,t_]:=t^n
Bern[n_,i_,t_] := Binomial[n,i] (1-t)^(n-i)  t^i

(* Create a table of degree n Bernstein polynomials for paramter t *)

Bernvec[n_,t_]:=Table[Bern[n,i,t],{i,0,n}]

(* Evaluate the degree n Bezier function at t *)
Bez[b_,n_,t_]:=Bernvec[n,t].b;

b={-1,1,-2,3,-4,5,-6,7,-6,5,-4,3,-2,1,0};

(* Define a degree 14 polynomial and print it expanded in monomial form *)
(* Mathematica combines terms of common t^k *)

poly[t_]=Expand[Bez[b,14,t]]

(* The degree 14 monomial polynomial is defined as such here *)

(poly1[t_]:=-90665 (t^14)+634662 (t^13)-2020655 (t^12)+3873324 (t^11)-4989985 (t^10)+4.5705661`*^6 (t^9)-3072069 (t^8)+1540968 (t^7)-579579 (t^6)+162162 (t^5)-33033 (t^4)+4732 (t^3)-455 (t^2)+28 t-1;) 

(* Plot the two functions *)
(* The monomial form becomes numerically unstable away from 0 *)

Plot[{poly[t],poly1[t]},{t,0,1.1}]