       Re: How to Calculatelength of an Spline curve between two

• To: mathgroup at smc.vnet.net
• Subject: [mg104840] Re: [mg104819] How to Calculatelength of an Spline curve between two
• From: Mark McClure <mcmcclur at unca.edu>
• Date: Wed, 11 Nov 2009 04:29:12 -0500 (EST)
• References: <200911101104.GAA20038@smc.vnet.net>

```On Tue, Nov 10, 2009 at 6:04 AM, alfaeco <alfaeco at gmail.com> wrote:
> Given an Interpolating function with method-> Spline.
> sp = Interpolation[tbl, Method -> "Spline"];
> How can I calculate the distance between two arbitrary points of the
> splines?

I assume you mean length along the curve as measured
by the standard calculus formula:
Integrate[Sqrt[1+f'[x]^2], {x,a,b}]

I actually noticed something that appears to be a
little bug to me in this problem.  The following
crashes my kernel, but it should work just fine:

data = Table[Fibonacci[n], {n, 1, 10}];
sp = Interpolation[data,  Method -> "Spline"];
NIntegrate[Sqrt[1 + sp'[x]^2], {x, 1, 10}]

Note that it does work just fine, if you remove
the Method -> "Spline" option.  Presumably, some
sort of problem arises when NIntegrate attempts
some preprocessing of the integrand involving a
Spline.  We can get around this like so:

data = Table[Fibonacci[n], {n, 1, 10}];
sp = Interpolation[data, Method -> "Spline"];
spp[x_?NumericQ] := sp'[x];
NIntegrate[Sqrt[1 + spp[x]^2], {x, 1, 10}]

Mark McClure

```

• Prev by Date: Re: How to Calculatelength of an Spline curve between two
• Next by Date: Re: Complex solutions to simple equations
• Previous by thread: Re: How to Calculatelength of an Spline curve between two
• Next by thread: Re: Re: How to Calculatelength of an Spline