Spline Toolbox    
fntlr

Taylor coefficients or polynomial

Syntax

Description

fntlr(f,dorder,x) returns the unnormalized Taylor coefficients, up to the given order dorder and at the given x, of the function described in f .

For a univariate function and a scalar x, this is the vector

For a matrix x, this is the corresponding matrix in which each entry has been replaced by the corresponding Taylor vector.

For a multivariate function, the Taylor vector of order dorder becomes the Taylor array of order dorder. Assuming that the function is -variate for some , this means that dorder is expected to have length , and the output provides, for each -vector x(:,j) in its x input, the array of size dorder whose th entry is

with the partial derivative of with respect to its th argument. However, the output contains this array as the equivalent vector taylor(:,j), of length , with the dimension of the target of the function described by f.

fntlr(f,dorder,x,interv) returns instead a ppform of the Taylor polynomial at x of order dorder for the function described by f. The basic interval for this ppform is as specified by interv. In this case and assuming that the function described by f is m-variate, x is expected to be of size [m,1], and interv is either of size [m,2] or else a cell array of length m containing m vectors of size [1,2].

Examples

If f contains a univariate function and x is a scalar or a 1-row matrix, then fntlr(f,3,x) produces the same output as the statements

As a more complicated example, look at the Taylor vectors of order 3 at 21 equally spaced points for the rational spline whose graph is the unit circle:

We plot ci along with the points v(1:2,:), to verify that these are, indeed, points on the unit circle.

Next, to verify that v(3:4,j) is a vector tangent to the circle at the point v(1:2,j), we use the MATLAB quiver command to add the corresponding arrows to our plot:

Finally, what about v(5:6,:)? These are second derivatives, and we add the corresponding arrows by the following quiver command, thus finishing the figure.

Figure 3-1: First and Second Derivative of a Rational Spline Giving a Circle

Now, our curve being a circle, you might have expected the 2nd derivative arrows to point straight to the center of that circle, and that would have been indeed the case if the function in ci had been using arclength as its independent variable. Since the parameter used is not arclength, we use the formula, given in Example: A Spline Curve, to compute the curvature of the curve given by ci at these selected points. For ease of comparison, we switch over to the variables used there and then simply use the commands from there.

The numerical answer is reassuring: at all the points tested, the curvature is 1 to within roundoff.

Figure 3-2: The Function 1/(1+x^2+y^2) and Its Taylor Polynomial of Order [3,3] at the Origin

As a final example, we start with a bivariate version of the Runge function, obtaining, for variety, a ppform for its denominator, , by bicubic spline interpolation:

Next, we make up the coefficient array for the numerator, 1, using exactly the same size, and put the two together into a rational spline:

Then we enlarge the basic interval for this rational spline, plot it and plot, on top of it, its Taylor polynomial at (0,0) of order [3,3].

Since we shaded the function but not the Taylor polynomial, we can easily distinguish the two in the previous figure. We can also see that, in contrast to the function, the Taylor polynomial fails to be rotationally symmetric. This is due to the fact that it is a polynomial of order [3,3] rather than a polynomial of total order 3.

To obtain the Taylor polynomial of order 3, we get the Taylor polynomial of order [3,3], but with (0,0) the left point of its basic interval, set all its coefficients of total order bigger than 3 equal to zero, and then reconstruct the polynomial, and plot it, choosing a different view in order to show off the Taylor polynomial better. Here are the commands and the resulting figure.

Figure 3-3: The Function 1/(1+x^2+y^2) and Its Taylor Polynomial of Order 3 at the Origin

See Also

fnder, fndir


  fnrfn fnval