mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-26 01:13:48 +00:00
Upgraded AngouriMath to v2.8.0 (#1235)
This commit is contained in:
1 parent
fae3ceb840
commit
506c06fbfc
24 files changed
+974
-105
No files matched your search
@@ -122,7 +122,7 @@ public sealed class CalculateToolTests
|
||||
var simplifiedToZero = Calculate("1e-2000 * pi");
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(RelativeError(quotient, "3.14159265358979323846264e-200"), Is.LessThan(1e-19), "AngouriMath rounds a quotient to decimal places, so the precision grows until the value shows.");
|
||||
Assert.That(RelativeError(quotient, "3.14159265358979323846264e-200"), Is.LessThan(1e-19), "Up to version 2.6.0, AngouriMath rounded a quotient to decimal places, so the precision grows until the value shows.");
|
||||
Assert.That(simplifiedToZero.ContainsKey("exact"), Is.False, "AngouriMath simplifies the value to 0, see AngouriMathBehaviorTests.DowncastingWhileParsingLosesTinyLiterals.");
|
||||
Assert.That(RelativeError(simplifiedToZero, "3.14159265358979323846264e-2000"), Is.LessThan(1e-19));
|
||||
Assert.That(Text(photon, "decimal"), Is.EqualTo("3.9728917142978574e-19"));
|
||||
@@ -240,6 +240,32 @@ public sealed class CalculateToolTests
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ComputesTheSpecialFunctionsWhichSolvingAndIntegratingReturn()
|
||||
{
|
||||
// The references are those of Python's decimal module:
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(RelativeError(Calculate("lambertw(0, 2)"), "0.85260550201372549134647241469531746689845330015140"), Is.LessThan(1e-19), "W(2) solves w * e^w = 2.");
|
||||
Assert.That(RelativeError(Calculate("productlog(2)"), "0.85260550201372549134647241469531746689845330015140"), Is.LessThan(1e-19));
|
||||
Assert.That(RelativeError(Calculate("gamma(2, 1)"), "0.73575888234288464319104754032292173489162226206354"), Is.LessThan(1e-19), "gamma(2, 1) is 2/e.");
|
||||
Assert.That(RelativeError(Calculate("polygamma(1, 1)"), "1.64493406684822643647241516664602518921894990120680"), Is.LessThan(1e-19), "polygamma(1, 1) is pi^2/6.");
|
||||
Assert.That(RelativeError(Calculate("integral(lambertw(0, x), x, 0, 1)"), "0.33036612476168058323"), Is.LessThan(1e-12), "The integrand compiles; the integral is W(1) - 2 + 1/W(1).");
|
||||
Assert.That(Refusal("polygamma(101, 2)"), Does.EndWith("so the order is limited to 100."));
|
||||
Assert.That(Refusal("gamma(1/2, 10^4)"), Does.EndWith("so the absolute value of z is limited to 1,000."));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RefusesAnIntegrandWithoutValuesPointByPointInItsOwnWords()
|
||||
{
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
foreach (var integral in new[] { "integral(gamma(2, x), x, 0, 1)", "integral(derivative(sin(x)*x, x), x, 0, 1)", "integral(limit(sin(x*t)/t, t, 0), x, 0, 1)" })
|
||||
Assert.That(Refusal(integral), Does.EndWith("cannot be evaluated point by point, which a numerical integration needs, e.g., since it holds gamma(a, z), a derivative, or a limit."), integral);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RefusesAnIntegralItCannotIntegrate()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user