Spline Toolbox™ Previous page   Next Page 
fntlr
 Provide feedback about this page

Taylor coefficients or polynomial

Syntax

Description

taylor = 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

If, more generally, the function in f is d-valued with d>1 or even prod(d)>1 and/or is m-variate for some m>1, then dorder is expected to be an m-vector of positive integers, x is expected to be a matrix with m rows, and, in that case, the output is of size [prod(d)*prod(dorder),size(x,2)], with its j-th column containing

for i1=1:dorder(1), ..., im=1:dorder(m). Here, is the partial derivative of with respect to its th argument.

p = 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 Figure 10-1.

Figure 10-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 10-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 10-3: The Function 1/(1+x^2+y^2) and Its Taylor Polynomial of Order 3 at the Origin

See Also

fnder, fndir


 Provide feedback about this page 

Previous page fnrfn fnval Next page

 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS