5
$\begingroup$

I want to subtitute $x = 1$ into the expression $$f(x)=x^2 + 3 (x^2 - m^2) + \sqrt{x^2 + 1}$$ but I don't calculate the value $f(1)$, that is mean, I want $$1^2 + 3(1^2-m^2)+\sqrt{1^2 + 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?

$\endgroup$
1

1 Answer 1

9
$\begingroup$
  f[x_] := x^2 + 3 (x^2 - m^2) + Sqrt[x^2 + 1];


  f[HoldForm@1]   (* thanks: @chris *)

or

  f[Defer@1] 

enter image description here

$\endgroup$
2
  • 2
    $\begingroup$ what's wrong with f[Defer[x]] /. x -> 1 ? The order? $\endgroup$
    – chris
    Feb 26, 2013 at 8:38
  • $\begingroup$ @chris, right!!! thanks $\endgroup$
    – kglr
    Feb 26, 2013 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.