Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@ they had.
| | `"[2; 3] / 2".ToEntity().Simplify()` | `[2; 3] / 2` | `[1; 3/2]` |
| **Silent** | `"[2; 3) * (-1)".ToEntity().Simplify()` | `[2; 3) * (-1)` | `(-3; -2]` — reflected, ends and openness both |
| | `"0 - [0; 1)".ToEntity().Simplify()` | `-[0; 1)` | `(-1; 0]` |
| | `"ln((0; 1))".ToEntity().Simplify()`, and every interval under a function monotone on it — `ln`, `log`, `e^`, `b^`, whole and unit-fraction powers, `abs`, `arctan`, `arcsin`, `arccos` | `ln((0; 1))` — left alone | `(-oo; 0)`; `e^[0; 1]` is `[1; e]`, `(-2; 1]^2` is `[0; 4)`, `abs((-1; 2])` is `[0; 2]`, `arctan([0; 1])` is `[0; pi / 4]`, `sqrt([0; 4])` is `[0; 2]` |
| | `"(1; 2) * (3; 4)".ToEntity().Simplify()`, and every product or quotient of two intervals with finite numeric ends | `(1; 2) * (3; 4)` — left alone | `(3; 8)`; `(1; 2) / (3; 4)` is `(1/4; 2/3)`; a divisor containing zero stays as written |
| | `"2 / (0; 1)".ToEntity().Simplify()`, and every constant over an interval that does not contain zero | `2 / (0; 1)` — left alone | `(2; +oo)` |
| | `"2 * x + 4 * a".ToEntity().Factorize()`, and every sum whose whole coefficients share a divisor | `2 * x + 4 * a` — left alone | `2 * (x + 2 * a)` |
| | `Transformation.Factorization.Name` | `… then polynomial-factorization` | `… then polynomial-factorization then numeric-content` |
| | `"sin(x)^2 + 2 sin(x) + 1".ToEntity().Factorize()`, and every polynomial in one subexpression of its variable | `sin(x) ^ 2 + 2 * sin(x) + 1` — left alone | `(sin(x) + 1) ^ 2`; `sin(x) + sin(x)^3` is `sin(x) * (sin(x) ^ 2 + 1)` |
Expand Down
6 changes: 6 additions & 0 deletions Sources/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed
[AngouriMath/Functions/Continuous/ExtremumOverSet.cs]
file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed under MIT.\nDetails: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.\nWebsite: https://am.angouri.org.\n

[AngouriMath/Functions/IntervalArithmetic.cs]
file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed under MIT.\nDetails: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.\nWebsite: https://am.angouri.org.\n

[Tests/UnitTests/Core/Sets/IntervalImageTest.cs]
file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed under MIT.\nDetails: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.\nWebsite: https://am.angouri.org.\n

