Found by running the samples in #846 rather than only building them.
Measured
integral accepted three arguments in 1.3.0 and has thrown since 1.4.0. derivative still accepts three. Each row is the published package, parsed in its own process:
| version |
integral(sqrt(x)/a, x, 1) |
derivative(sqrt(x)/a, x, 1) |
| 1.3.0 |
accepted, reads as integral(sqrt(x)/a, x) |
accepted |
| 1.4.0 |
FunctionArgumentCountException |
accepted |
| 2.0.0-preview.1 |
FunctionArgumentCountException |
accepted |
integral should have exactly 4 arguments or 2 arguments but 3 arguments are provided
So this is a 1.4.0 change, not a 2.0 one, and it is in the current released version today.
Two things follow
It went out undocumented. BREAKING-CHANGES.md begins at "2.0.0 (unreleased) — since 1.4.0", so a break introduced by 1.4.0 has no home in it. Anyone who upgraded 1.3.0 → 1.4.0 with a three-argument integral in a parsed string got an exception with nothing to point them at. That is worth a line somewhere even now, since 1.4.0 is what dotnet add package still installs.
integral and derivative now disagree. They are the same shape of operation and read the same way:
derivative(f, x, 2) // second derivative -- accepted
integral(f, x, 2) // second antiderivative -- throws
The likely reason is that integral grew the definite form integral(f, x, from, to), and 2-or-4 was chosen to keep the grammar unambiguous — three arguments sits between them. That is a defensible reason for the restriction; it is not a reason for the two functions to differ, and nothing says so anywhere a caller would look.
Why it stayed invisible for seven months
SampleNet5 and FSharpSample both call integral(f, x, 1). They were pinned to AngouriMath 1.3.0, so they kept compiling and running against a version that still accepted it. Nothing in CI builds or runs the samples. #846 moves them onto ProjectReference, which is what surfaced this.
No unit test covers a three-argument integral either, in any direction — neither that it works nor that it throws. The change has no test recording that it was intended.
What to decide
- Restore three-argument
integral as the n-th antiderivative, matching derivative. Additive, so 2.1 rather than 2.0.
- Keep the restriction and remove
derivative's three-argument form so the two agree. Breaking, so 2.0 or never.
- Keep both as they are and document the asymmetry, in
Syntax.md and in the exception message, so a caller hitting it is told which arities exist and why.
Option 3 is the cheapest and is worth doing regardless of 1 or 2 — the exception already names the accepted counts, and Syntax.md should agree with it. My weak preference beyond that is option 1, because a caller who writes integral(f, x, 2) after writing derivative(f, x, 2) is not making a mistake, they are generalising correctly from the neighbouring function.
Whichever way it goes, a test should record it, since right now nothing does.
Found by running the samples in #846 rather than only building them.
Measured
integralaccepted three arguments in 1.3.0 and has thrown since 1.4.0.derivativestill accepts three. Each row is the published package, parsed in its own process:integral(sqrt(x)/a, x, 1)derivative(sqrt(x)/a, x, 1)integral(sqrt(x)/a, x)FunctionArgumentCountExceptionFunctionArgumentCountExceptionSo this is a 1.4.0 change, not a 2.0 one, and it is in the current released version today.
Two things follow
It went out undocumented.
BREAKING-CHANGES.mdbegins at "2.0.0 (unreleased) — since 1.4.0", so a break introduced by 1.4.0 has no home in it. Anyone who upgraded 1.3.0 → 1.4.0 with a three-argumentintegralin a parsed string got an exception with nothing to point them at. That is worth a line somewhere even now, since 1.4.0 is whatdotnet add packagestill installs.integralandderivativenow disagree. They are the same shape of operation and read the same way:The likely reason is that
integralgrew the definite formintegral(f, x, from, to), and 2-or-4 was chosen to keep the grammar unambiguous — three arguments sits between them. That is a defensible reason for the restriction; it is not a reason for the two functions to differ, and nothing says so anywhere a caller would look.Why it stayed invisible for seven months
SampleNet5andFSharpSampleboth callintegral(f, x, 1). They were pinned toAngouriMath 1.3.0, so they kept compiling and running against a version that still accepted it. Nothing in CI builds or runs the samples. #846 moves them ontoProjectReference, which is what surfaced this.No unit test covers a three-argument
integraleither, in any direction — neither that it works nor that it throws. The change has no test recording that it was intended.What to decide
integralas the n-th antiderivative, matchingderivative. Additive, so 2.1 rather than 2.0.derivative's three-argument form so the two agree. Breaking, so 2.0 or never.Syntax.mdand in the exception message, so a caller hitting it is told which arities exist and why.Option 3 is the cheapest and is worth doing regardless of 1 or 2 — the exception already names the accepted counts, and
Syntax.mdshould agree with it. My weak preference beyond that is option 1, because a caller who writesintegral(f, x, 2)after writingderivative(f, x, 2)is not making a mistake, they are generalising correctly from the neighbouring function.Whichever way it goes, a test should record it, since right now nothing does.