output formatting - How to substitute x in a expression f(x) but not calculate the value of the f(x) at the point x?
I want to subtitute x=1 into the expression f(x)=x2+3(x2−m2)+√x2+1
but I don't calculate the value f(1), that is mean, I want 12+3(12−m2)+√12+1.
If I tried
f[x_] := x^2 + 3 (x^2 - m^2) + Sqrt[x^2 + 1];
f[1]
I receive
1 + Sqrt[2] + 3 (1 - m^2)
How do I tell Mathematica to do that?
Answer
f[x_] := x^2 + 3 (x^2 - m^2) + Sqrt[x^2 + 1];
f[HoldForm@1] (* thanks: @chris *)
or
f[Defer@1]
Comments
Post a Comment