MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: How to Calculatelength of an Spline curve between


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


  • Prev by Date: Re: Using For[] for Generating Multiple Output Cells
  • Next by Date: Re: Non-Linear pendulum
  • Previous by thread: Re: How to Calculatelength of an Spline curve between two points?
  • Next by thread: strange behavior