1
$\begingroup$

Suppose I have the term $t=\sqrt{-a^2-b^2}$, where $a,b\in\mathbb R$. Of course, we know that it holds $$ t = \mathbb i \sqrt{a^2+b^2} $$ which is (in my opinion) more convenient. How can I get Mathematica to factor this out? Especially for things like $$ \cosh(\sqrt{-a^2-b^2}) = \cos(\sqrt{a^2+b^2}) $$ it would be very helpful, but FullSimplify does not do it:

In[29]:= FullSimplify[Sqrt[-a^2 - b^2], {a ∈ Reals, b ∈ Reals}]
Out[29]= Sqrt[-a^2-b^2]
In[30]:= FullSimplify[Cosh[Sqrt[-a^2 - b^2]], {a ∈ Reals, b ∈ Reals}]
Out[30]= Cosh[Sqrt[-a^2-b^2]]
$\endgroup$
3
$\begingroup$

In these cases, you need to specify the variables are $>0$. Of course it also works for $<0$, but it just works this way in the software.

FullSimplify[Cosh[Sqrt[-a^2 - b^2]], {a > 0, b > 0}]

Cos[Sqrt[a^2 + b^2]]

FullSimplify[Sqrt[-a^2 - b^2], {a > 0, b > 0}]

I Sqrt[a^2 + b^2]

$\endgroup$
  • $\begingroup$ I just saw that FullSimplify[Sqrt[-a^2 - b^2], {a^2 > 0, b^2 > 0}] works, as well but FullSimplify[Sqrt[-a^2 - b^2], {a^2 >= 0, b^2 >= 0}] does not. Any explanation for this weird behaviour? $\endgroup$ – Wauzl Jun 17 '16 at 10:35
  • $\begingroup$ @Wauzl It also works for {a^2 >= 0, b^2 > 0}, I guess the software needs to know at least one of them isn't 0. Otherwise the solution set contains two possibilities, I Sqrt[a^2 + b^2] and 0. $\endgroup$ – Feyre Jun 17 '16 at 10:40
3
$\begingroup$

Using an undocumented function:

Cosh[Sqrt[-a^2 - b^2]] /. Sqrt[expr_] /; Internal`SyntacticNegativeQ[expr] :> I Sqrt[-expr]
   Cos[Sqrt[a^2 + b^2]]
$\endgroup$
  • $\begingroup$ How save/portable is it to use such a function? $\endgroup$ – Wauzl Jun 17 '16 at 10:49
  • $\begingroup$ As with everything that's undocumented: caveat emptor. $\endgroup$ – J. M. will be back soon Jun 17 '16 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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