Re: Re: How to Calculatelength of an Spline curve between
- To: mathgroup at smc.vnet.net
- Subject: [mg104930] Re: [mg104891] Re: How to Calculatelength of an Spline curve between
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Fri, 13 Nov 2009 05:57:08 -0500 (EST)
- References: <hdbhcp$jj4$1@smc.vnet.net> <200911121107.GAA19061@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
I get the same kernel crash here. Bobby On Thu, 12 Nov 2009 05:07:57 -0600, Mark Fisher <particlefilter at gmail.com> wrote: > On Nov 10, 6:04 am, alfaeco <alfa... at gmail.com> wrote: >> I need some help. >> >> 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'm assuming you want to compute the distance along the spline. In > principle it should be easy, but because of a bug (that produces a > kernel crash) it's a bit harder. > > Here's the setup: > > data = Table[{i, RandomReal[{-10, 10}]}, {i, 5}]; > ifun = Interpolation[data, Method -> "Spline"]; > > Now let's simply use the formula for arc length to compute the > distance from x = 1.5 to x = 3.1: > > NIntegrate[Sqrt[1 + ifun'[x]^2], {x, 1.5, 3.1}] > > But on my system (Windows XP, Mathematica Version 7.0.1) this crashes the > kernel. So does FunctionInterpolation[ifun'[x], {x, 1, 5}], so that's > out too. > > OK, we can do this "by hand": > > difun = Interpolation[Table[{x, ifun'[x]}, {x, 1, 5, .01}]] > > Then use the arc length formula: > > NIntegrate[Sqrt[1 + difun[x]^2], {x, 1.5, 3.1}] > > On the other hand, if this is not what you want, then never mind. > > --Mark > -- DrMajorBob at yahoo.com
- References:
- Re: How to Calculatelength of an Spline curve between two points?
- From: Mark Fisher <particlefilter@gmail.com>
- Re: How to Calculatelength of an Spline curve between two points?