Re: multivariate interpolation
- To: mathgroup at smc.vnet.net
- Subject: [mg110931] Re: multivariate interpolation
- From: "Ingolf Dahl" <ingolf.dahl at telia.com>
- Date: Mon, 12 Jul 2010 01:04:55 -0400 (EDT)
Here is my suggestion:
Restructure the data matrix in two steps
data1 = Flatten[data, 1];
data2 = Table[{{data1[[i, 1]], data1[[i, 2]]}, {data1[[i, 3]],
data1[[i, 4]], data1[[i, 5]]}}, {i, Length[data1]}];
The list data2 can be used for interpolation
f[a_, b_, x_] := Simplify[Interpolation[data2][a, b]]
f[10.45, 0.065, x]
gives
{1000.67,8.09232*10^7,0.731501-22.7918 Sqrt[1/x]+151.976/x}
Was this what you were looking for?
I suggest that instead of working with large x, you should work with small
y, where x = 1/y^2. The limits will then be very small number instead of
very large. It seems plausible that linear interpolation should be more
exact for small numbers than for large.
x := 1/y^2
data3 = Table[{{data1[[i, 1]],
data1[[i, 2]]}, {Sqrt[1./data1[[i, 4]]], Sqrt[1./data1[[i, 3]]],
data1[[i, 5]]}}, {i, Length[data1]}] /. {Sqrt[y^2] -> y};
Instead of f we might define g. The first two elements in the result are
then the limits for y.
g[a_, b_, y_] := Expand[Simplify[Interpolation[data3][a, b]]]
g[9., 0.09, y]
gives
{0.000140028,0.031607,0.651531-21.3675 y+128.192 y^2}
I guess that g gives a "better" interpolation than f
Best regards
Ingolf Dahl
http://www.familydahl.se/mathematica
> -----Original Message-----
> From: Silvio Abruzzo [mailto:silvio.abruzzo at gmail.com]
> Sent: den 11 juli 2010 12:20
> To: mathgroup at smc.vnet.net
> Subject: [mg110911] multivariate interpolation
>
> Dear Group,
> I have the following problem. I have a matrix of this form
> {{{9, 0.01, 1001, 269250000,
> 0.944218 - 12.6734 Sqrt[1/x] + 72.8455/x}, {10, 0.01, 1001,
> 269250000, 0.944134 - 13.1619 Sqrt[1/x] + 71.1457/x}, {11, 0.01,
> 1001, 269250000, 0.944054 - 13.6278 Sqrt[1/x] + 69.5111/x},....
>
> where the first two numbers are parameters and the third and fourth
> number represent the bounds where the function in the last entries is
> usable. I would like to interpolate the first, second and last column
> in such a way that I have as result a function f[a_, b_, x_] were when
> a and b are fixed and corresponds to some value in the matrix above
> the function in the last column is used and when there is not the
> corresponding entry the interpolation is used. A method to achieve my
> goal is to calculate in some point between the min and the max the
> function in the last column in order that I have a tensor product
> structure and then to use the function Interpolation. Although this
> method should work enough well, I would like to know if there is a
> method to use all analytical information contained in the function in
> the last column in order to produce a better interpolation.
>
>
> Best regards,
>
> Silvio