# How to make Mathematica returns the exact expression I typed

I'm using Mathematica to compare some constants. Before playing around with those constants, I would like to check that I didn't make any mistake in typing them. So my question is the following: "What is the command that return the expression I typed?"

Just to be clear. The expression

4*Sum[Log[Gamma[k]], {k, 3, IntegerPart[n] + 2*(n - IntegerPart[n])}]


returns:

And that is what I want. On the other hand, the expression

Sum[(2*n - 2*m - 1)*Log[n*(m + 1)], {m, 0, IntegerPart[n] - 1}]


returns:

and that is what I want to avoid!

• You can use Hold and its variants. Mar 25, 2013 at 10:58
• And it's best to post code, so people can copy/paste and try for themselves. Mar 25, 2013 at 10:59
• Thank you for the fast reply! I'm sorry for non-posting code. I'll keep it in mind for next questions. Mar 25, 2013 at 11:02
• Just edit the question and paste in the actual code. This makes for a better question and a better site. Mar 25, 2013 at 11:58
• @Jagra You're definitely right! I edited my question, is it fine now? :) Mar 25, 2013 at 13:38

What you want is probably HoldForm but I don't understand why you cannot just check what you typed and why you need it to be printed again:

HoldForm[Sum[(2 n - 2 m - 1)*Log[n (m + 1)], {m, 0, IntegerPart[n] - 1}]]


• Yes, this is exactly what I was looking for! At the beginning I was trying to do that because it's just simpler to check long expression in the form I'm used to do that. After I while I was just refusing to believe that there wasn't a proper command on Mathematica (I could't find it googling around)! Mar 25, 2013 at 13:32
• Welcome to the 20K club. Congratulations! :-) Mar 25, 2013 at 19:11

What you could do is

SetOptions[Sum, Method -> None]


Then

Sum[(2 n - 2 m - 1)*Log[n (m + 1)], {m, 0, IntegerPart[n] - 1}]


does not evaluate, similar to like @halirutans solution. The advantage is that you can control this globally and do not have to put HoldForm everywhere.

• Thanks for the answer! In this specific case I'm fine with the "local" solution, but it's good to have another tool at disposal if needed. Mar 25, 2013 at 15:43