AngouriMath

Navigation

← Back to list of members

DenestRadical​(AngouriMath.​Entity)

 Method (no overloads)

Summary

sqrt(a + b*sqrt(c)) written without the nesting, as sqrt(x) +- sqrt(y),
or null where it has no such form.

Remarks

Squaring sqrt(x) + sqrt(y) gives x + y + 2*sqrt(x*y), so matching it
against a + b*sqrt(c) asks for x + y = a and 4*x*y = b^2*c —
which makes x and y the two roots of t^2 - a*t + b^2*c/4, namely
(a +- sqrt(a^2 - b^2*c))/2. They are rational exactly when
d = a^2 - b^2*c is the square of one, and that is the whole test: a decidable
question in exact arithmetic rather than a search.
The sign of b chooses between the two forms. Squaring gives
a + |b|*sqrt(c) whichever way, since 2*sqrt(x*y) is not negative — so a
negative b is the difference sqrt(x) - sqrt(y), which needs
x >= y and gets it, sqrt(d) being non-negative.
Every condition reduces to two. The identity needs x and y non-negative and the radicand itself non-negative; given a >= 0 and
d >= 0, all of them follow — sqrt(d) <= a makes y non-negative, and a - |b|*sqrt(c) >= 0 is d >= 0 restated. So the rule
asks for a non-negative a and a d that is a rational square, and needs
nothing else.
Returns null rather than the input where it does not apply, so the rule does not fire
and the rewriting terminates — the same contract as
ReduceRadical(AngouriMath.Entity.Number.Integer,AngouriMath.Entity.Number.Rational) above.

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 4378 pages online