# Telling Mathematica to treat square roots as real valued

I often deal with problems which I know are real-valued, but Mathematica skips some simplifications because it doesn't know which branch of Sqrt to take. Is there some generic way to tell it to treat all Sqrt (and perhaps other multibranch functions?) that inputs and outputs are real-valued, for the purpose of Simplify?

Motivation -- I was looking to compute $$F_\infty(s)$$ where $$F$$ is defined as follows:

$$F_n(s)=\prod_{k=1}^{n}\frac{1}{\sqrt{1+2s/k^3}}$$

This doesn't evaluate in Mathematica, however, a user found that bringing square root inside the product makes it solvable:

1/Sqrt[Product[1 + (2 s)/k^3, {k, 1, \[Infinity]}]] // FullSimplify

$$\frac{1}{\sqrt{\frac{1}{\Gamma \left(1-\sqrt[3]{-2} \sqrt[3]{s}\right) \Gamma \left(\sqrt[3]{2} \sqrt[3]{s}+1\right) \Gamma \left(\frac{i \left(i+\sqrt{3}\right) \sqrt[3]{s}}{2^{2/3}}+1\right)}}}$$

The downside is that FullSimplify doesn't remove the reciprocals. On other hand, manually switching $$1/x$$ and $$\sqrt{x}$$ operations lets FullSimplify cancel out the reciprocals (and ToRadicals simplifies it further)

Sqrt[1/Product[1 + (2 s)/k^3, {k, 1, \[Infinity]}]] // FullSimplify // ToRadicals

$$\sqrt{\Gamma \left(1-\sqrt[3]{-2} \sqrt[3]{s}\right) \Gamma \left(\sqrt[3]{2} \sqrt[3]{s}+1\right) \Gamma \left((-1)^{2/3} \sqrt[3]{2} \sqrt[3]{s}+1\right)}$$

• Product[1/Sqrt[1 + (2 s)/k^3], {k, 1, n}] evaluates fine in version 12.3.1. It gives a horrible answer though, much worse than Product[(1 + (2 s)/k^3)^a, {k, 1, n}] where we can substitute a -> -1/2. Commented Sep 1, 2021 at 8:42
• Does Surd[..., 2] help? Commented Sep 1, 2021 at 19:48
• @murray using Surd doesn't help, it seems to follow same simplification rules as Sqrt Commented Sep 2, 2021 at 7:34

## 2 Answers

Try this:

Refine[ToRadicals@FullSimplify[PowerExpand[1/Sqrt[Product[1 + (2 s)/k^3, {k, 1, \[Infinity]}]]], Assumptions -> Element[s, Reals]]]// TraditionalForm


Use Product[1/Sqrt[expr],...] ==Sqrt[Product[1/expr],...]. Than problem of branches doesn't appear.

Sqrt[Product[1/(1 + (2 s)/k^3), {k, 1, \[Infinity]}]] //
FullSimplify // ToRadicals

(*   Sqrt[Gamma[1 - (-2)^(1/3) s^(1/3)] Gamma[1 + 2^(1/3) s^(1/3)] Gamma[
1 + (-1)^(2/3) 2^(1/3) s^(1/3)]]   *)