# Interpolate and save a vector function

i have a vector function as:

$f:\mathbb{R}\longrightarrow \mathbb{R}^{n}$

for example:

SomeComplicatedInterpolationFunction=Interpolation[Table[{i, i^2}, {i, 1, 5}]];
f[x]:={Cos[x],Sin[x],Tan[x],Cot[x],SomeComplicatedInterpolationFunction[x]};


Now I would like to save the function f as a file so i can recall this later in a new mathematica cernel. I tried:

f>>"f.m";


but it didnt work, this gives just the symbolic expression of f. Then I tried:

f2=FunctionInterpolation[f[x],{x,0,1}];
f2>> "f2.m";


But this only stores the first entry of f.

Whats the correct way to store a vector valued function without storing each component?

Use Save:

f[x] := {Cos[x],Sin[x],Tan[x],Cot[x],SomeComplicatedInterpolationFunction[x]};
Save["f.m", f]


Let's check if it worked:

Clear[f];
<<f

??f


Globalf

f[x]:={Cos[x],Sin[x],Tan[x],Cot[x],SomeComplicatedInterpolationFunction[x]}

• wow that was easy, thank you! – Mr Puh Nov 9 '17 at 21:27
f[x_]:={Cos[x],Sin[x],Tan[x],Cot[x],SomeComplicatedInterpolationFunction[x]};

Save[f.m,f]

• sorry if i my question was ambiguous. I want to store the function as a file on the hard disk of my computer not in the actual cernel. I want to recall the function in a new cernel with: f=<<"f.m". For a scalar valued function this works fine but the question is how to proceed with a vector valued function – Mr Puh Nov 9 '17 at 20:07