How to resolve the algorithm Bernstein basis polynomials step by step in the Phix programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Bernstein basis polynomials step by step in the Phix programming language

Table of Contents

Problem Statement

The

n + 1

{\displaystyle n+1}

Bernstein basis polynomials of degree

n

{\displaystyle n}

are defined as Any real polynomial can written as a linear combination of such Bernstein basis polynomials. Let us call the coefficients in such linear combinations Bernstein coefficients. The goal of this task is to write subprograms for working with degree-2 and degree-3 Bernstein coefficients. A programmer is likely to have to deal with such representations. For example, OpenType fonts store glyph outline data as as either degree-2 or degree-3 Bernstein coefficients. The task is as follows: ALGOL 60 and Python implementations are provided as initial examples. The latter does the optional monomial-basis evaluations. You can use the following algorithms. They are written in unambiguous Algol 60 reference language instead of a made up pseudo-language. The ALGOL 60 example was necessary to check my work, but these reference versions are in the actual standard language designed for the printing of algorithms.

Let's start with the solution: