symplex 0.32.0

Exact symbolic mathematics for Rust: calculus, summation, solving, linear algebra, transforms, compile-time dimensional analysis, and Rust/C code generation
Documentation
# Third-party notices

symplex is an independent project.  It is **not affiliated with, sponsored
by or endorsed by** the SymPy project, the mpmath, SciPy or statsmodels
projects, or any of their contributors; their names appear in this
repository only to identify them.

## How other projects are used

**As test oracles (no code).**  SymPy, mpmath, SciPy and statsmodels are
*run* — from `scripts/` and by hand, in a local virtualenv — to produce
reference values that tests compare against, each cited next to the value
with the call that produced it.  These are numbers and expressions
(mathematical facts), not code; no part of those projects is included in, or
linked into, symplex.  All four are BSD-3-Clause licensed.

**As references for conventions.**  Where a mathematical choice is
conventional — a branch cut, the ordering of a polynomial's terms, the
parametrisation of a distribution, which identities `expand_log` applies —
symplex usually makes SymPy's choice, so that the two agree and SymPy can
serve as an oracle.  Behaviour is not copyrightable, but the choice is
acknowledged in the doc comment where it is made.

**Implementations that follow SymPy's.**  A few modules follow the
structure of SymPy's implementation of a published algorithm, and say so in
their documentation:

