Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
    
Dirty trick : f["1"]. – b.gatessucks Feb 26 '13 at 8:21
    
Thank you very much. – minthao_2011 Feb 26 '13 at 8:22
up vote 8 down vote accepted
  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

share|improve this answer
1  
what's wrong with f[Defer[x]] /. x -> 1 ? The order? – chris Feb 26 '13 at 8:38
    
@chris, right!!! thanks – kglr Feb 26 '13 at 8:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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