AngouriMath
What's new
2.1.0
A correctness release. Almost everything below is a wrong answer becoming a right one, and most of
it was found by harnesses rather than reported — boundary points where a rule's assumption fails,
one child process per case so a stack overflow is a result rather than the end of the run, every
documented code sample compiled and run, and the generated SymPy code executed rather than read.
Every input whose result is now different is listed, with both values and why, in
BREAKING-CHANGES.md
under 2.1.0 — since 2.0.0 — read that before upgrading.
Assembly version stays 2.0.0.0, so this is a drop-in replacement for 2.0.0.
Answers that changed because they were wrong:
arcsin(sin(x))and three siblings no longer cancel off the principal branch:arcsin(sin(3))was3and ispi - 3. Four rules had been wrong since 2020.arctan(x) + arccotan(x)is not alwayspi/2— this library'sarccotanhas range(-pi/2, pi/2], so the sum is-pi/2for negativex.ln(e^x)is no longerx, which is wrong whereverIm xleaves(-pi, pi]: atx = 3*pi*ithe expression ispi*i.log(1, 1)was0and isNaN— it is0/0;log(1, 2)was+oo.abs(sgn(x))andsgn(abs(x))were1, and both are0atx = 0.- A logical connective is no longer strict in
NaN:False and uisFalsefor an operand with no truth value, which is whatSimplifyalready answered while evaluation saidNaN. - A connective over a number now declines instead of reporting the same type error three different ways. A number is not a truth value.
- A conditional set's bound variable was named from a hash of its predicate, which could spell
trueand throw — an intermittent CI failure that would not reproduce.
absfolds where the sign of its argument is known:abs(-sqrt(6))issqrt(6), so a concrete quadratic inequality no longer answers withabs(-sqrt(6)) / 2as an endpoint.-(a - b)is turned round wherever it sits — inside a power, a function's argument or a matrix, not only at the root — andExpanddescends into a matrix. A solved system's entries are shorter for it.NaNis a literal. It printed asNaNand parsed back as a variable of that name, soNaN - NaNwas0.MathS.ToSympyCodeemits Python that runs and stays exact. Any non-integer rational produced aSyntaxError,NaNand the infinities were unbound names, and1/2arrived in SymPy as the float0.5.
lim x->+oo (x^2)^x / e^(2*x*ln(x))andlim x->+oo x^x / e^(x*ln(x) - ln(x))are unevaluated where they used to be answered. They needln(a^c) = c*ln(a), which is false in general; on the way to+oothe base really is positive, and there is currently no way to tell the simplifier so. Unevaluated rather thanNaN, so a caller is told nothing was settled rather than told the limit does not exist.false and 0andtrue or 0wereFalseandTrueby short-circuit. Whether an operand is admissible cannot depend on whether the operator happened to need it.
NaNis a keyword, so it can no longer be a variable name — the same trademodtook in 2.0. Only the exact spelling:NaNxandNaN_1are still variables.
- Measured rather than hoped for: 2.0.0 and 2.1.0 benchmarked minutes apart on one machine and published as a pair. No regression — the largest real move is
SolveMediumat +4.6%, the rest inside ±3%, and allocation is flat with three rows byte-identical.
2.0.0
A major version, so it takes the breaking decisions 1.x could not. Mathematical correctness
comes ahead of backward compatibility here: several of the changes below are a wrong answer
becoming a right one, which still breaks code that depended on the wrong one.
Every input whose result is now different is listed, with both values and why, in
BREAKING-CHANGES.md
— read that before upgrading.
Renames and removals:
LatexiseisLatexize,ILatexiseableisILatexizeable. British spelling is gone from the API.MathS.Quantum.FactoriseisTensorFactorize, one letter away from the unrelatedEntity.Factorizebefore;IsNormalisedisIsNormalized.- The 28 members that carried
[Obsolete]through 1.x are removed. Each obsolete message named its replacement. - The implicit conversions from
Entity[],List<Entity>and(Entity, Entity)toEntityare removed. The list one made everyparams Entity[]overload in the library uncallable with a list. Minusf's fields are named for the right operands at last: it wasSubtrahend - Minuend.- Target frameworks are
netstandard2.0,net8.0andnet10.0;net7.0is gone.
sqrt(x^2)andsqrt(-x)are left as written rather than becomingxandi*sqrt(x), which were wrong for negativex.- Numbers below
1e-16are kept instead of being rounded to0. -7 % 3is2:modtakes the sign of the divisor, as mathematicians, SymPy, Mathematica and Maxima all have it.abs(x) = -1is the empty set, not a set of numbers that do not satisfy it.- An identity equation solves to all of
CC; a numeric root set has one root per root rather than one per starting point. - A quadratic inequality with a symbolic coefficient is right for either sign of it.
- Many limits that answered
NaN— "this does not exist" — now give the value, or say honestly that they could not settle it. - What
Stringizeprints parses back into the expression it printed. It did not for powers, lambdas, applications, piecewises, or complex numbers with a fractional imaginary part.
floor,ceil,round,min,maxandgcdare functions rather than parse errors.roundis half to even.- A transformation layer:
Simplify,Expand,Factorize,Differentiate,IntegrateandLimitare adapters over aTransformationthat carries what it claims about its output and how well justified the claim is. Rewrites can be recorded. - Boolean minimisation, quantum states with tensor factorisation, and a much stronger limit and integration pipeline.
- A syntax reference and an exception reference in the repository.
- Assembly version is pinned at
2.0.0.0for the whole of 2.x, so every 2.x release is a drop-in replacement for a signed-assembly consumer.
- The MyGet per-push feed. Releases publish to NuGet; remove the feed from your
NuGet.Configif you had it.
1.4-preview.4
Kernel functional and C#:
- Simplification a bit improved for sets
- η-reduction added for lambda calculs entities (simplification now triggers beta+eta reduction)
- Bug related to simplification of tangent fixed (it turned NaN when should be 0)
- A few xor simplification patterns thanks DavidBeh
- Now installing only AngouriMath (without interactive) still loads LaTeX in notebooks, thanks new dib kernel extension feature
- Matrix concatenation API
- Polar plot added, thanks cyberillithid
- Sliders for plotting added (2D and 3D)
- Spherical plotting
1.4-preview.3
Kernel functional and C#:
- Imprecise equality from 1.4-preview.2 implemented.
- Added compilation of Piecewise node, thanks @Illuminati-CRAZ.
- Division, logarithm, power, and trigonometric functions experienced a behavioural change: now, they upcast integer types to floating point.
- A few more default variables added to the terminal by default, thanks dogayalcin.
- PeterO.Numbers assembly gets loaded into the terminal too.
1.4-preview.2
Kernel functional and C#:
- Application. It is a node, which represents one expression applied to another one. No parser support yet.
- Built-in functions will now be simplified from application of an expression applied to a known variable, for example, x applied to sin is sin of x. No parser support yet.
- Lambda. This node represents an abstraction working similarly to that in lambda calculus. It has one parameter, and when an expression is applied, this parameter is substituted with this expression. No parser support yet.
- Imprecise equality API added but not implemented.
- Bugs fixed. NaN is now returned when comparing NaN and a number with inequality signs.
- Now there is a package AngouriMath.Experimental.
- Entity, Complex, Real, Rational and Integer implement generic math from .NET 6.
- Fixed bug when crashed on too small sizes.
- Reduced the API calls to OS-unsupported API.
- The terminal is now available as a .NET global tool, see NuGet.
1.4-preview.1
F# and interactive:
-
Added plotting in
AngouriMath.Interactive namespace:Plot.linear ,Plot.scatter for 2D (functions over one variable), andPlot.surface ,Plot.scatter3D for 3D (functions over two variables). See visualization. - Formatters for PeterO Numbers added.
- Terminal repo merged into AngouriMath
- Complete redesign by using Spectre.Console and Radline. See more.
1.3
Kernel functional and C#:
-
No more
Tensor , we only work withMatrix now. - A few synonyms added for hyperbolic functions.
- Greek and cyrillic latters are now parsable. Symbols \n and \s are now ignored by the parser.
- Limits improved.
- Upcasts added to compilation, as well as many overloads and extension methods.
-
Latexise does not produce "\times" anymore (nothing or \cdot instead). It also now produces correct code in case when a variable has an index (both variable and index are latexised properly). - Tensors completely reconsidered. No more vectors or tensors. There are only matrices. Moreover, operators now, instead of being elementwise, are now matrix-meaningful. A vector is considered a one-column matrix. A lot of methods of matrices are now exposed.
- Rank of a matrix, Reduced row echelon form added.
- Max term count increased by a lot. No power limit in the expansion algorithm.
- Parentheses fixed in LaTeX for negative number cases (and negation sign).
-
A couple of bugs related to matrices fixed.
ReducedRowEchelonForm andRank added,GaussianEliminated replaced withRowEchelonForm (here we stick to the definition which implies that leading elements can differ from ones). - Piecewise now works correctly for cases when a node is applied to a whole piecewise.
- Implicit operators improved (one for BigInteger added).
- An important bug related to determinant fixed (determinant, which works via Gaussian elimination, did not take into account the number of swaps performed by the algorithm).
- Inverse and Adjugate are now properties. They do not throw exceptions. Instead, if they cannot be evaluated, a null is returned.
- No matrix division allowed anymore.
-
Taylor expansion of functions of several variables added:
MultivariableTaylorExpansionTerms (infinite generator of terms),MultivariableTaylorExpansion (returns an expression). -
Added a lot of number-theory related methds, mostly in the UnsafeAndInternal and ExperimentalFeatures categories.
Added methods:
SymbolicFormOfSine ,SymbolicFormOfCosine ,ExpandSineOfSum ,ExpandConsineOfSum ,ExpandSineArgumentMultiplied ,ExpandCosineArgumentMultiplied ,GetSineOfHalvedAngle ,GetCosineOfHalvedAngle ,DecomposeRational ,GetSineOfHalvedAngle -
SymbolicFormOfSine andSymbolicFormOfCosine exposed inMathS.Compute . Use them to find the exact form of sines beyond basic table values like pi/3, pi/6, etc. These algorithms can decomposesin(17/42 pi) into the exact analytical form with roots and arithmetical operations only. They return null if cannot expand a sine or cosine into an exact form. -
Explicit parsing is now allowed with
MathS.ExplicitParsingOnly , so that omitted operators are not inserted automatically. -
MathS.Parse returns an Either of a successfully parsed entity or a failure of a few possible reasons of parsing failure. Close to some advanced Result type. -
Bugs related to
- imprecise computing of corner cases of tangent
- allocations on accessing a property
- integral of a piecewise
- F# wrapper significantly improved. Matrices, settings, intervals were added. Naming was reconsidered in favor of declarative programming. It also now has the same versioning as the kernel package.
-
All modules are moved to the
AngouriMath.FSharp namespace. ForInteractive , there is now namespaceInteractive . There is also no need to call magic commands to bind latex to rendering. -
Overload for
** added as a power operator. -
Overload for
***. added as a tensor multiplication. -
Overload for
****. added as a tensor power. -
Interactive.AggressiveOperators module allows for arithmetic operators overloaded for a pair of object and object. The reason is to avoid using additional methods to parse an expression while performing some computations. -
There are now matrix operators, which unconditionally return a matrix.
Here is the list of them:
+. ,-. ,*. ,/. ,**. . Module:AngouriMath.FSharp.MatrixOperators . -
There is also function
asMatrix . - Now there are also operators less, greater, less or equal, greater or equal which create entities.
- Functions det, inverse, adjugate added for matices.
- Conjugate of a complex is now a property.
- All node-creating functions now apply InnerSimplified automatically, unless explicitly specified otherwise.
- Functions to compile expressions added.
- Parsing, to string, latex, basic calculus, solvers, properties are exposed.
- Visit the lab to see samples.
- See the instructions how to get it, if you want to participate in the project or experiment with that.
- Honk# is shipped with AngouriMath instead of FieldCache and a few other packages. Not only some internal functions of AM are rewritten in it, but AM adopts fluent style of using it natively, for example, by having API exposing Either (anonymous type union).
- AngouriMath now multitargets netstandard2.1 (which does not require System.Memory dependency) and .NET Framework 4.7.2 (which also loads such dependencies as System.Numerics), so now it should be more convenient to use from legacy apps.
1.3-preview.4
Kernel functional and C#:
- Implicit operators improved (one for BigInteger added).
- An important bug related to determinant fixed (determinant, which works via Gaussian elimination, did not take into account the number of swaps performed by the algorithm).
- Inverse and Adjugate are now properties. They do not throw exceptions. Instead, if they cannot be evaluated, a null is returned.
- No matrix division allowed anymore.
-
There are now matrix operators, which unconditionally return a matrix.
Here is the list of them:
|+ ,|- ,|* ,|/ ,|** . Module:AngouriMath.FSharp.MatrixOperators . -
There is also function
asMatrix .
- Visit the lab to see samples.
- See the instructions how to get it, if you want to participate in the project or experiment with that.
1.3-preview.3
Kernel functional and C#:
- Max term count increased by a lot. No power limit in the expansion algorithm.
- Parentheses fixed in LaTeX for negative number cases (and negation sign).
-
A couple of bugs related to matrices fixed.
ReducedRowEchelonForm andRank added,GaussianEliminated replaced withRowEchelonForm (here we stick to the definition which implies that leading elements can differ from ones). - Piecewise now works correctly for cases when a node is applied to a whole piecewise.
-
All modules are moved to the
AngouriMath.FSharp namespace. ForInteractive , there is now namespaceInteractive . There is also no need to call magic commands to bind latex to rendering. -
Overload for
** added as a power operator. -
Interactive.AggressiveOperators module allows for arithmetic operators overloaded for a pair of object and object. The reason is to avoid using additional methods to parse an expression while performing some computations.
1.3-preview.2
Kernel functional and C#:
- Upcasts added to compilation, as well as many overloads and extension methods.
-
Latexise does not produce "\times" anymore (nothing or \cdot instead). It also now produces correct code in case when a variable has an index (both variable and index are latexised properly). - Tensors completely reconsidered. No more vectors or tensors. There are only matrices. Moreover, operators now, instead of being elementwise, are now matrix-meaningful. A vector is considered a one-column matrix. A lot of methods of matrices are now exposed.
- C++ wrapper (under development): parsing, to string, latex, basic calculus, solvers, properties are exposed.
- F# wrapper significantly improved. Matrices, settings, intervals were added. Naming was reconsidered in favor of declarative programming. It also now has the same versioning as the kernel package.
1.3-preview.1
- A few synonyms added for hyperbolic functions.
- Greek and cyrillic latters are now parsable.
- Limits improved.
1.2
1.2 brings us incredibly many features, completely reconsidering all patterns. Number of nodes was doubled, a lot of syntax related to solvers, building an expression tree, performance improved.
Not only that, we added AngouriMath.FSharp and AngouriMath.Interactive packages for working in F# and Jupyter respectively.
1.2 is not backward compatible with 1.1.0.5.
We highly recommend reading this if you plan to migrate from 1.1.0.5 to 1.2, as tons of concepts from 1.1.0.5 were reconsidered and rewritten.
General structure
Now there's no operator's name. Moreover, there's no operator anymore. There are records for each separate
logical action, be than a sum operator or sine function. They all are inside
Active functions like renamed
ToSymPy fixed, as well as many other bugs. Solvers and simplificators improved.
Math features
How the math of AM is improved.
Secant, Cosecant, Arcsecant, Arccosecant
Are now available as nodes with the obvious syntax and their synonyms.
Secant:
Cosecant:
Arcsecant:
Arccosecant:
Hyberbolic trigonometric functions
All trigonometric functions (sin, cos, ..., arcsecant) now have their "-h" pair. For example,
Abs and Signum and Phi nodes
Abs always returns a real non-negative number for a numerical argument. Signum always returns a complex number such that its absolute value is 1 for a numerical argument. One exception for signum is 0: for 0 it returns 0. Phi returns an integer (where Phi is the Euler's totient function).
Syntax for abs:
Syntax for signum:
Syntax for phi:
Domains
Now every node is constrained within a domain. This init-get-only property is called
Syntax:
Note: since domain is not a node, it is true that
Boolean algebra
Now there are many boolean operators added and they are nodes. Instead of
Available operators and their syntaxes:
Syntax of boolean constants:
Equality and inequality nodes
Those return a
Syntax for equal, greater, less, greater or equal, less or equal:
There's also compositional syntax separately for inequalities and inequalities, e. g.
Sets
Sets are now entities. There're
Syntax for finite set:
Syntax for interval:
Syntax for SpecialSet:
Syntax for ConditionalSet:
The
Limits improved
Added some patterns for non-defined expressions, for instance, the first and the second
remarkable limits and a few more. L'Hopital's rule added as well.
Provided
Provided is a node, which turns into NaN if the predicate is false, turns into Expression if the predicate is true. For example,
you may write
Exception: when a provided is in a finite set. Then,
Syntax:
Piecewise
Piecewise-defined functions are finally added too. They allow you to define conditions under which different expressions will be substituted. For example, that is how we can define abs function for real x:
Entity abs = "piecewise(x provided x > 0, -x provided x <= 0)";
WriteLine(abs.Substitute("x", 3).EvalNumerical());
WriteLine(abs.Substitute("x", -3).EvalNumerical());
When a piecewise takes part in an expression, the expression will usually be expanded to piecewise, for example,
piecewise(a provided b, c provided d, ...) + 3
->
piecewise(a + 3 provided b, c + 3 provided d, ...)
IMPORTANT. The definition of AM's piecewise differs from the classical one. For the classical math one, piecewise turns into some case if this case's condition is true and all others are false. In AM's definition, piecewise turns into some case if this case's condition is true and all those *before* the considered case are false.
Syntax:
Industrial features
Features, related to industrial integration, production, researches. Usually, improved convenience or stability.
Ultimate exception class added
It is called
Performance improved
F# in AngouriMath
Now you can work with AngouriMath from F# without writing your own wrapper and work with AM's types directly. Check samples
and readme to get more information
Interactive
Now you can work in Jypyter with expressions being rendered directly to the output. See samples and readme for more information
Multithreading
Some methods like
New settings
Now, you don't have to pass a lambda. Instead, use syntax
using var _ = MaxExpansionTermCount.Set(10);
// do what is needed
1.2-preview.6
Multithreading, casts for numbers added. AngouriMathBaseException is now root of all AM's exceptions. FieldCache moved to alpha.3, which is strongly named1.2-preview.5
Hyberbolic functions are now parsable, Phi node added, a few vulnerabilities fixed1.2-preview.4
A few security issues fixed, a few simple rules added, sorter refactored, ToSymPy fixed, Arcsecant & Arccosecant1.2-preview.3
Derive -> Differentiate, now all calculus functions apply InnerSimplified automatically, naive set solver, bugs fixed1.2-preview.2
A lot of patterns for sets added, bugs fixed, extensions for integrate, limit added1.2-preview.1
Sets, domains, booleans, signum and abs1.1.0.5
Limits improved & some bugs fixed & nodes for limits, derivatives, integral1.1.0.4-beta
Limits & gamma & factorial1.1.0.1
Bugs fixed + smart expansion + solver improved + EDecimal and EInteger instead of decimal and BigInteger1.1.0
Added Numerix module, and this version is not compatible to all previous versions, migrate changes see in https://github.com/asc-community/AngouriMath/blob/master/CHANGELOG.md1.0.20
Added Tensor, system of equations, polynom divisions, periodic roots for solvers, compilation boosted, simplification improved, LaTeX formatting improved, cache for compiled functions added, search boosted, tons of bugs fixedAngouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1953 pages online