MathGroup Archive 2010

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

Search the Archive

Re: Combining InterpolatingFunctions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107129] Re: [mg107092] Combining InterpolatingFunctions
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Wed, 3 Feb 2010 06:12:24 -0500 (EST)
  • References: <201002020830.DAA08963@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

For instance:

Clear[f]
f1 = Interpolation@Table[{x, Sin@x}, {x, 0, Pi, 1/10}];
f2 = Interpolation@Table[{x, Cos@x}, {x, Pi, 2 Pi, 1/10}];
f[x_] = Piecewise[{{f1@x, 0 <= x <= Pi}, {f2@x, Pi < x <= 2 Pi}}];
Plot[f@x, {x, 0, 2 Pi}]

Bobby

On Tue, 02 Feb 2010 02:30:36 -0600, Simon Pearce  
<Simon.Pearce at nottingham.ac.uk> wrote:

> Hi MathGroup,
>
>
>
> I have two sets of InterpolatingFunctions coming from two separate
> NDSolve's. One of them is defined over the region [0,rc] and the other
> over the region [rc,2]. I would like Mathematica to automatically choose
> the correct one when I use a replacement rule. If I could tell it never
> to extrapolate this would be perfect, though I don't seem to be able to.
>
>
>
> I've tried using FunctionInterpolation, but in order to keep my error
> terms down I had to increase the InterpolationPoints to 1000, which
> increases the calculation time from approximately .5sec to 1.5sec.
>
>
>
> Can anyone suggest an efficient way of combining InterpolatingFunctions
> without re-interpolating them? Or turning the extrapolation off!
>
>
>
> Thanks,
>
>
>
> Simon Pearce
>
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: matrix problem
  • Next by Date: Re: Can Mathematica solve this differential equation ?
  • Previous by thread: Combining InterpolatingFunctions
  • Next by thread: Re: Re: Combining InterpolatingFunctions