| symplex | follows | algorithm published in |
|---|---|---|
| `src/calculus/gruntz.rs` (`SubsSet`, the sign and MRV routines) | `sympy/series/gruntz.py` | D. Gruntz, *On Computing Limits in a Symbolic Manipulation System*, PhD thesis, ETH Zürich, 1996 |
| `src/calculus/risch/hermite.rs` | `hermite_reduce` in `sympy/integrals/risch.py` | M. Bronstein, *Symbolic Integration I*, §2.3 |
| `src/domains/ntheory.rs` (`EcmStage2`, ECM stage 2 in `ecm_curve_ring`) | stage 2 of `_ecm_one_factor` in `sympy/ntheory/ecm.py` | P. L. Montgomery, *Math. Comp.* 48 (1987); R. Crandall, C. Pomerance, *Prime Numbers*, 2nd ed., §7.4.2 |
| `src/domains/exact_matrix.rs` (LLL reduction order and rounding) | `DomainMatrix.lll` / `_ddm_lll` | A. K. Lenstra, H. W. Lenstra, L. Lovász, *Math. Ann.* 261 (1982) |
| `src/plotting/textplot.rs` | `sympy/plotting/textplot.py` | — |
| `src/api/expr_algebraic_ext.rs` (`multipoly_resultant`: the subresultant PRS over `ℚ[params][x]`) | `dup_inner_subresultants`, `dup_prs_resultant` in `sympy/polys/euclidtools.py` | W. S. Brown, "The subresultant PRS algorithm", *ACM TOMS* 4 (1978) 237–249 |
| `src/poly/zpoly.rs` (`z_subresultant_prs`: the signed subresultant chain of the Sturm sequences and `z_gcd`) | `dup_inner_subresultants` in `sympy/polys/euclidtools.py` | W. S. Brown, "The subresultant PRS algorithm", *ACM TOMS* 4 (1978) 237–249 |
| `src/transforms/solve.rs` (the Lambert-form equations and their real branches) | `_solve_lambert` / `_lambert` in `sympy/solvers/bivariate.py` | R. M. Corless et al., "On the Lambert W function", *Adv. Comput. Math.* 5 (1996) 329–359 |
| `src/poly/multipoly.rs` (`heugcd_z`, `heugcd_attempt`: the evaluation-point bound and the three candidates per point) | `dmp_zz_heu_gcd` in `sympy/polys/euclidtools.py` | B. W. Char, K. O. Geddes, G. H. Gonnet, "GCDHEU: Heuristic polynomial GCD algorithm based on integer GCD computation", *J. Symbolic Comput.* 7 (1989) 31–48 |
| `src/transforms/evalf/hypsum.rs` (convergence classification, the direct hypergeometric summation) | `check_convergence` and `hypsum` in `sympy/core/evalf.py` | the term-ratio test for hypergeometric series |
| `src/transforms/pattern.rs` (`condition_pow_pow`) | the branch condition of `Pow._eval_power` | the principal branch of `z^a` |
| `src/base/assumptions.rs` (`compute_mul`: a real factor that may vanish keeps `real · imaginary` undecided) | `Mul._eval_real_imag` / `Mul._eval_is_imaginary` in `sympy/core/mul.py` | — |
| `src/simplify/log_expand.rs` (`expand_ln_node_guarded`: a known-negative factor becomes the finished term `ln(−f)`) | the `is_negative` branch of `log._eval_expand_log` in `sympy/functions/elementary/exponential.py` | — |
| `src/calculus/gruntz.rs` (`asymptotic_rewrite`: `erf`, `erfc`, `Ei`, `li` at ±∞ with their exponential factor explicit, `Γ` at ∞ as `exp(ln Γ)`, `ln ω` as a leading-term coefficient) | `_eval_rewrite_as_tractable` of `erf`, `erfc`, `Ei`, `gamma`, the helpers `_erfs`, `_eis` in `sympy/functions/special/error_functions.py` and `gamma_functions.py`; `logx` in `sympy/series/gruntz.py` | D. Gruntz, PhD thesis, ETH Zürich 1996; DLMF 7.12.1, 6.12.2, 5.11.1 |
| `src/domains/linalg.rs` (`rref_solve_algebraic`: fraction-free Gauss–Jordan elimination) | `ddm_irref_den` in `sympy/polys/matrices/dense.py` | G. C. Nakos, P. R. Turner, R. M. Williams, "Fraction-free algorithms for linear and polynomial equations", *ACM SIGSAM Bull.* 31 (1997) |
| `src/domains/matrix.rs` (`eigen_pairs`: eigenvalues block by block of a block-triangular matrix) | `_eigenvals_dict` in `sympy/matrices/eigen.py` | — |
| `src/domains/linalg.rs` (`kp_radical_roots`: Cardano's formulas over ℚ(√p…, i)) | the case analysis of `roots_cubic` in `sympy/polys/polyroots.py` | G. Cardano, *Ars Magna* (1545) |
| `src/calculus/series.rs` (`inverse_at_branch_point`: the expansions of `asin`, `acos`, `acosh`, `atanh`, `asinh`, `atan` at their branch points) | the branch-point cases of `asin._eval_nseries`, `acos._eval_nseries` (`1 ∓ u = t²`) and `atanh`/`acosh._eval_nseries` (`rewrite(log)`) in `sympy/functions/elementary/trigonometric.py` and `hyperbolic.py` | `asin √z = √z·₂F₁(½, ½; 3/2; z)` (DLMF 15.4.4) |
| `src/simplify/radsimp.rs` (`try_rationalize`: a conjugate that makes the denominator 0 is not used) | the `d.has(S.Zero, nan, zoo)` guard of `radsimp` in `sympy/simplify/radsimp.py` | — |

To the extent any of these is a derivative of SymPy, SymPy's licence
applies to that part, and its notice is reproduced here as clause (a)
requires:

```text
Copyright (c) 2006-2023 SymPy Development Team

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  a. Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.
  b. Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.
  c. Neither the name of SymPy nor the names of its contributors
     may be used to endorse or promote products derived from this software
     without specific prior written permission.


THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
```

**Implementations that follow mpmath's.**

| symplex | follows | algorithm published in |
|---|---|---|
| `src/transforms/evalf/lambertw.rs` (every branch over ℂ: branch-point and asymptotic starting values, Halley iteration), and the `lambert_wm1` start values of the `f64` runtime | `lambertw`, `_lambertw_series`, `_lambertw_approx_hybrid` in `mpmath/functions/functions.py` | R. M. Corless, G. H. Gonnet, D. E. G. Hare, D. J. Jeffrey, D. E. Knuth, "On the Lambert W function", *Adv. Comput. Math.* 5 (1996) 329–359 |
| `src/transforms/evalf/factorials.rs` (`gamma_ratio`: a quotient of Γ values with poles cancelled in the limit) | `gammaprod` in `mpmath/functions/factorials.py` | — |
| `src/transforms/evalf/polylog.rs` (`polylog` of a real order off `[−1, 1]`: the series, the `ln z` expansion, the inversion formula with the Hurwitz argument `½ + ln(−z)/(2πi)`) | `polylog`, `polylog_series`, `polylog_general` in `mpmath/functions/zeta.py` | DLMF 25.12.12, 25.12.13; the Euler–Maclaurin remainder as in F. Johansson, "Rigorous high-precision computation of the Hurwitz zeta function and its derivatives", *Numer. Algorithms* 69 (2015) |
| `src/transforms/evalf/loggamma.rs` (complex `loggamma`: reflection left of `Re z = ½`, the shifted Stirling series, the branch of the shifted product fixed by an `f64` estimate of its imaginary part) | `mpc_loggamma` / `mpc_gamma` in `mpmath/libmp/gammazeta.py` | DLMF 5.11(ii) (Stirling remainder bound) |

To the extent these are derivatives of mpmath, mpmath's licence applies
to those parts, and its notice is reproduced here:

```text
Copyright (c) 2005-2021 Fredrik Johansson and mpmath contributors

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  a. Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.
  b. Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.
  c. Neither the name of the copyright holder nor the names of its
     contributors may be used to endorse or promote products derived
     from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
```

**Implementations that follow statsmodels'.**

| symplex | follows | algorithm published in |
|---|---|---|
| `src/domains/stats/estimation.rs` (`proportion_interval`: the Clopper–Pearson and Jeffreys ends as Beta quantiles) | `proportion_confint(method='beta'/'jeffreys')` in `statsmodels/stats/proportion.py` | C. J. Clopper, E. S. Pearson, *Biometrika* 26 (1934) 404–413; L. D. Brown, T. T. Cai, A. DasGupta, *Statist. Sci.* 16 (2001) 101–133 |

To the extent it is a derivative of statsmodels, statsmodels' licence
applies to that part, and its notice is reproduced here:

```text
Copyright (C) 2006, Jonathan E. Taylor
All rights reserved.

Copyright (c) 2006-2008 Scipy Developers.
All rights reserved.

Copyright (c) 2009-2018 statsmodels Developers.
All rights reserved.


Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  a. Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.
  b. Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.
  c. Neither the name of statsmodels nor the names of its contributors
     may be used to endorse or promote products derived from this software
     without specific prior written permission.


THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL STATSMODELS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
```

**Vendored test data.**  `rubi-harness/suite/` is an unmodified copy of the
Rubi integration test suite in Maxima syntax
(<https://github.com/RuleBasedIntegration/MaximaSyntaxTestSuite>, commit
`60295e21`), MIT licensed, "Copyright (c) 2018 Rule-based Integration"; its
`LICENSE` file is kept next to it.  It is used as test input only (no Rubi
rules or code are part of symplex) and is excluded from the published crate.

Everything else in symplex is original work under the crate's licence
(MIT OR Apache-2.0, see `LICENSE-MIT` and `LICENSE-APACHE`), implemented
from the mathematical literature cited in the source.