You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fb768a9
Browse filesBrowse the repository at this point in the historyBrowse files
The special functions compile, in double precision (#1613)
erf, erfc, erfi, Ei, li, Si, Ci, Shi and Chi had no compiled form. So Compile and Compile<TIn,
TOut> threw UncompilableNodeException on them, and Solve's numerical search, which compiles,
declined any equation with one in it. The interpreter's kernels work in arbitrary precision and
take 0.7 to 5.5 ms a call at 20 digits. Newton's method makes about 3,000 calls an equation, so
it cannot use them.
SpecialFunctions gives each a double-precision routine, and both compilers call it: through new
opcodes under Compile, and through definitions for Complex and double under Compile<TIn, TOut>,
where an integer or a float is widened to double first, as for the trigonometry.
- The error functions come from the Faddeeva function, by Weideman's rational approximation with
40 terms, and from erf's Taylor series near the origin.
- Ei is summed as its series where the terms cancel little, is E1's continued fraction elsewhere
out to |z| = 40, and is its asymptotic series beyond.
- li, Si, Ci, Shi and Chi follow from Ei and from their own series, by the relations the kernels
state.
Each keeps the kernel's branch cuts and its values on the axes. Over doubles, a value off the
real line is NaN, as Math.Sqrt of a negative number is.
Measured against the kernels at 30 digits on about ten thousand points, through the compiled
delegates: the integrals agree to within 6e-14 of the value, and the error functions to within
3e-13, which is the rounding of z^2 in e^(-z^2) at large |z|. They take 0.5 to 2.4 us a call.
Solve answers erf(x) = x/2 + 1/7 with its three real roots, each checked against mpmath, and
more off the real line. An equation that isolates a special function, erf(x) = 1/2, is still
left unsolved: the solver finds no inverse to write, and so never reaches the search.
SpecialFunctions lives in AngouriMath.Numerics, beside the interval evaluation. The routines are
the compilers' today, and the numerical evaluation's fast tier is where they are to be shared next,
as asked on #1607: the interval evaluation reads no special function, so an integrator check with
erf or Ei in it falls back to the decimal evaluation.
Part of #1607.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| `"erf(x)".Compile("x")`, and `erfc`, `erfi` | `UnrecognizedFunctionParseException`; for `erfc` and `erfi`, `UncompilableNodeException`: not among the variables | compiled |
2428
+
| `"erf(x) = x/2 + 1/7".ToEntity().Solve("x")` | `UnrecognizedFunctionParseException` | its roots near `-2.283`, `0.235` and `1.679`, and more off the real line |
| `"Ei(x)".Compile("x")`, and `li` | `UncompilableNodeException`: `Ei` is not among the variables | compiled ([#1607](https://github.com/asc-community/AngouriMath/issues/1607)) |
2443
2449
2444
2450
### The exponential and logarithmic integrals are integrated to
2445
2451
@@ -2478,6 +2484,7 @@ was refused, so each was read as a product with an undeclared variable
| `"Si(x)".Compile("x")`, and `Ci`, `Shi`, `Chi` | `UncompilableNodeException`: `Si` is not among the variables | compiled ([#1607](https://github.com/asc-community/AngouriMath/issues/1607)) |
2481
2488
2482
2489
### A quadratic below a sine or a cosine is split over its two roots
0 commit comments