此为 Mathematica 4 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.1)

FunctionInterpolation

Usage

FunctionInterpolation[expr,  x, xmin, xmax ]xxminxmax计算expr且构造一个InterpolatingFunction对象,这个对象相应于结果表示一个适当的函数。
FunctionInterpolation[expr,  x, xmin, xmax ,  y, ymin, ymax , ... ] 构造一个有多个自变量的InterpolatingFunction对象。


Notes

• 可以使用FunctionInterpolation从一个包含几个这样的对象中产生一个单一的InterpolatingFunction对象。
InterpolationPrecision选项指定由InterpolatingFunction产生的返回值的精度。
• 参见 Interpolation的注解。
• 参见 Mathematica 全书: 3.8.2节.
Further Examples

FunctionInterpolation can be used to simplify a combination of InterpolatingFunction objects. It can also be used to make an approximate function to a desired precision and accuracy goal from a function that is costly to evaluate.

Here is a function with argument t that gives the x value of the intersection of the graphs y = x and y = Cos[t x].

In[1]:=  

If it is necessary to compute it repeatedly, it is useful to construct a faster approximate function.

In[2]:=  

Out[2]=

Now the approximation can be used without having to call FindRoot again, as in a plot, for example.

Evaluate the cell to see the graphic.

In[3]:=  

There happens to be a solution for the equation in Mathematica.

In[4]:=  

Out[4]=

The approximation was computed so that the default accuracy and precision goals ( digits) would be met if possible. The plot indicates that these goals were fairly well met.

Evaluate the cell to see the graphic.

In[5]:=  

FunctionInterpolation provides an easy way to combine InterpolatingFunction objects with other functions to produce a new approximate function.

The function int is an InterpolatingFunction object that depends on the parameter  .

In[6]:=  

Out[6]=

The function fint is an InterpolatingFunction object that interpolates over a two-dimensional domain, with t varying over the domain of int and x positive.

In[7]:=  

Out[7]=

Its values approximate the function.

In[8]:=  

Out[8]=

The function int3 is a three-dimensional InterpolatingFunction object.

In[9]:=  

Out[9]=

A "slice" can be taken along a complicated curve or surface. Here is an InterpolatingFunction object that represents the values of int3 on the cone  .

In[10]:=  

Out[10]=

The "slice" can be taken along a more complicated curve or surface. Here is another one that gives an InterpolatingFunction object that represents the values along a section of a helix.

In[11]:=  

Out[11]=

This InterpolatingFunction object is an approximate solution to a differential equation.

In[12]:=  

Out[12]=

Here is a plot of the function.

Evaluate the cell to see the graphic.

In[13]:=  

Because the solution is growing so fast, NDSolve needs to use more points than are absolutely necessary for a good approximation. The solution given by NDSolve uses all the points where NDSolve evaluated the equation, so the size of the solution is large.

In[14]:=  

Out[14]=

FunctionInterpolation can be used to eliminate points in a case like this.

In[15]:=  

Out[15]=

The size of the solution has decreased dramatically.

In[16]:=  

Out[16]=

Since the solution grows so quickly, the error controls for NDSolve and FunctionInterpolation are based on precision (relative error). The plot shows that the solution with fewer points stored does not have less precision overall than the solution with more points stored.

Evaluate the cell to see the graphic.

In[17]:=  

Let's clean up by getting rid of the symbols defined in these examples.

In[18]:=