# Define a function, that evaluates other function

I want to be able to write a Function (Operator), that gets 2 arguments. The first argument specifies the kind of "operation", the second the function on which to apply the operation. It should work with $$\mathbb{R}\longrightarrow\mathbb{R}^n$$ functions.

I have defined a function

myF[t_]:= {Sin[t],Cos[t]}

so a function that maps $$\mathbb{R}\longrightarrow\mathbb{R}^n,$$ for the case $$n=2$$.

Now I want to define another function, that evaluates myF at 0, whenever I pass evaluate as (first) argument.

I tried the following

myOperator[evaluate,Fun_[t_]]:=Map[t=0][Fun]

However, the output is

myOperator[evaluate,{0,1}]

So the evaluation happens, but the result is not just the vector... Can anyone help me?

Edit: Of course, I have also tried

myOperator[evaluate,Fun_[t_]]:=Fun[0]

• You've got a number of syntax issues, but my guess based on your description is that you want myOperator[evaluate_, fun_]: fun[0]. Read the docs so you can understand how Mathematica functions are actually defined Commented Dec 30, 2020 at 17:32
• Thank you, this works. But in general, how would I access the variable t? Like myOperator[foo,...]= Integrate[fun,{t,0,3}]
– NG98
Commented Dec 30, 2020 at 18:32

ClearAll[myOperator];

{0, 1}