AngouriMath.Functions.Algebra.AnalyticalSolving
Classes within the AngouriMath.Functions.Algebra.AnalyticalSolving namespace
AnalyticalEquationSolver
AnalyticalInequalitySolver
ArctangentSolver
Summary
An equation linear in arctangents of polynomials or quotients of polynomials,
m_1 arctan(a_1) + ... + m_n arctan(a_n) = c with integerm_j and at least two
arctangents, solved by taking the tangent of both sides.
Remarks
WriteA for the sum of the arctangents. Sincecos(arctan a) = 1 / sqrt(1 + a^2) is never zero,e^(i A) divided by the product of the cosines is the product of the
1 + i a_j , each to itsm_j ; as polynomials,P + i Q . Then
Q cos c - P sin c issin(A - c) divided by that product, which holds for complex
a_j as well, so the polynomial equationQ cos c = P sin c has every root of the
original and no root is lost. It also has the roots ofA = c + k pi for every other
integerk , so each candidate is put back into the equation as written, under the
principal arctangent, and kept only where it holds.arctan(x) + arctan(2x) = pi/4 is
3x = 1 - 2x^2 , whose roots are(-3 +- sqrt(17)) / 4 ; at the negative one the
sum is-3 pi / 4 , so the answer is{ (sqrt(17) - 3) / 4 } . Newton's method
answered these in decimals, andarctan(x) - arctan(2x) = 1 , whose roots are complex,
not at all.
CommonDenominatorSolver
ExponentialSolver
FactorialSolver
Summary
c (x + k)! + P(x) = 0 , withc a rational that is not zero,k a whole
number andP a polynomial overQ : its whole roots, exactly, and the rest of
its roots left as the equation.gamma(x + k) is(x + k - 1)! , so this is the
gamma function's equation as well. https://github.com/asc-community/AngouriMath/issues/2538
Remarks
Where P is not 0 there are infinitely many roots, so no finite set is the answer.
The factorial has a pole at each negative whole number and tends to the same infinity on
both sides of the interval between two of them, while the least of its size there tends
to 0; on every other such interval far enough out, its sign is the sign of
-P / c there, so the equation changes sign twice in it.x + x! = x^3 has
two real roots in each of (-4, -3), (-6, -5), (-8, -7) and so on, and Newton's method,
started inside [-10, 10]^2, answered 13 decimals without -3.0200.
The whole roots are found by trying each whole number from the first at which the
factorial is defined, exactly, and the search ends with a proof that no larger one is a
root. Forn >= 1 ,|P(n)| <= S n^d , whered is the degree and
S the sum of the sizes of the coefficients. Forn >= d ,
((n + 1) / n)^d <= (1 + 1/d)^d < 3 , so once(n + k)! >= 2 as well,
a step multiplies the factorial byn + k + 1 >= 3 and the bound by less. The
firstn past both at which|c| (n + k)! > S n^d is therefore the last
one there is any need to try.
FractionedPolynoms
InverseTrigonometricPairSolver
Summary
An equation between two inverse trigonometric functions of polynomials,f(u) = g(v) or
f(u) = -g(v) , solved by a polynomial equation in their squared sines and cosines.
Remarks
sin(f)^2 cos(g)^2 - cos(f)^2 sin(g)^2 issin(f - g) sin(f + g) , so it is zero
whereverf = g orf = -g . For each of the six functions the squared sine and
cosine are rational in the argument, and polynomial once a factor that is never zero where the
function has a value is taken out:arcsin(u) givesu^2 and1 - u^2 ,
arctan(u) givesu^2 and1 over1 + u^2 . So the polynomial
equation has every root of the original. It also has the roots off = +-g + k pi , so
each candidate is put back into the equation as written, under the principal branches, and
kept only where it holds.arcsin(-2x) = arccos(3x + 2) is13x^2 + 12x + 3 = 0 ,
both of whose roots hold. Newton's method answered these with the roots it found, which left
out complex ones.
LambertWSolver
Summary
K (alpha x + beta) b^(gamma x + delta) = c , a linear function times an exponential of
another, solved by the Lambert W function, and an exponential equal to a line, which is that
product written as a sum. https://github.com/asc-community/AngouriMath/issues/2182
Remarks
Writtene^((gamma x + delta) ln b) , the exponent isu = g x + d , and with
s = beta g / alpha - d the equation is(u + s) e^(u + s) = A ,
A = c g e^s / (K alpha) , sou + s = W(A) andx = W(A) / g - beta / alpha .
Over the complex numbers every branch is a root,W_n for a wholen , as a periodic
equation's roots are written. Over the reals two branches can be:W_0 where
A >= -1/e andW_(-1) where-1/e <= A < 0 , and none where
A < -1/e , sincew e^w >= -1/e for every realw .
LinearSystemSolver
Summary
A linear system with fewer equations than unknowns, answered as the family of all its
solutions: the unknowns a row reduction leaves free become parameters, and the rest are
written in terms of them.
#212Remarks
2x - 4y = 12 forx andy is the issue's own example. It has
infinitely many solutions and one degree of freedom, so the answer is a single row
[12/2 + 2t, t] rather than a list of them, and thet in it is a variable
the caller did not name.
The answer type did not need changing, which is why this is small. A solution is a
row of Matrix whose i-th entry is the i-th unknown's value, and nothing
says those entries may not mention a variable. The same device already carries the
constant of integration out of the ODE solver, and
InSolveSystem(System.Collections.Generic.List{AngouriMath.Entity},System.ReadOnlySpan{AngouriMath.Entity.Variable},AngouriMath.Entity,AngouriMath.Core.Budgets.BudgetLedger) already mints onet for the single case
where its recursion bottoms out unconstrained
(#550).
Reached only where the count is short, which is the one shape that had no answer
at all —SolveSystem threwWrongNumberOfArgumentsException for it before
reaching any elimination. A square system that is rank-deficient is left to the
eliminator, which already answers it; taking those here as well would change answers that
are not wrong.
Rational coefficients on the unknowns, and that is a soundness requirement rather than
a convenience. Row reduction has to decide whether a pivot is zero, and the general
test available here is structural —Matrix.ReducedRowEchelonForm asks
a == 0 , which an expression that is zero everywhere without being written as
0 fails. Choosing such a pivot divides by zero and produces a wrong family rather
than no answer. Over the rationals the question is decidable, so it is asked there. The
constant term is under no such restriction: it is never a pivot, so
2x - 4y = k is answered withk symbolic.
LogarithmSolver
Summary
An equation linear in logarithms of polynomials to one base,
k_1 log_b(P_1) + ... + k_n log_b(P_n) = c with rationalk_i and at least two
logarithms, solved by exponentiating.
Remarks
Every root makesb to either side the same, so it is a root of
P_1^(k_1 L) ... P_n^(k_n L) = b^(c L) , forL the common denominator of the
k_i : a polynomial equation, with finitely many roots, which holds at every root of the
original. The converse does not hold. Over the complex numberslog(u) + log(v) is
log(u v) only up to a multiple of2 pi i , and a factor can be zero, so each
candidate is put back into the equation as written, under the principal logarithm, and kept
only where it holds.ln(x) + ln(x + 1) = 0 isx (x + 1) = 1 , whose roots are
(-1 +- sqrt(5)) / 2 ; at the negative one both logarithms carryi pi and their sum
is2 pi i , so the answer is{ (sqrt(5) - 1) / 2 } . Newton's method answered it
in decimals, andln(1 + 3x^2) - ln(4x) = 1 with one of its two roots.
ModulusSolver
Summary
Equations in moduli: where one is real for every complexx , how one in moduli of
polynomials is solved over the reals, and how one in and out of moduli, conjugates, real
and imaginary parts is solved over the complex numbers.
Remarks
Over the complex numbers|x - 2| = |x - 3| holds on the whole line
Re x = 5/2 : both sides are real whateverx is, so the equation is one real
condition on the two real unknownsx is made of, and what solves it is a curve. A
numerical search finds points of it and would answer them as the set. Over the reals the
same equation isx = 5/2 , found by cases: between two neighbouring kinks every
modulus has one sign, and the equation there has no moduli.
https://github.com/asc-community/AngouriMath/issues/1573
NonSquareSystemSolver
Summary
A system with more or fewer equations than unknowns that neither the triangularisation nor
LinearSystemSolver takes, such asx^2 + y^2 = 1 forx and
y , orsin(x) = 0 andx = 0 forx . Each unknown is eliminated in
turn, an unknown that nothing is left to constrain becomes a parameter, and every family
found is substituted back into every equation.
#212Remarks
An answer is given only where it is shown to hold. The elimination trusts each solve
it makes, and a solve can answer for a case its equation does not cover. So each family is
kept only where every equation, with the family substituted, simplifies to0 . A family
that says where it holds is checked there:sqrt(y) = x is solved fory as
x^2 providedx is wheresqrt takes its values, andsqrt(t^2) - t is zero wherever that holds.
A decline declines the whole system. An equation left with no unknown in it is zero,
a number away from zero, or neither as far as can be told, like(a + b)/2 - c . A
branch where one is away from zero has no solutions and is dropped. A branch where one
cannot be told gives no answer for the system, rather than leaving the other branches to
read as all of its solutions.
A square system does not come here. It is the eliminator's in
InSolveSystem(System.Collections.Generic.List{AngouriMath.Entity},System.ReadOnlySpan{AngouriMath.Entity.Variable},AngouriMath.Entity,AngouriMath.Core.Budgets.BudgetLedger), whose answers this would change.
PolynomialCandidates
Summary
The roots of an equation in inverse functions, from a polynomial equation that has every one
of them and possibly more.
PolynomialSignTable
Summary
p(x) > 0 for a univariate polynomial overQ of any degree, answered by
the sign ofp between consecutive real roots.
Remarks
A polynomial has one sign on each open interval between consecutive real roots, so the
answer is the union of those intervals where the sign is positive. Everything hard is
in the word *consecutive*: the intervals are only the answer if the list of real roots
is complete, and a missed root merges two intervals of opposite sign into one
and reports the wrong half of it as the solution. So this refuses wherever completeness
cannot be established, rather than answering from whatever roots were found.
Completeness is established algebraically and in two steps. First
FactorPrimitive(AngouriMath.Functions.IntegerPolynomial) writes the polynomial as a
product of powers of irreducibles overQ , and it verifies that the factors
multiply back to what it was given — so every real root of the whole is a real root of
exactly one factor, an irreducible being square-free and two distinct irreducibles
being coprime. Second, the number of real roots of each factor is read off its
Discriminant(AngouriMath.Functions.MultivariatePolynomial,System.Int32,System.Collections.Generic.IReadOnlyList{System.Int32}): a factor of degree two has two real
roots where its discriminant is positive and none where it is negative, and one of
degree three has three and one respectively. A factor of degree four needs two more
quantities alongside the discriminant, and there is no such criterion at five — nor a
formula for the roots — which is where this stops. That count is what makes a root
list a complete root list rather than a list of the roots that happened to come back.
The roots themselves come from the solver reached through SolveEquation ,
which is exact, and their order is decided numerically, which is not. So the
ordering is checked rather than trusted: the sign of the polynomial at an exact
rational point in each interval is computed in exact integer arithmetic, and the
resulting sequence has to change sign at every root of odd multiplicity and keep it at
every root of even multiplicity. A misordered or merged root shows up as a sequence
that does not, and is refused. The two outermost sample points are placed beyond
Cauchy's bound, so no root can lie outside the sampled range.
Part of the polynomial layer of
#746, item 43 —
and the consumer that the resultant was waiting for.
PolynomialSolver
Summary
Solves all forms of Polynomials that are trivially solvedSolutionParameters
Summary
The parameters a solve brings into its answer --n_1 for a whole number of periods,
t_1 for an unknown nothing constrains,r_1 for an argument -- each minted here
with the set it ranges over, so that the set is said where the parameter is made and not
read back from its name.
#212Remarks
While a system is being solved a scope is open, and within it one name stands for one
set: a name already minted for another set is passed over for the next free one, so a
t fromfloor(x) = 1 , which ranges over[0, 1) , and thet of
an unknown left free are never botht_1 in one answer.
Outside a scope, as in the solve of one equation, minting is
CreateUnique(AngouriMath.Entity,System.String) and nothing more. A scope is a thread-static pointer
read once per parameter minted; the solve it covers is synchronous.
StatementSolver
ThresholdSearch
Summary
{ n in ZZ : 2^n > n^2 } , an inequality with an exponential or a factorial over
the whole numbers, is searched over a window from the least member and its tails are
proved: the members are the points of the window where it holds, and the whole numbers
from the start of the final run where the quantifier decides it holds there -- by
induction, which is how Sullivan and Mackey do it (Ex 5.3.2:{0, 1} \/ ZZ /\ [5; +oo) ).
OverZZ the other tail is proved the same way, downwards. A tail the quantifier
leaves undecided leaves the set as written: a window is evidence about the window.
https://github.com/asc-community/AngouriMath/issues/1409
TrigonometricSolver
Angouri © 2019-2026 · Project's repo · Site's repo · Octicons · Transparency · 6091 pages online