Intro
I have encountered two radical expressions for which I have to find the roots analytically:
eq1 = c - e - (2 a x)/(1 + x^2) + Sqrt[2 a - b + d - (2 a)/(1 + x^2)] Sqrt[b - d + (2 a)/(1 + x^2)]
and
eq2 = -((16 a x)/(
1 + x^2)) + (1/((b - d)^2 + (c -
e)^2))(-5 b Sqrt[(-(b - d)^2 - (c - e)^2) (-4 a^2 + (b -
d)^2 + (c - e)^2)] +
5 d Sqrt[(-(b - d)^2 - (c - e)^2) (-4 a^2 + (b - d)^2 + (c -
e)^2)] + 3 ((b - d)^2 + (c - e)^2) (c - e) +
Sqrt[3 (2 a - b + d) ((b - d)^2 + (c - e)^2) -
5 c Sqrt[(-(b - d)^2 - (c - e)^2) (-4 a^2 + (b - d)^2 + (c -
e)^2)] +
5 Sqrt[(-(b - d)^2 - (c - e)^2) (-4 a^2 + (b - d)^2 + (c - e)^2)]
e - (16 a ((b - d)^2 + (c - e)^2))/(1 + x^2)]
Sqrt[(-10 a + 3 b - 3 d) ((b - d)^2 + (c - e)^2) +
5 c Sqrt[(-(b - d)^2 - (c - e)^2) (-4 a^2 + (b - d)^2 + (c -
e)^2)] -
5 Sqrt[(-(b - d)^2 - (c - e)^2) (-4 a^2 + (b - d)^2 + (c - e)^2)]
e + (16 a ((b - d)^2 + (c - e)^2))/(1 + x^2)])
The specific numeric values of my application are:
Data = {a -> 70/1000, b -> 485/10000, c -> 8563/100000, d -> 115/1000,
e -> 148/1000, x -> 0.054170996410719686`};
First equation direct solution
The first one is easy for Mathematica to solve directly using:
Solve[eq1 == 0, x]
Yielding the following result:
{{x -> (-a (-4 c + 4 e) - Sqrt[
a^2 (-4 c + 4 e)^2 -
4 (2 a b + b^2 + c^2 - 2 a d - 2 b d + d^2 - 2 c e +
e^2) (-2 a b + b^2 + c^2 + 2 a d - 2 b d + d^2 - 2 c e +
e^2)])/(2 (-2 a b + b^2 + c^2 + 2 a d - 2 b d + d^2 - 2 c e + e^2))},
{x -> (-a (-4 c + 4 e) + Sqrt[
a^2 (-4 c + 4 e)^2 -
4 (2 a b + b^2 + c^2 - 2 a d - 2 b d + d^2 - 2 c e +
e^2) (-2 a b + b^2 + c^2 + 2 a d - 2 b d + d^2 - 2 c e +
e^2)])/(2 (-2 a b + b^2 + c^2 + 2 a d - 2 b d + d^2 - 2 c e + e^2))}}
Checking the solution with the numerical values of Data
gives me the appropriate one.
Second equation direct solution
Mathematica (12.1) seems not to be able to solve the second one directly:
Solve[eq2 == 0, x]
At least not within reasonable time.
Solution attempt
It seems clear that the structure of both equations is similar, only being the complexity of the second greater. I am sure that both of them have solutions, it can be checked using the numerical values I have provided.
So I decided to try and manually solve the first one, i.e. apply the required transformations so that it looks like something easily recognizable (polynomial equation), hoping for it to be handy when solving the second one.
First equation
In order to simplify things, I tried several change of variables, finally finding one suitable for this case:
1/(1 + x^2) -> y, x-> Sqrt[1 - y]/Sqrt[y]
Resulting in:
c - e - 2 a Sqrt[1 - y] Sqrt[y] + Sqrt[2 a - b + d - 2 a y] Sqrt[b - d + 2 a y]
Note: Two equations result depending on positive or negative substitution of x
, I will only show the positive one.
Grouping the radicals on one side and squaring:
(c - e)^2 == (2 a Sqrt[1 - y] Sqrt[y] + Sqrt[2 a - b + d - 2 a y] Sqrt[b - d + 2 a y])^2
c^2 - 2 c e + e^2 ==
2 a b - b^2 - 2 a d + 2 b d - d^2 + 8 a^2 y - 4 a b y + 4 a d y -
8 a^2 y^2 +
4 a Sqrt[1 - y] Sqrt[y] Sqrt[2 a - b + d - 2 a y] Sqrt[
b - d + 2 a y]
And grouping and squaring again:
(c^2 - 2 c e + e^2 - 2 a b + b^2 + 2 a d - 2 b d + d^2 - 8 a^2 y +
4 a b y - 4 a d y + 8 a^2 y^2)^2 == (4 a Sqrt[1 - y] Sqrt[y] Sqrt[
2 a - b + d - 2 a y] Sqrt[b - d + 2 a y])^2
Expanding this result and simplifying, the quartic terms are cancelled out and the resulting equation is a quadratic one:
((b - d)^2 + 2 a (-b + d) + (c - e)^2)^2 -
8 a (2 a - b + d) ((b - d)^2 + (c - e)^2) y +
16 a^2 ((b - d)^2 + (c - e)^2) y^2
Which can be solved easily and the result checked against the numerical values.
Second equation
Due to the complexity of the second equation it is really annoying to do this process manually.
This kind of equations come up quite frequently in the problems I am currently solving, so the question is:
How could I come with a way of automatically solving these equations which all share the same structure but can have different complexity?
Thank you for reading this far.
EDIT 1:
As noted by Bob Hanlon in his answer, both equations are equivalent as they are the solution to almost the same problem through two different paths.
However, using numerical values to solve them is not what I am looking for since the values of these parameters are not constant, they are subject to change in different applications.
Both equations are equivalent due to the topology of this particular problem, but they would not be equivalent in the general case.
EDIT 2:
Is there a way of identifying the radicals on these equations and their coefficients and grouping them together? This would be useful to separate the equation in radical RHS and polynomial LHS and square them independently.
The ideal solution would be to create a function that performs the steps I manually applied to the first equation to any equation with this structure.