[AngouriMath/Functions/Boolean/Quantifiers.cs]
file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed under MIT.\nDetails: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.\nWebsite: https://am.angouri.org.\n

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ protected override Entity InnerSimplify(bool isExact) =>
(var n1, var n2) when n1 == n2 => new Powf(n1, 2).InnerSimplified(isExact),
// After the zero arms above, which answer a multiplication by zero for
// every Entity and not only for an interval.
(Interval one, Interval another) => IntervalArithmetic.Product(one, another, isExact),
(Interval inter, var n2) when n2 is not Set => ScaledInterval(inter, n2, isExact),
(var n2, Interval inter) when n2 is not Set => ScaledInterval(inter, n2, isExact),
_ => null
Expand Down Expand Up @@ -183,6 +184,11 @@ n0.Evaled is Complex c
// and is left alone rather than answered wrongly.
(Interval inter, var n2) when n2 is not Set
=> ScaledInterval(inter, (1 / n2).InnerSimplified(isExact), isExact),
// And the other direction where the divisor does not contain zero, which is
// when its reciprocal is an interval. https://github.com/asc-community/AngouriMath/issues/322
(Interval dividend, Interval divisor) => IntervalArithmetic.Quotient(dividend, divisor, isExact),
(var n1, Interval divisor) when n1 is not Set && IntervalArithmetic.Reciprocal(divisor, isExact) is Interval reciprocal
=> ScaledInterval(reciprocal, n1, isExact),
_ => null
},
(@this, a, b) => ((Divf)@this).New(a, b), isExact);
Expand Down Expand Up @@ -271,6 +277,11 @@ protected override Entity InnerSimplify(bool isExact) =>
(a, b) => (a, b) switch
{
(Matrix m, Integer(var exp)) when exp is { } expNotNull && TryPower(m, expNotNull, out var res) => res.InnerSimplified(isExact),
// An interval raised to a number, and a number raised to an interval, are
// the images of the interval under a monotone function where the function
// is one. https://github.com/asc-community/AngouriMath/issues/322
(Interval interval, var exponent) when exponent is not Set && IntervalArithmetic.Power(interval, exponent, isExact) is { } image => image,
(var @base, Interval interval) when @base is not Set && IntervalArithmetic.Exponential(@base, interval, isExact) is { } image => image,
(Integer(0), var x) =>
(isExact ? x.Evaled : x) is Complex c
? c.RealPart.IsPositive
Expand Down Expand Up @@ -327,6 +338,9 @@ protected override Entity InnerSimplify(bool isExact) =>
(a, b) => (a, b) switch
{
(Complex n1, Complex n2) when !isExact => Number.Log(n1, n2),
// The image of an interval of positive numbers, monotone for any base.
// https://github.com/asc-community/AngouriMath/issues/322
(var @base, Interval interval) when @base is not Set && IntervalArithmetic.Logarithm(@base, interval, isExact) is { } image => image,

// log_b(0) is ln(0)/ln(b), that is -oo/ln(b), so the sign of the answer
// is the sign of ln(b): -oo for a base above 1 and +oo for one between
Expand Down Expand Up @@ -611,6 +625,9 @@ protected override Entity InnerSimplify(bool isExact)
Matrix m when m.IsVector => VectorNorm(m, isExact),
Complex n when !isExact => Number.Abs(n),
Absf abs => abs,
// The interval itself from zero on, its reflection up to zero, and
// folded across zero otherwise. https://github.com/asc-community/AngouriMath/issues/322
Interval interval when IntervalArithmetic.Absolute(interval, isExact) is { } image => image,
// |sgn(z)| has unit modulus wherever z is nonzero and is 0 at zero, the
// same question as sgn(|z|) above and with the same answer. See there for
// why this decides rather than attaching a condition.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ protected override Entity InnerSimplify(bool isExact) =>
{
Complex n when !isExact => Number.Arcsin(n),
{ Evaled: Complex n } when isExact && InverseTrigonometricTableValues.PullArcsin(n, out var res) => res,
// Increasing on [-1; 1]. https://github.com/asc-community/AngouriMath/issues/322
Set.Interval interval when IntervalArithmetic.MonotoneOn(interval, -1, 1, increasing: true, MathS.Arcsin, isExact) is { } image => image,
_ => null
},
(@this, a) => ((Arcsinf)@this).New(a), isExact);
Expand All @@ -211,6 +213,8 @@ protected override Entity InnerSimplify(bool isExact) =>
{
Complex n when !isExact => Number.Arccos(n),
{ Evaled: Complex n } when isExact && InverseTrigonometricTableValues.PullArccos(n, out var res) => res,
// Decreasing on [-1; 1]. https://github.com/asc-community/AngouriMath/issues/322
Set.Interval interval when IntervalArithmetic.MonotoneOn(interval, -1, 1, increasing: false, MathS.Arccos, isExact) is { } image => image,
_ => null
},
(@this, a) => ((Arccosf)@this).New(a), isExact);
Expand All @@ -235,6 +239,8 @@ Real r when r.EDecimal.IsNegativeInfinity() => -MathS.pi / 2,
Integer(1) => MathS.pi / 4,
Integer(-1) => -MathS.pi / 4,
{ Evaled: Complex n } when isExact && InverseTrigonometricTableValues.PullArctan(n, out var res) => res,
// Increasing everywhere. https://github.com/asc-community/AngouriMath/issues/322
Set.Interval interval when IntervalArithmetic.Monotone(interval, increasing: true, MathS.Arctan, isExact) is { } image => image,
_ => null
},
(@this, a) => ((Arctanf)@this).New(a), isExact);
Expand Down
Loading
Loading