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

If I input Sqrt[2 g], Mathematica automatically pulls out the 2 and returns Sqrt[2] Sqrt[g].
Is there any way I can prevent that and leave Sqrt[2 g] as is? (Running version 9).

share|improve this question
Someting like h[x_] := Sqrt[HoldForm@x]; h[2 g] ? – Dr. belisarius Feb 17 '14 at 16:23
This could be better answered if you explain your motivation for wanting to keep the constants inside. Generally, you can have any form for display only, but not if you actually want to do calculations with it. Because of these limitations, a useful answer would need to take into account your use case. – Szabolcs Feb 17 '14 at 16:56
Thanks. This is helpful. The basic issue is that I want to use a rule to convert something like Sqrt[a]Sqrt[b]Sqrt[c] to Sqrt[a b c]. The rule works fine as long as a, b, and c are not numbers, but if there is a number, it gets pulled out. Since I am using rules to work with the square roots, I don't need Mathematica to evaluate them, and your solution lets me display the result in mathematical notation with the square root sign. – user12432 Feb 17 '14 at 23:47

Your Answer


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

Browse other questions tagged or ask your own question.