The Mathematica Journal
Volume 9, Issue 2

Search

In This Issue
Articles
Tricks of the Trade
In and Out
Trott's Corner
New Products
New Publications
Calendar
News Bulletins
New Resources
Classifieds

Download This Issue 

About the Journal
Editorial Policy
Staff
Submissions
Subscriptions
Advertising
Back Issues
Contact Information

In and Out
Edited by Paul Abbott

Interpolation

Q: Given a set of nonuniformly sampled data, how can I compute numerical values of the slope , second derivative , and integral ? Also, is it possible to compute as a function of uniformly incremented arc length?

A: Here is an exact function .

Sample , taking from a uniform random distribution over the interval , and append the function values at the endpoints.

Superimpose the sampled data over a plot of the function to visualize the data.

Interpolate the data using of sufficiently high order.

Compare the first and second derivatives; the red curve denotes the exact value and the green curve denotes the interpolated function in each plot. The agreement is very good.

Next, examine . For comparison purposes, compute the exact value of .

Compute the numerical value of as an InterpolatingFunction using FunctionInterpolation and Integrate.

Alternatively, compute the indefinite integral as an InterpolatingFunction using NDSolve (since is equivalent to with ).

Compare the exact value (red) to the two numerical approaches, (green) and (blue). The curves overlay one another quite well.

The arc length, , of a parametric curve is

so we have with . Here is the arc length, , as an InterpolatingFunction.

The arc length is, as expected, monotonically increasing.

Since we can also determine the inverse function .

Here is a plot of .

Here is a table of uniformly incremented arc length values of the interpolated function .

A Plot with shows that the sampling does appear to be uniform with respect to arc length.



     
About Mathematica | Download Mathematica Player
Copyright © Wolfram Media, Inc. All rights reserved.