approx_bernstein, a MATLAB code which approximates a function f(x) in the interval [a,b] by constructing a Bernstein polynomial using n basis functions.
The user enters a formula for f(x), and the values of a and b, and the number of Bernstein interpolation points n.
The program computes the corresponding n-1 degree interpolating polynomial, estimates the maximum approximation error over [a,b], and returns the approximant value at 101 points in [a,b].
The function is specified as a string which is either:
Examples of function specifications:
lambda x: np.abs(x-0.5) (a lambda function) wiggle(x) (a user-written Python function)
The information on this web page is distributed under the MIT license.
approx_bernstein is available in a MATLAB version and an Octave version and a Python version.
bernstein_polynomial, a Python code which evaluates the Bernstein polynomials, useful for uniform approximation of functions;