# Using Solve returns unnecessary Root, overcomplicated formula, and erroneous negative value

I want to find positive solution to an equation $\text{Solve}\left[t==\frac{\sqrt{\left(\frac{L}{\gamma }+t v\right)^2+x^2}}{c}\land \text{assume},t\right]$.

Although using many assumptions, Mathematica provides a negative solution as explained in what follows.

A similar but simpler equation works as expected.

How can I obtain the positive solution to the equation

### First a little context:

I'm using Solve to solve for t:

t11s1 = Solve[t == Sqrt[(L + v*t)^2 + (x)^2]/(c), t]


The solution are two roots:

$$\left\{\left\{t\to \frac{L v-\sqrt{c^2 L^2+c^2 x^2-v^2 x^2}}{c^2-v^2}\right\},\left\{t\to \frac{\sqrt{c^2 L^2+c^2 x^2-v^2 x^2}+L v}{c^2-v^2}\right\}\right\}$$

This I Refine with some assumptions, and get a positive solution:

$$\left\{\frac{\sqrt{c^2 L^2+c^2 x^2-v^2 x^2}}{c^2-v^2}+\frac{L v}{c^2-v^2}\right\}$$

However, if instead of $L$ I use $L\rightarrow\frac{L}{\sqrt{1-\frac{v^2}{c^2}}}$ which is a positive, real multiplicative factor on $L$, the solution changes to

$$\left\{\left\{t\to \text{ConditionalExpression}\left[\text{Root}\left[\text{\#1}^4 \left(c^8-2 c^6 v^2+c^4 v^4\right)+\text{\#1}^2 \left(-2 c^6 L^2-2 c^6 x^2+2 c^4 v^2 x^2+2 c^2 L^2 v^4\right)+c^4 L^4+2 c^4 L^2 x^2+c^4 x^4-2 c^2 L^4 v^2-2 c^2 L^2 v^2 x^2+L^4 v^4\&,4\right],v>0\land c>v\land x>0\land L>x\land 0<a<x\land 0<n<\frac{c}{v}\right]\right\}\right\}$$

which if I force to be expressed as radicals (to eliminate the Root[,4]) and again I refine using the same assumptions I get

$$\left\{-\sqrt{\frac{c^2 \left(L^2+x^2\right)+2 c L v \sqrt{L^2+x^2}+L^2 v^2}{c^4-c^2 v^2}}\right\}$$

which is a negative value because all variables are Reals !!

My assumptions are:

$$\text{assume}=v>0\land v\in \mathbb{R}\land L>0\land L\in \mathbb{R}\land \text{L2}>0\land \text{L2}\in \mathbb{R}\land a>0\land a\in \mathbb{R}\land t>0\land t\in \mathbb{R}\land c>0\land c\in \mathbb{R}\land n>0\land n\in \mathbb{R}\land \gamma >0\land \gamma \in \mathbb{R}\land \beta \geq 0\land \beta <1\land \beta \in \mathbb{R}\land c>v\land x\in \mathbb{R}\land x>0\land n<\frac{c}{v}\land L>x\land L>a\land x>a$$

and I use them as:

$$\text{t11s2}=\text{Solve}\left[t==\frac{\sqrt{\left(\frac{L}{\gamma }+t v\right)^2+x^2}}{c}\land \text{assume},t\right]$$

$$\text{t2}=\text{Simplify}[\text{ToRadicals}[\text{Refine}[t\text{/.}\, \text{t11s2},\text{assume}]],\text{assume}]$$

to get

$$t2=\left\{-\sqrt{\frac{c^2 \left(L^2+x^2\right)+2 c L v \sqrt{L^2+x^2}+L^2 v^2}{c^4-c^2 v^2}}\right\}$$

What can I do to recover a positive real values for t? Why is Mathematica behaving like this?

• Please post your actual Mathematica code, not a MathJax version of it. Nobody wants to type in code from MathJax when you could simply post it in a form that allows copy and paste. Without code no one will be able to work with it to see what could be done better, nor will they be able to experiment with possible improvements. Dec 27, 2017 at 22:34
• I don't think it is possible for ToRadicals to give a parametrized result that will consistently respect assumptions on the parameters. Root objects and radicals have a way of crossing. Which is to say, a given radicals might equal a given root object for one set of parameter values, and another root object for a different set of values. This is indicated in the Possible Issues section of the reference page for ToRadicals. Dec 28, 2017 at 0:33

I think it would be simpler to use Solve without assumptions, and then simplify after:

res = t /. Solve[t == Sqrt[(L/Sqrt[1-v^2/c^2]+v*t)^2 + x^2]/c, t];
Simplify[res, 0 < v < c] //TeXForm


$\left\{\frac{c L v-\sqrt{c^4 \left(L^2+x^2\right)-2 c^2 v^2 x^2+v^4 x^2}}{\left(c^2-v^2\right)^{3/2}},\frac{\sqrt{c^4 \left(L^2+x^2\right)-2 c^2 v^2 x^2+v^4 x^2}+c L v}{\left(c^2-v^2\right)^{3/2}}\right\}$

On the other hand, to fix your approach, you can use the undocumented option Assumptions for ToRadicals:

assum = 0<v<c && L>0 && t>0 && x>0;

res = t /. First @ Solve[
t==Sqrt[(L/Sqrt[1-v^2/c^2]+v*t)^2 + x^2]/c && assum,
t
];

FullSimplify[

$\sqrt{\frac{c^4 L^2+c^2 L^2 v^2+x^2 \left(c^2-v^2\right)^2+2 c L v \sqrt{c^4 L^2+x^2 \left(c^2-v^2\right)^2}}{\left(c^2-v^2\right)^3}}$