|
Further Examples: FunctionInterpolation
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 = Exp[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.
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.
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]= 
This InterpolatingFunction object that represents the values along a section of a helix.
In[11]:= 
Out[11]= 
Let's clean up by getting rid of the symbols defined in these examples.
In[12]:= 
|