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
11 changes: 11 additions & 0 deletions BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,17 @@ a listed index set, and over any other an object whose membership is decided by
| `union({k, 2 k}, k in {1, 2, 3})` | `UnhandledParseException` — `union` was a name, and `union(` a juxtaposition that does not parse | `{ 1, 2, 4, 3, 6 }` |
| `0.1 in intersection([0; 1/n), n in ZZ+)` | `UnhandledParseException` | `False` |
| `complement({1, 2}, {1, 2, 3})` | `UnhandledParseException` | `{ 3 }` |

### An interval whose ends are reversed meets nothing

`(3; 1)` holds no number, and membership in it was decided so, but its meeting with another interval
was the other interval: the intersection returned it where the union rightly does. It is empty
now, and a closed interval at one point meets the other in that point or in nothing.

| Input | Was (2.5.0) | Now |
|---|---|---|
| `"(3; 1) /\ [0; 5]".ToEntity().InnerSimplified` | `[0; 5]` — wrong | `{ }` |

### An exponential of a multiple of a logarithm is integrated as the power it is

`e^(k ln(q))` is `q^k` — the definition of the principal power, for every complex `q` other than
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ B.Left.Evaled is not Real bLeft ||
return A.LeftClosed && B.RightClosed ? new FiniteSet(A.Left) : Empty;
if (bLeft == aRight)
return A.RightClosed && B.LeftClosed ? new FiniteSet(B.Left) : Empty;
// An interval whose ends are reversed holds nothing, and one closed at a single
// point holds that point, so that is what it meets the other in. Returning the other
// interval is what the union does, and is right there: (3; 1) /\ [0; 5] was [0; 5].
if (aLeft >= aRight)
return B;
return aLeft == aRight && A.LeftClosed && A.RightClosed ? IntersectFiniteSetAndSet(new FiniteSet(A.Left), B) : Empty;
if (bLeft >= bRight)
return A;
return bLeft == bRight && B.LeftClosed && B.RightClosed ? IntersectFiniteSetAndSet(new FiniteSet(B.Left), A) : Empty;
if (aLeft > bRight)
return Empty;
if (bLeft > aRight)
Expand Down
11 changes: 11 additions & 0 deletions Sources/Tests/UnitTests/Core/Sets/IntervalAndInterval.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,16 @@ private void CannotSimplify(Entity act)
[Fact] public void Subtraction4() => TestInt(D.SetSubtract(E), (Interval)D);
[Fact] public void Subtraction5() => TestInt(A.SetSubtract(F), Interval(2, true, 3, false));
[Fact] public void Subtraction6() => TestInt(F.SetSubtract(A), Interval(5, false, 6, true));

/// <summary>
/// An interval whose ends are reversed holds nothing: it meets nothing, and adds nothing to
/// a union. The meeting used to be the other interval.
/// </summary>
[Theory]
[InlineData("(3; 1) /\\ [0; 5]", "{}")]
[InlineData("[0; 5] /\\ (3; 1)", "{}")]
[InlineData("(3; 1) \\/ [0; 5]", "[0; 5]")]
public void AReversedIntervalHoldsNothing(string expression, string expected)
=> TestArb(MathS.FromString(expression), MathS.FromString(expected).InnerSimplified);
}
}
Loading