Giter Club home page Giter Club logo

elliptic-integrals-js's Introduction

elliptic-integrals-js

Complete elliptic integrals in javascript

Here I've implemented complete elliptic integrals of the first, second, and third kind in javascript. The implementation follows an iteration scheme based on the convergence of the arithmetic-geometric mean, which converges at least quadratically with number of iterations---therefore effectively doubling the number of digits each iteration. These iteration schemes come from Garrett, Milan Wayne, Journal of Applied Physics 34.9 (1963): 2567-2573, Eqs. (18)-(21).

The functions extend the Math object with:

  • Math.agm(a,g): arithmetic-geometric mean of two non-negative numbers
  • Math.EllipticK(m): Complete elliptic integral of the first kind
  • Math.EllipticE(m): Complete elliptic integral of the second kind
  • Math.EllipticPi(n,m): Complete elliptic integral of the third kind

The arguments are the parameter m, which is related to the modulus k via m=k^2; and the characteristic n. The algorithms are valid for m<1, n<1.

To be completely clear, the functions are computing the following integrals:

  • $ K(m) = \int_0^{\pi/2} \frac{d\theta}{\sqrt{1 - m (\sin\theta)^2}} $
  • $ E(m) = \int_0^{\pi/2} \sqrt{1 - m (\sin\theta)^2} d\theta $
  • $ Pi(n,m) = \int_0^{\pi/2} \frac{1}{(1-n(\sin\theta)^2)\sqrt{1 - m (\sin\theta)^2}} d\theta $

This agrees with the conventions of Mathematica.

elliptic-integrals-js's People

Contributors

duetosymmetry avatar simsek8 avatar

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.