Git Product home page Git Product logo

emsr / tr29124_test Goto Github PK

View Code? Open in Web Editor NEW
17.0 7.0 3.0 646.14 MB

C++ special math functions

License: GNU General Public License v3.0

Makefile 0.01% C++ 91.54% Shell 0.04% C 0.13% MATLAB 0.01% Fortran 0.08% Python 0.03% Gnuplot 0.56% CMake 0.56% HTML 3.47% CSS 0.55% JavaScript 0.57% TeX 2.47% PostScript 0.01% Ruby 0.01%
math-functions statistics special-functions numerical-methods polynomials c-plus-plus c-plus-plus-17 cpp17

tr29124_test's Introduction

TR29124 Mathematical Special Functions in C++

Codacy Badge Build Status Coverage Status

This repository contains work toward [IS 29124 - Extensions to the C++ Library to Support Mathematical Special Functions] (http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2010/n3060.pdf) hence the awkward name.

This library also contains work towards follow-up published proposals for new special functions: [A proposal to add special mathematical functions according to the ISO/IEC 80000-2:2009 standard, Vincent Reverdy] (http://open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3494.pdf)

[A Proposal to add Mathematical Functions for Statistics to the C++ Standard Library, Paul A Bristow] (http://open-std.org/JTC1/SC22/WG21/docs/papers/2004/n1668.pdf)

[A proposal to add sincos to the standard library, Paul Dreik] (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0081r0.pdf)

This work began as a project to add math extensions to libstdc++. At this point I am abandoning that idea in favor of a general math library. Those still wishing to look at the libstdc++ support should check out the last_libstdc++_support tag. I may create a branch later.

This library has abandoned the 'f' and 'l' suffixed functioned of C++17. These were for C 'compatibility' which never came. They were a source of noise and bitrot. I briefly thought about retaining them for functions of integer argument that can't figure out a floating point type by ADL. But I chose not to do thet either.

This library and sub-libraries are experiencing a lot of churn right now but in the end I expect a set of smaller components that are more independent. It does seem to be in the nature of this work that some interdependencies creep in. In particular, the functions in these libraries are now in namespace emsr and in include/emsr.

The functions in IS 29124 have been accepted into C++17. See Section 2.9.5 Mathematical special functions [sf.cmath] in a recent draft.

In addition to the special functions in C++17, this library adds several extensions:

  • Hypergeometric functions
  • Carlson elliptic functions
  • Jacobi elliptic functions, amplitude, and nome
  • Polylogarithm functions
  • Airy functions
  • Hankel functions
  • Statistical distribution functions

Some capabilities have been migrated into separate subprojects:

  • Quadrature rules
  • Polynomial classes and solvers
  • Sequence trasnformations
  • Continued fractions
  • Chebyshev fitting
  • Math constants
  • Differentiation

I strive for type genericity. I want C++ numerics to follow the containers + algorithms by having numeric algorithms that will work for any type for which numeric_limits, and the basic math functions are available. These functions have been tested with float, dou6ble, long double, and __float128. Some have been tested with mpreal and efforts are underway to allow full multiprecision usage.

Documentation

Check out the API documentation.

Building

Because there are several submodules, you'll want to clone like this:

  • git clone --recurse-submodules https://github.com/emsr/tr29124_test.git
    If you forget, as I often do, and do a normal clone then go into the main project directory and update the submodules:
  • git submodule update --init --recursive

tr29124_test's People

Contributors

codacy-badger avatar dependabot[bot] avatar emsr avatar joeos0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

tr29124_test's Issues

Thrash float testing!

We test double pretty hard. That is where most of the external data is.
We need to test using 32-bit float.
Find where it craps out. Make sure our limits-defined numbers work over a range of types.

Bessel function under/overflow near the origin - esp float.

Look at the results of test_bessel, test_sph_bessel, near the originas a function of.
You have to widen the near zero. Look at the near zero asymptotics and come up with a thing
as a function of underflow exponent and nu.
Neumann and K are just going to blow.
Should I go ahead and let J, I return denormal results? Why not.
And if the type doesn't do denorm just zero then and don't sweat.

Add Heuman lambda, Jacobi zeta, Legendre D elliptic functions.

heuman_lambda - I've got this! - __heuman_lambda(_Tp __beta, _Tp __k)
template <class T1, class T2>
calculated-result-type heuman_lambda(T1 k, T2 phi);
and __jacobi_zeta(_Tp __k, _Tp __phi)
template <class T1, class T2, class Policy>
calculated-result-type jacobi_zeta(T1 k, T2 phi, const Policy&);
Done - __ellint_d(_Tp __k, _Tp __phi)
template <class T1, class T2>
calculated-result-type ellint_d(T1 k, T2 phi);

Implement inverse erf and erfc

Implement inverse erf and erfc.
And for that matter, we want native implementations of erf and erfc as well. And for the complex plane too.

Implement a static compile-time polynomial

Implement a static compile-time polynomial.
LambertW has a very good static polynomial I think - with static Horner.
They use macros... Sigh. Still, we could hack these into templates.

__log_gamma was a very sobering exercise in trig accuracy...

__log_gamma was a very sobering exercise in trig accuracy.
The error in the location of the zeros of, say,
std::sin(x) grow linearly with argument!
I had to test epsilon * |x| for zero to place poles!
The world really needs reperiodized trig functions!

Thrash long double testing!

We test double pretty hard. That is where most of the external data is.
We need to test using long double and if different, __float128.

Ship a ibeta complement.

We should make a thing that returns the complement of ibeta.
Internally, we could return both in a struct.

test_hankel build fails

test_hankel build fails on
test_hankel.cpp:52:47: error: no matching function for call to '__airy(std::complex&, double)'
auto Airy = std::__detail::__airy(z, 1.0e-16);
It builds.
It's probably an API change.

Why did dilog lose the x=0 test?

Why did dilog lose the x=0 test?
It is because the answer dilog(0) == 0. So the fractional error blows up even when the answer is spot on.
But it doesn't look like such a point would be skipped though.
We need a way of trapping this...
We need a way of deciding when a point approximately crosses the real axis.
We don't want to trap when points asymptotically approach the axis.
So we need to store some previous numbers for a derivative approximation.
Maybe if |f| < eps and |f - fprev| > N eps switch to absolute diff (and mark it).

Implement inverse incomplete gammas.

Implement inverse incomplete gammas:
[] We will want lgamma_scaled - the Binet function.
[] Then tgamma_scaled - sometines called \Gamma^{*}.
[] Then Amparo, Gil, etc have a paper...

Implement Heuman Lambda

Boost has this.

Implement heuman_lambda - I've got this! - __heuman_lambda(_Tp __beta, _Tp __k)
template <class T1, class T2>
calculated-result-type heuman_lambda(T1 k, T2 phi);
and __jacobi_zeta(_Tp __k, _Tp __phi)
template <class T1, class T2, class Policy>
calculated-result-type jacobi_zeta(T1 k, T2 phi, const Policy&);
Done - __ellint_d(_Tp __k, _Tp __phi)
template <class T1, class T2>
calculated-result-type ellint_d(T1 k, T2 phi);

Enable TR1 test (re)generation

In testcase.tcc in the big string_view header I'd like to be able to replace
#include <specfun_testcase.h>
with
#include "../testcase.h"
for TR1 test generation...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.