As a part of my learning curve, I am trying to play with extending Maple's BernsteinBasis, which has only a limited support right now (BernsteinBasis - Maple Help (maplesoft.com)).
My goal is to implement basis operation on polynomials in Bernstein basis, so that derivatives, integrals and products of polynomials in BernsteinBasis would be again expressed in BernsteinBasis.
While it looks like it is relatively easy to extend diff procedure, by using `diff/BernsteinBasis`, I didn't find anything similar for the int. Is there something like `int/BernsteinBasis`?
The problem is that when I am trying to implement my own int procedure in a module that would extend standard int, it seems I need to manually implement logic for (at very least) linearity, so that int(p(x) + q(x), x) would decay into int(p(x), x) + int(q(x), x ) (I probably don't need more complex rewriting rules). So before trying this approach, is there any easy way such as with diff?
BernsteinPolynomials := module()
description "Basic operations in Bernstein basis";
global BernsteinBasis, `diff/BernsteinBasis`;
BernsteinBasis := proc(k, n, a, b, x)
description "Bernstein basis polynomial";
if k::numeric then
if k < 0 then
if n::numeric then
if n < 0 then
if k::numeric then
if k > n then
`diff/BernsteinBasis` := proc()
description "Derivative of the Bernstein basis polynomial in the Bernstein basis";
if _npassed = 6 then
if _passed[-1] = _passed[-2] then
_passed * BernsteinBasis(_passed - 1, _passed - 1, _passed, _passed, _passed) / (_passed - _passed) -
_passed * BernsteinBasis(_passed, _passed - 1, _passed, _passed, _passed) / (_passed - _passed);
int := proc()
description "Integral of the Bernstein basis polynomial in the Bernstein basis";
if type(_passed, 'specfunc'(anything, BernsteinBasis)) then
print("Will be implemented here...");