Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Precision of arguments to FunctionInterpolation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68412] Re: Precision of arguments to FunctionInterpolation
  • From: Peter Pein <petsie at dordos.net>
  • Date: Fri, 4 Aug 2006 03:59:26 -0400 (EDT)
  • References: <eakeg1$r1j$1@smc.vnet.net> <easjk5$fti$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Andrew Moylan schrieb:
> Here is some further information that makes the strangeness more
> obvious:
> 
> The following three different calls to FunctionInterpolation all fail:
> 
>  FunctionInterpolation[lowPrecisionSin[x], {x, 0, 1.`14}]
>  FunctionInterpolation[lowPrecisionSin[x], {x, 0, 1.`20}]
>  FunctionInterpolation[lowPrecisionSin[x], {x, 0, 1}]

the latter works in Mathematica 5.1 for Windows

> 
> The only way that I can successfully interpolate to an upper bound of
> roughly 1 is by entering the upper bound as the
> exactly-machine-precision number "1.":
> 
>   FunctionInterpolation[lowPrecisionSin[x], {x, 0, 1.}]
> 
> Can anyone explain why higher-than-machine-precision (e.g. 1.`20),
> lower-than-machine-precision (e.g. 1.`14), and infinite precision (1)
> all fail, but exactly machine-precision succeeds here?
>

No, sorry.

> Secondly, does anyone know the meaning of the InterpolationPrecision
> option to FunctionInterpolation? In particular, with the default
> setting of InterpolationPrecision->Automatic, what value is
> automatically chosen?
> 
> 
You can test this using

Reap[FunctionInterpolation[((Sow[Precision[#1]]; #1) & )[lowPrecisionSin[x]], {x, 0., 1}]][[2, 1]]

which gives:

{5.1924023244417254, Infinity, Infinity, 4.999999999999999, 5.000000000000001, 5., 5., 5.,
   5.000000000000001, 4.999999999999999, 5., 5.000000000000001, 5., 5., 4.999999999999999, 5.,
   5., 4.999999999999999, 5.000000000000001, 5.000000000000001, 5.000000000000001, 5., 5.}

If you know the maximum precision of the function you want to interpolate (5 in this case), you can use
InterpolationPrecision->5:

intfuns = {f14, f20, finf} = (FunctionInterpolation[lowPrecisionSin[x],
        {x, 0, SetPrecision[1., #1]}, InterpolationPrecision -> 5] & ) /@ {14, 20, Infinity};

SameQ @@ intfuns
--> True

Through[{f14, lowPrecisionSin, Sin}[0.6`14.000000000000002]]
--> {0.5646420701356566528`4.127871245474387, 0.5646424733950353572`5.000000000000002, 0.5646424733950353572009454457`14.056991706843485}


   Peter


  • Prev by Date: Re: Programming with .NET / hand over of variables
  • Next by Date: Wolfram Workbench and package development
  • Previous by thread: Re: Precision of arguments to FunctionInterpolation
  • Next by thread: Re: Precision of arguments to FunctionInterpolation