Re: interpolation of a matrix function
- To: mathgroup at smc.vnet.net
- Subject: [mg72631] Re: interpolation of a matrix function
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Sat, 13 Jan 2007 03:53:46 -0500 (EST)
- Organization: The University of Western Australia
- References: <ele7at$rng$1@smc.vnet.net>
In article <ele7at$rng$1 at smc.vnet.net>, "Jepessen" <jepessen at gmail.com>
wrote:
> Hi to all.
>
> My problem is the following: I' have a list, in which elements are in
> this form
>
> {a, {{m11,m12},{m21,m22}}},
>
> So, an example list can be this:
>
> {
> {1,{{4,3},{3,4}}},
> {2,{{5,7},{2,3}}},
> {2.3,{{8,5},{5,4}}},
> {3,6,{{1,1},{5,6}}}
> }
I assume you intend
am = {
{1,{{4,3},{3,4}}},
{2,{{5,7},{2,3}}},
{2.3,{{8,5},{5,4}}},
{3.6,{{1,1},{5,6}}}
}
that is with 3.6 instead of 3,6 ?
> In other words, I've a list of matrices, that depend on parameter 'a'.
>
> I'd like to create ad interpolating function that interpolate the
> entire matrix, and if I write
>
> interpolatedMatrix[parameter]
>
> it gives me a matrix formed by the interpolation of matrices of that
> list, depending of a parameter.
Here is one way:
int = Module[{n = 0, a}, Interpolation[am /. x_?MatrixQ :> a[++n]] /.
a[n_] :> am[[n,2]]]
This replaces the matrix with a dummy variable, does the interpolation,
and then substitutes the appropriate matrix back into the interpolating
function. For example,
int[3]
{{10.940828402366867, 0.21597633136094296},
{10.001479289940834, 6.2677514792899425}}
Cheers,
Paul
_______________________________________________________________________
Paul Abbott Phone: 61 8 6488 2734
School of Physics, M013 Fax: +61 8 6488 1014
The University of Western Australia (CRICOS Provider No 00126G)
AUSTRALIA http://physics.uwa.edu.au/~paul