approx_bernstein


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)
      

Licensing:

The information on this web page is distributed under the MIT license.

Languages:

approx_bernstein is available in a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

bernstein_polynomial, a Python code which evaluates the Bernstein polynomials, useful for uniform approximation of functions;

Source Code:


Last revised on 29 February 2024.