AngouriMath

Navigation

← Back to list of members

CanHaveARealRoot​(AngouriMath.​Entity.​Number.​Complex,​PeterO.​Numbers.​EInteger)

 Method (no overloads)

Summary

Whether FindGoodRoot(AngouriMath.Entity.Number.Complex,AngouriMath.Entity.Number.Integer) can return anything at all for this base and
root power, asked before it runs so that its cost is only paid where its answer
can be used.

Remarks

It answers with a Real, and a negative real has no real root of even
order — for real x and even q, x ^ q is never negative — so
every even root of it lies off the real line and the search is a certain miss.
It is not a cheap miss. The search computes all q roots to the full decimal
precision and attempts a rational conversion of each part of each, which is 7.5 ms
of the 12.6 ms that evaluating sqrt(-pi) used to cost. What makes that reach
a caller is that Simplify asks for the value of the same expression dozens of
times over — each rewrite hands it a freshly built node, whose cached value is not
the previous node's — so Simplify("sqrt(-pi)") spent 556 ms returning its
argument unchanged, and spends 232 ms now.
#975
A non-real base is left to the search rather than excluded here. A complex number
has no real root either, but a real one whose imaginary part is a rounding artefact
arrives as Complex, and this is a performance guard rather than the
place to decide what such a number is.

























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