Giter VIP home page Giter VIP logo

Comments (7)

eobermuhlner avatar eobermuhlner commented on June 14, 2024

Thanks for the info.

I have corrected the README.

Adding the gamma function is a good idea.
I would rather make it a separate function gamma(BigDecimal, MathContext) and leave the factorial(int) function as it is.

from big-math.

eobermuhlner avatar eobermuhlner commented on June 14, 2024

Or adding an overloaded variant:
factorial(BigDecimal, MathContext)

from big-math.

EliteMasterEric avatar EliteMasterEric commented on June 14, 2024

The overload would definitely be a good idea. Leaving the factorial(int) function in place alongside an overload would prevent existing programs from breaking with the addition.

from big-math.

eobermuhlner avatar eobermuhlner commented on June 14, 2024

Implementing gamma() is definitely not trivial.

Euler's infinite product definition
https://en.wikipedia.org/wiki/Gamma_function#Euler's_definition_as_an_infinite_product
is easy to implement but after a 1000 multiplications achieves only 3 digits precision for factorial(3.0).
This will not work.

Some numerical calculation variants explained:
http://www.rskey.org/CMS/index.php/the-library/11

This one looks promising:
http://www.vttoth.com/CMS/projects/41

Best algorithm sofar:
https://en.wikipedia.org/wiki/Spouge%27s_approximation

If nobody comes up with a working implementation in the meantime I will first finish release 2.0 (introducing BigComplex) before I attack gamma()

from big-math.

eobermuhlner avatar eobermuhlner commented on June 14, 2024

Wrote a little blog describing the development of this issue, since it is quite an interesting case.

https://github.com/eobermuhlner/big-math/blob/master/docs/markdown/gamma/gamma.md

from big-math.

EliteMasterEric avatar EliteMasterEric commented on June 14, 2024

I looked through your article, didn't realize the gamma function would be this much of a burden to implement. Thanks for your work on this issue!

from big-math.

eobermuhlner avatar eobermuhlner commented on June 14, 2024

The effort was pretty typical for a new function.

And it is fun 😄

from big-math.

Related Issues (20)

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.