228
19 Bernoulli and Euler Polynomials
“obj”; “x, n” are optional. “x” is the position at which the polynomials shall be
evaluated; default are 100 equidistant values in [0, 1]. “n” is an integer vector of
the degree of the polynomials in quest; default value is all. The output arguments
are the polynomial values “res”, an array with fix degree for each row and “n” the
corresponding vector of the polynomial degrees.
Bernoulli Polynomial Values can be computed via the SPECFUNPHYS class
bernx with syntax [obj, Bn] = bernx(n, x, wcom). The input argument “n” is the Bernoulli polynomial degree, a positive integer value. “x” (optional)
are a vector with the positions at which the polynomial shall be evaluated. Default
value is 0 · · · 1. In case “x” is complex the polynomial representation of the
Bernoulli polynomial will be used. By default, for real vectors “x” and degrees lower
11 the polynomial representation will be used, otherwise the trigonometric series,
Eq. (19.5), and if necessary in combination with the coordinate transformation
Eq. (19.6). The optional input argument “wcom” allows to select the computational
technique. The supported values are “d” for default (see above), “poly” for the
polynomial representation, and “trig” for the series representation in combination
with the argument transformation if necessary. The output arguments are the
class object “obj” with properties “value”, the polynomial values at position “z”,
“degree”, the degree of the polynomial, and “info” with some general information
about the evaluation. bernx comes in addition with the method plot located in
the class bexplot. The syntax is [obj, fh]=plot(obj, fh) with “obj”
the bernx class object and optional the figure handle “fh” to create the plot in the
figure with object handle fh.
Examples
By the following example a plot can be created to uncover the similarity between
a sin-function and a Bernoulli polynomial:
x = linspace(0,1);
% coordinates for sin-plot
yyaxis left
plot(x,sin(x * 2 * pi)), shg
% sin-plot for left y-axis
title(’left: sin(2\pi x)’)
fh = gcf;
% figure handle
yyaxis right
[obj, fh] = bernx(3).plot(fh); shg
With val=bernpoly(7).polyvalue; all Bernoulli polynomials of
degree 0 to 7 based on the polynomial representation will be evaluated.
obj=bernx(7,[], ’trig’); computes the Bernoulli polynomial
of degree 7 based on the trigonometric series representation. In both
cases the polynomials are evaluated at the same (default) positions x =
0 · · · 1. For high polynomial degrees bernx might be more accurate than
bernpoly(n).polyvalue, and if only one single polynomial is of interest
bernx might be more efficient.
19 Bernoulli and Euler Polynomials
“obj”; “x, n” are optional. “x” is the position at which the polynomials shall be
evaluated; default are 100 equidistant values in [0, 1]. “n” is an integer vector of
the degree of the polynomials in quest; default value is all. The output arguments
are the polynomial values “res”, an array with fix degree for each row and “n” the
corresponding vector of the polynomial degrees.
Bernoulli Polynomial Values can be computed via the SPECFUNPHYS class
bernx with syntax [obj, Bn] = bernx(n, x, wcom). The input argument “n” is the Bernoulli polynomial degree, a positive integer value. “x” (optional)
are a vector with the positions at which the polynomial shall be evaluated. Default
value is 0 · · · 1. In case “x” is complex the polynomial representation of the
Bernoulli polynomial will be used. By default, for real vectors “x” and degrees lower
11 the polynomial representation will be used, otherwise the trigonometric series,
Eq. (19.5), and if necessary in combination with the coordinate transformation
Eq. (19.6). The optional input argument “wcom” allows to select the computational
technique. The supported values are “d” for default (see above), “poly” for the
polynomial representation, and “trig” for the series representation in combination
with the argument transformation if necessary. The output arguments are the
class object “obj” with properties “value”, the polynomial values at position “z”,
“degree”, the degree of the polynomial, and “info” with some general information
about the evaluation. bernx comes in addition with the method plot located in
the class bexplot. The syntax is [obj, fh]=plot(obj, fh) with “obj”
the bernx class object and optional the figure handle “fh” to create the plot in the
figure with object handle fh.
Examples
By the following example a plot can be created to uncover the similarity between
a sin-function and a Bernoulli polynomial:
x = linspace(0,1);
% coordinates for sin-plot
yyaxis left
plot(x,sin(x * 2 * pi)), shg
% sin-plot for left y-axis
title(’left: sin(2\pi x)’)
fh = gcf;
% figure handle
yyaxis right
[obj, fh] = bernx(3).plot(fh); shg
With val=bernpoly(7).polyvalue; all Bernoulli polynomials of
degree 0 to 7 based on the polynomial representation will be evaluated.
obj=bernx(7,[], ’trig’); computes the Bernoulli polynomial
of degree 7 based on the trigonometric series representation. In both
cases the polynomials are evaluated at the same (default) positions x =
0 · · · 1. For high polynomial degrees bernx might be more accurate than
bernpoly(n).polyvalue, and if only one single polynomial is of interest
bernx might be more efficient.
