From the determinant of a matrix $\mathbf M$, I derive a symbolic expression of a polynomial say for example, 1 + a*x^2 + b*x^4 + Sqrt[a^2 - (x + c)^2] - Sqrt[a^2 - (x - c)^2] == 0
. (My actual equation is far more complex than that) The obvious way to eliminate square roots manually is to shift to right hand side the sqrt term and square both side, rearrange and repeat until the all square root terms vanish. This way we preserve equation without any limit approach. Does Mathematica have a function for this?
You can use Eliminate
for this. Include auxiliary variables s1
and s2
, and then eliminate them:
Eliminate[
{1 + a x^2 + b x^4 + s1 - s2 == 0, s1^2 == x^2 + c, s2^2 == x^2 - c},
{s1, s2}
]
-1 + 4 x^2 - 4 a x^2 + 8 a x^4 - 6 a^2 x^4 - 4 b x^4 + 4 a^2 x^6 - 4 a^3 x^6 + 8 b x^6 - 12 a b x^6 - a^4 x^8 + 8 a b x^8 - 12 a^2 b x^8 - 6 b^2 x^8 - 4 a^3 b x^10 + 4 b^2 x^10 - 12 a b^2 x^10 - 6 a^2 b^2 x^12 - 4 b^3 x^12 - 4 a b^3 x^14 - b^4 x^16 == 4 c^2
An alternative usually suggested by @DanielLichtblau is the use of GroebnerBasis
:
GroebnerBasis[
{1 + a x^2 + b x^4 + s1 - s2, s1^2 - x^2 - c, s2^2 - x^2 + c},
x,
{s1, s2}
]
{1 + 4 c^2 - 4 x^2 + 4 a x^2 - 8 a x^4 + 6 a^2 x^4 + 4 b x^4 - 4 a^2 x^6 + 4 a^3 x^6 - 8 b x^6 + 12 a b x^6 + a^4 x^8 - 8 a b x^8 + 12 a^2 b x^8 + 6 b^2 x^8 + 4 a^3 b x^10 - 4 b^2 x^10 + 12 a b^2 x^10 + 6 a^2 b^2 x^12 + 4 b^3 x^12 + 4 a b^3 x^14 + b^4 x^16}
-
$\begingroup$ I just corrected my question. Typo mistake. But I think I know how to modify your solution. My apologies. $\endgroup$ – Aschoolar Jun 20 '17 at 14:56
-
$\begingroup$ in case if
Eliminate
works, is there a way to remove '==' sign from results, so that its results can be used further for calculations? $\endgroup$ – Aschoolar Jun 20 '17 at 15:01 -
$\begingroup$ I wish I understood what
GroebnerBasis
is. It seems like a powerful function, but I don't know how to use it to solve problems... $\endgroup$ – QuantumDot Jun 21 '17 at 1:58 -
$\begingroup$
GroebnerBasis[]
can actually handle the expressions with square roots, but you need to pick out the desired expression from the results:Select[GroebnerBasis[1 + a*x^2 + b*x^4 + Sqrt[a^2 - (x + c)^2] - Sqrt[a^2 - (x - c)^2], x], FreeQ[#, Power[_, _Rational]] &]
. @Quantum, it's basically a generalization of Gaussian elimination. See this math.SE question, or read Cox/Little/O'Shea for an intro. $\endgroup$ – J. M.'s ennui♦ Jul 30 '17 at 20:31
Sqrt[x^-c]
is non-syntactic. $\endgroup$ – David G. Stork Jun 19 '17 at 16:09