AngouriMath
AngouriMath.Functions
Classes within the AngouriMath.Functions namespace
BaseConversion
ExpressionNumerical
Fraction
InverseTrigonometricTableValues
Summary
The trigonometric tables read backwards: given a value, the angle in the principal
range whose sine or tangent it is.
https://github.com/asc-community/AngouriMath/issues/569
https://github.com/asc-community/AngouriMath/issues/179
MonomialOrder
Summary
Which monomial is the leading one.MultivariatePolynomial
Summary
A polynomial in several variables over the rationals, stored sparsely.
Remarks
The coefficient domain is deliberately only Q . A polynomial whose
coefficients are arbitrary expressions is not one this can reason about: deciding
whethersqrt(2) - a is zero is as hard as the problem that sent us here, and
a divisor wrongly believed nonzero produces a wrong cancellation rather than a
missing one. Anything outsideQ is refused at the door by
TryParse(AngouriMath.Entity,System.Collections.Generic.IReadOnlyDictionary{AngouriMath.Entity.Variable,System.Int32}).
An exponent vector is packed into one UInt64, a byte to a variable,
the first variable in the most significant byte. Comparing packed monomials is then
exactly the lexicographic order on exponents that DivideExact(AngouriMath.Functions.MultivariatePolynomial) needs,
and looking a monomial up costs one hash.
This and its neighbours in Functions/Algebra/Polynomials are kernel algebra:
the solvers, the evaluator and the simplifier all depend on them, and they depend on
none of those. That direction is the point of the folder. PolynomialGcd in particular is reached from simplification, fromCore/Transformations and
from evaluation, which is why it lived underFunctions/Simplification for as
long as simplification was the only caller anybody had counted.
Partial so that the operations only a Gröbner basis needs — monomial divisibility, an
order other than lexicographic, reduction against a set — live beside the solver that
wants them, inFunctions/Algebra/Groebner , rather than here where every other
caller would have to read past them. SeeMultivariatePolynomial.Groebner.cs .
Patterns
PolynomialFactoring
Summary
Factors a polynomial in one variable into linear factors with whole roots:
x^2 + 2x + 1 becomes(x + 1)^2 , and
x^3 - 6x^2 + 11x - 6 becomes(x - 1)(x - 2)(x - 3) .
Remarks
Deliberately narrow, on two counts.
Rational roots only. Factoring through every root would answer
(x - i)(x + i) forx^2 + 1 and(x - sqrt(2))(x + sqrt(2)) for
x^2 - 2 , which is not what anyone means by factoring those.
And only when the polynomial splits completely into whole roots. A partly factored
answer is not obviously better than the sum it came from, and fractional roots turn
up mostly in the output of calculus, where the expanded form is the conventional
one: the antiderivative ofx^2 + x reads better asx^3/3 + x^2/2 than
asx^2 * (x + 3/2) / 3 .
What comes out of here is a candidate, not a decision. The simplifier keeps it
alongside the other forms it has found and picks between them by its complexity
metric, which is whyx^2 - 1 stays as it is while(x + 1)^2 wins.
PolynomialGcd
Summary
The greatest common divisor of two polynomials in several variables over the
rationals, and the cancellation of a quotient that it makes possible:
(x^2 + 2xy + y^2) / (x^2 - y^2) is(x + y) / (x - y) (#55).
Remarks
A polynomial in several variables is a polynomial in one of them whose coefficients
are polynomials in the rest, so the algorithm is the univariate one applied down a
recursion on the variable count. What it cannot be is the plain Euclidean algorithm
over that coefficient ring: pseudo-division multiplies through by the leading
coefficient every step, and the coefficients of the remainder sequence then grow
exponentially in the degree. The classic example is Knuth's, where two degree-8
polynomials over the integers produce a remainder with a coefficient near 10^35.
Two things keep that in hand, and both are needed. The greatest common divisor
splits as the gcd of the contents times the gcd of the primitive parts, because the
content carries everything free of the main variable and the primitive parts carry
nothing of it; so the content is taken out first, recursively, in one variable
fewer. And within the remainder sequence the subresultant coefficients are divided
out at each step — that division is exact, since what is left is a subresultant, and
it is what turns exponential growth into linear. Knuth, TAOCP vol. 2,
§4.6.1, algorithms C and E; Geddes, Czapor and Labahn, Algorithms for Computer
Algebra, §7.3.
Nothing here trusts the result of that machinery. The divisor it computes is
divided out of both sides and multiplied back, and the quotient is only used when
both come out equal to what they started as. A divisor that is merely common and
not greatest costs an incomplete cancellation; one that is not a divisor at all
would be a wrong answer, and is the thing the check is there to stop.
RootExtraction
Summary
Writes a rational raised to a rational power as a whole part times a radical that has
nothing left to give up, so that sqrt(12) is 2 * sqrt(3) and sqrt(1/2) is sqrt(2) / 2.
https://github.com/asc-community/AngouriMath/issues/281
Simplificator
TreeAnalyzer
TrigonometricAngleExpansion
TrigonometryTableValues
Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1953 pages online