Mathematica Asked on April 3, 2021
Let me be try to be highly specific, as my previous attempt How do I suppress an automatic sign change? to pose the question initially had a sign error, and perhaps became a little muddled.
In the course of pursuing the question Evaluate a certain three-dimensional constrained integral, the term (one of 694)
r = (202338335476512488921084723200 x^6 Sqrt[-(-1 + 2 x) (2 - x + 2 Sqrt[1 - x - 2 x^2])]Boole[1/38 (10 - Sqrt[5]) < x <= 1/4])/(319794090309 (723 + 17 Sqrt[5]))
is generated.
My attempt, r/.c, to apply (so the term becomes integrable–as can be checked) the rule (now corrected from earlier version–again, my apologies)
c := Sqrt[-(-1 + 2 x) (2 - x + 2 Sqrt[1 - x - 2 x^2])] -> 1 - 2 x + Sqrt[1 - x - 2 x^2]
fails (because apparently the expression -(-1 + 2 x) is ab initio converted to (1-2 x)).
What needs to be done, so that the intended conversion takes place?
Unfortunately, it would seem the apparent "automatic" conversion of $-(-1 + 2 x)$ to $(1-2 x)$ is not so "automatic" that it is performed in the formula for $r$ itself, which would obviate the apparent dilemma.
This doesn't answer your question, but hopefully provides an alternate approach where you don't need to worry about pattern matching issues when doing replacements. The following function (inspired by chyanog's answer to a related question) is a more programmatic way to denest some radical expressions:
denestSqrt[e_, domain_, x_] := Replace[
y /. Solve[Simplify[Reduce[Reduce[y == e && domain, x], y, Reals], domain], y],
{
{r_} :> r,
_ -> e
}
]
Now, instead of doing the following (and worrying about possible issues with pattern matching due to small differences in the FullForm
):
r /. c
you can do:
r /. Sqrt[s_] :> denestSqrt[Sqrt[s], 1/38 (10 - Sqrt[5]) < x <= 1/4, x]
(202338335476512488921084723200 x^6 (1 - 2 x + Sqrt[1 - x - 2 x^2]) Boole[ 1/38 (10 - Sqrt[5]) < x <= 1/4])/(319794090309 (723 + 17 Sqrt[5]))
Answered by Carl Woll on April 3, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP