0
$\begingroup$

I have a table (Vector), where each element is an interpolated function by Interpolation[].

A[t_]:=Table[Interpolation[list[i]],{i,1,n}]]

Can I evaluate the vector A for fixed time?

I tried to define the vector A like above defined, and evaluated it by: A[0.1]

But the output is the list of interpolation, but not the value of functions at 0.1.

I tried to evaluated for fixed time the generic element of the A, and it seems work.

How can I solve it?

$\endgroup$
  • $\begingroup$ Your matrix definition does not depend upon $t$. Please fix it. $\endgroup$ – David G. Stork Feb 23 '17 at 0:43
4
$\begingroup$

I would use Composition and Through. Using Jack's list of interpolation functions:

list = Table[{θ, Sin[n θ]}, {n, 1, 3}, {θ, 0, 2 π, 2 π/20}];
{f1, f2, f3} = Interpolation /@ list;

Then, you can define A as:

A = Through @* {f1, f2, f3};

Check:

A[.1] //N

{0.0999854, 0.203017, 0.32276}

Same result

$\endgroup$
  • $\begingroup$ Thanks Carl Woll your solution it's that I need;) $\endgroup$ – plus91 Feb 23 '17 at 15:06
2
$\begingroup$

You didn't provide list so I'll make a simple one.

list = Table[{θ, Sin[n θ]}, {n, 1, 3}, {θ, 0, 2 π, 2 π/20}];

ListLinePlot[list]

Mathematica graphics

Now make a table of interpolated function from list.

{f1, f2, f3} = Interpolation[#] & /@ list

Define A[t] in terms of the functions

A[t_] := {f1[t], f2[t], f3[t]}

A[0.1] // N
(* {0.0999854, 0.203017, 0.32276} *)
$\endgroup$
  • $\begingroup$ Thanks, your solution work, but need a manual definition element of A[t]. In my case is a disanvantage, but this method it is useful the same ;) $\endgroup$ – plus91 Feb 23 '17 at 15:05
2
$\begingroup$

@plus91, change your solution a litle bit and it works

    list = Table[{θ, Sin[n θ]}, {n, 1, 3}, {θ, 0, 2 π, 2 π/20}];

    A[t_] = Table[Interpolation[list[[i]]][t], {i, 1, 3}]

    A[0.1]

    (*   {0.0999854, 0.203017, 0.32276}  *)
$\endgroup$
  • $\begingroup$ Thx for your solution ;) $\endgroup$ – plus91 Feb 23 '17 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.