0
$\begingroup$

I would like to achieve a function sin as in:

T=Sin[t];
sin[x_]:=T/.t->x;

But without this replacement rule. How can I tell Mathematica plug in the definition of the variable first before defining the function?

I want Mathematica to treat T exactly as if I used Sin[t]. How can I achieve that?

$\endgroup$
  • $\begingroup$ T[t_] = Sin[t]; then T[x] evaluates to Sin[x] $\endgroup$ – Bob Hanlon Nov 20 '17 at 17:57
  • $\begingroup$ I want to use T as if i copy pasted the expression T stands for. I dont want T to be another function $\endgroup$ – Mr Puh Nov 20 '17 at 18:06
  • $\begingroup$ Use T = Sin[t]; sin[t_] = T; then sin[x] evaluates to Sin[x] $\endgroup$ – Bob Hanlon Nov 20 '17 at 18:13
  • $\begingroup$ I want to use T also in environments like sin=Function[t,T] $\endgroup$ – Mr Puh Nov 20 '17 at 18:25
  • 2
    $\begingroup$ Since Function has the attribute HoldAll you would need to use sin = Function[t, Evaluate@T] $\endgroup$ – Bob Hanlon Nov 20 '17 at 18:29

Your Answer

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

Browse other questions tagged or ask your own question.