%-------------------------------------------------------------------------- % Bernstein Polynomials % % Version 1 April 2010 % % Anthony Narkawicz NASA %--------------------------------------------------------------------------
degree_raise(b): Bernstein_Polynomial = LET
m = b`index,
bseq = b`bern_seq IN
(# index := m+1,
bern_seq := (LAMBDA (i:upto(m+1)): IF i = 0 THEN bseq(0) ELSIF i = m+1 THEN bseq(m) ELSE
(bseq(i)*(m+1-i) + bseq(i-1)*i)/(m+1) ENDIF) #)
degree_raise_power(b,j): RECURSIVE Bernstein_Polynomial = IF j=0 THEN b ELSE degree_raise(degree_raise_power(b,j-1)) ENDIF MEASURE j
Bern_poly_inverse(b): sequence[real] = LAMBDA (j:nat): IF j>b`index THEN
0 ELSE
sigma(0,j,(LAMBDA (i:nat): IF i > j THEN 0 ELSE b`bern_seq(i)*(-1)^(j-i)*(C(b`index,j)*C(j,i)) ENDIF)) ENDIF
% Structural Property Decomposition For Bernstein Polynomials
P: VAR [Bernstein_Polynomial -> bool]
Bern_structural_decomp: LEMMA
((FORALL (b1,b2: Bernstein_Polynomial): b1`index = b2`index AND P(b1) AND P(b2) IMPLIES P((# index:= b1`index,bern_seq := (LAMBDA (i:upto(b1`index)): b1`bern_seq(i) + b2`bern_seq(i)) #))) AND
(FORALL (i,m:nat,x:real): i<=m IMPLIES
P((# index := m, bern_seq := (LAMBDA (j:upto(m)): IF j = i THEN x ELSE 0 ENDIF) #)))) IMPLIES
(FORALL (b:Bernstein_Polynomial): P(b))
% The function that takes a sequence corresponing to a polynomial in the monomial % basis and returns the sequence corresponing to the polynomial in the Bernstein basis. The number p % is the "degree" of the polynomial in the monomial basis, and m is the Bernstein degree.
Bernstein_polynomial(a,p,m): Bernstein_Polynomial =
(# index := m,
bern_seq := LAMBDA (s: upto(m)): sigma(0,s,LAMBDA(i:nat):IF i>s OR i>p THEN 0 ELSE a(i)*(C(s,i)/C(m,i)) ENDIF) #)
Bern_subdiv_left(b): Bernstein_Polynomial =
(# index := b`index,
bern_seq := LAMBDA (i:upto(b`index)): (1/2^i)*sigma(0,i, LAMBDA (j:nat): IF j > i THEN 0 ELSE C(i,j)*b`bern_seq(j) ENDIF) #)
Bern_subdiv_right(b): Bernstein_Polynomial =
(# index := b`index,
bern_seq := LAMBDA (i:upto(b`index)): (1/2^(b`index-i))*sigma(0,b`index-i, LAMBDA (j:nat): IF j > b`index-i THEN 0 ELSE C(b`index-i,j)*b`bern_seq(b`index-j) ENDIF) #)
Bern_subdiv_left_id: LEMMA Bern_poly(Bern_subdiv_left(b)) = Bern_poly(b) o (LAMBDA (x:real): (1/2)*x)
Bern_subdiv_left_reverse: LEMMA Bern_poly(Bern_poly_reverse(Bern_subdiv_left(Bern_poly_reverse(b)))) =
Bern_poly(b) o (LAMBDA (x:real): (1/2)*(x+1))
Bern_subdiv_right_id: LEMMA Bern_poly(Bern_subdiv_right(b)) = Bern_poly(b) o (LAMBDA (x:real): (1/2)*(x+1))
Bern_subdiv_ge: LEMMA
(FORALL (y:real): 0<=y AND y<=1 IMPLIES Bern_poly(Bern_subdiv_right(b))(y) >= Ma) AND
(FORALL (y:real): 0<=y AND y<=1 IMPLIES Bern_poly(Bern_subdiv_left(b))(y) >= Ma) IMPLIES
(0<=x AND x<=1 IMPLIES Bern_poly(b)(x) >= Ma)
%-------------------------------------------------------% %-------------------------------------------------------% % Splitting the interval another way %-------------------------------------------------------% %-------------------------------------------------------%
Bern_sweep(b)(p:upto(b`index)): RECURSIVE {bp: Bernstein_Polynomial | bp`index = b`index}
= (# index := b`index,
bern_seq := IF p = 0 THEN b`bern_seq ELSE
(LAMBDA (i:upto(b`index)): IF i<p THEN Bern_sweep(b)(p-1)`bern_seq(i) ELSE (1/2)*(Bern_sweep(b)(p-1)`bern_seq(i-1) + Bern_sweep(b)(p-1)`bern_seq(i)) ENDIF) ENDIF #) MEASURE p
Bern_sweep_expand: LEMMA
p<=b`index IMPLIES
Bern_sweep(b)(p) =
(# index := b`index,
bern_seq :=
(LAMBDA (i:upto(b`index)): IF i<=p THEN
(1/(2^i))*sigma(0,i,(LAMBDA (j:nat): IF j > i THEN 0 ELSE b`bern_seq(j)*C(i,j) ENDIF)) ELSE
(1/(2^p))*sigma(0,p,(LAMBDA (j:nat): IF j > p THEN 0 ELSE b`bern_seq(j+(i-p))*C(p,j) ENDIF)) ENDIF) #)
Bern_subdiv_l_id: LEMMA Bern_poly(Bern_subdiv_l(b)) = Bern_poly(b) o (LAMBDA (x:real): (1/2)*x)
Bern_subdiv_r_id: LEMMA Bern_poly(Bern_subdiv_r(b)) = Bern_poly(b) o (LAMBDA (x:real): (1/2)*(x+1))
%-------------------------------------------------------% %-------------------------------------------------------% % End of splitting the interval another way %-------------------------------------------------------% %-------------------------------------------------------%
% Bernstein Coefficients
Bern_coeff(a,p,m)(s: upto(m)): real = LET msp = min(s,p) IN sigma(0,msp,LAMBDA(i:nat):IF i>msp THEN 0 ELSE a(i)*(C(s,i)/C(m,i)) ENDIF)
Bernstein_le: LEMMA
(FORALL (s:upto(m)): Bern_coeff(a,p,m)(s) <= Ma) AND 0<=x AND x<=1 AND m>=p IMPLIES polynomial(a,p)(x) <= Ma
Bernstein_lt: LEMMA
(FORALL (s:upto(m)): Bern_coeff(a,p,m)(s) < Ma) AND 0<=x AND x<=1 AND m>=p IMPLIES polynomial(a,p)(x) < Ma
Bernstein_ge: LEMMA
(FORALL (s:upto(m)): Bern_coeff(a,p,m)(s) >= Ma) AND 0<=x AND x<=1 AND m>=p IMPLIES polynomial(a,p)(x) >= Ma
Bernstein_gt: LEMMA
(FORALL (s:upto(m)): Bern_coeff(a,p,m)(s) > Ma) AND 0<=x AND x<=1 AND m>=p IMPLIES polynomial(a,p)(x) > Ma
% For Bernstein Polynomials
Bern_poly_le: LEMMA
(FORALL (s:upto(b`index)): b`bern_seq(s) <= Ma) AND 0<=x AND x<=1 IMPLIES Bern_poly(b)(x) <= Ma
Bern_poly_lt: LEMMA
(FORALL (s:upto(b`index)): b`bern_seq(s) < Ma) AND 0<=x AND x<=1 IMPLIES Bern_poly(b)(x) < Ma
Bern_poly_ge: LEMMA
(FORALL (s:upto(b`index)): b`bern_seq(s) >= Ma) AND 0<=x AND x<=1 IMPLIES Bern_poly(b)(x) >= Ma
Bern_poly_gt: LEMMA
(FORALL (s:upto(b`index)): b`bern_seq(s) > Ma) AND 0<=x AND x<=1 IMPLIES Bern_poly(b)(x) > Ma
% Quotients
Bern_poly_quotient_le: LEMMA
b1`index = b2`index AND
(FORALL (s:upto(b2`index)): b2`bern_seq(s) > 0) AND
(FORALL (s:upto(b1`index)): b1`bern_seq(s)/b2`bern_seq(s) <= Ma) AND 0<=x AND x<=1 IMPLIES
(Bern_poly(b2)(x) > 0 AND
Bern_poly(b1)(x)/Bern_poly(b2)(x) <= Ma)
% Splitting
Bern_poly_split_le: LEMMA LET bsl = Bern_subdiv_l(b),bsr = Bern_subdiv_r(b) IN
(FORALL (x:real): 0<=x AND x<=1 IMPLIES Bern_poly(bsr)(x)<=Ma) AND
(FORALL (x:real): 0<=x AND x<=1 IMPLIES Bern_poly(bsl)(x)<=Ma) IMPLIES (FORALL (x:real): 0<=x AND x<=1 IMPLIES Bern_poly(b)(x)<=Ma)
Bern_poly_split_lt: LEMMA LET bsl = Bern_subdiv_l(b),bsr = Bern_subdiv_r(b) IN
(FORALL (x:real): 0<=x AND x<=1 IMPLIES Bern_poly(bsr)(x)<Ma) AND
(FORALL (x:real): 0<=x AND x<=1 IMPLIES Bern_poly(bsl)(x)<Ma) IMPLIES (FORALL (x:real): 0<=x AND x<=1 IMPLIES Bern_poly(b)(x)<Ma)
Bern_poly_split_ge: LEMMA LET bsl = Bern_subdiv_l(b),bsr = Bern_subdiv_r(b) IN
(FORALL (x:real): 0<=x AND x<=1 IMPLIES Bern_poly(bsr)(x)>=Ma) AND
(FORALL (x:real): 0<=x AND x<=1 IMPLIES Bern_poly(bsl)(x)>=Ma) IMPLIES (FORALL (x:real): 0<=x AND x<=1 IMPLIES Bern_poly(b)(x)>=Ma)
Bern_poly_split_gt: LEMMA LET bsl = Bern_subdiv_l(b),bsr = Bern_subdiv_r(b) IN
(FORALL (x:real): 0<=x AND x<=1 IMPLIES Bern_poly(bsr)(x)>Ma) AND
(FORALL (x:real): 0<=x AND x<=1 IMPLIES Bern_poly(bsl)(x)>Ma) IMPLIES (FORALL (x:real): 0<=x AND x<=1 IMPLIES Bern_poly(b)(x)>Ma)
% COLLECTIONS OF BERNSTEIN POLYNOMIALS
% Next are recursive definitions of min and max for bernstein polynomials
Bern_min_rec(b)(q:upto(b`index)): RECURSIVE
{r:real | (EXISTS (iq:upto(q)): r = b`bern_seq(iq)) AND (FORALL (iq:upto(q)): r <= b`bern_seq(iq))} = LET y = b`bern_seq(q),
x = IF q = 0 THEN y ELSE Bern_min_rec(b)(q-1) ENDIF IN min(y,x) MEASURE q
Bern_max_rec(b)(q:upto(b`index)): RECURSIVE
{r:real | (EXISTS (iq:upto(q)): r = b`bern_seq(iq)) AND (FORALL (iq:upto(q)): r >= b`bern_seq(iq))} = LET y = b`bern_seq(q),
x = IF q = 0 THEN y ELSE Bern_max_rec(b)(q-1) ENDIF IN max(y,x) MEASURE q
Bern_min(b) :
{r : real | (EXISTS (ib:upto(b`index)): r = b`bern_seq(ib)) AND
(FORALL (ib:upto(b`index)): r<=b`bern_seq(ib))} =
Bern_min_rec(b)(b`index)
Bern_max(b) :
{r : real | (EXISTS (ib:upto(b`index)): r = b`bern_seq(ib)) AND
(FORALL (ib:upto(b`index)): r>=b`bern_seq(ib))} =
Bern_max_rec(b)(b`index)
Bern_min_bound : LEMMA 0<=x AND x<=1 IMPLIES Bern_poly(b)(x)>=Bern_min(b)
Bern_max_bound : LEMMA 0<=x AND x<=1 IMPLIES Bern_poly(b)(x)<=Bern_max(b)
% A function to compute the current min and max estimates follows. One should note that if b_0,...,b_n are % Bernstein coefficients for a polynomial, then the polynomial attains the values of b_0 and b_n at t = 0 % and t = 1.
Bern_min_est(b): real = min(b`bern_seq(0),b`bern_seq(b`index))
Bern_max_est(b): real = max(b`bern_seq(0),b`bern_seq(b`index))
% The next construction, Bernstein_Collection is a type. An element of this type is a collection of % Bernstein Polynomials, and associated to each one is a pair consisting of its minimum and maximum entries
Bernstein_MinMax: TYPE = [# bernpoly: Bernstein_Polynomial, bernmin:real, bernmax:real #]
Bern_min_coeff_rec(BC)(np:below(BC`number_polys)) : RECURSIVE real = LET current_poly_min = BC`bern_poly_number(np)`bernmin IN IF np = 0 THEN current_poly_min ELSE min(current_poly_min,Bern_min_coeff_rec(BC)(np-1)) ENDIF MEASURE np
Bern_min_coeff(BC): real = Bern_min_coeff_rec(BC)(BC`number_polys-1)
% Next, we subdivide each bernstein polynomial in the collection.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.