1
$\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$
1
  • $\begingroup$ Your matrix definition does not depend upon $t$. Please fix it. $\endgroup$ Commented Feb 23, 2017 at 0:43

3 Answers 3

5
$\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$
1
  • $\begingroup$ Thanks Carl Woll your solution it's that I need;) $\endgroup$ Commented Feb 23, 2017 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$
1
  • $\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$ Commented Feb 23, 2017 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$
1
  • $\begingroup$ Thx for your solution ;) $\endgroup$ Commented Feb 23, 2017 at 15:02

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.