Opened 8 years ago

Last modified 4 years ago

#16202 new enhancement

implement the agm(x,y) function

Reported by: rws Owned by:
Priority: major Milestone: sage-8.2
Component: calculus Keywords:
Cc: mforets Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by rws)

Pari has a numeric implementation:

? 1/agm(1,sqrt(2))
%1 = 0.83462684167407318628142973279904680900

but Wikipedia provides a closed form integral expression, and if we had the "complete elliptic integral of the first kind" this would be even simpler.

Numerically there is sage.rings.real_mpfr.RealNumber.

Change History (8)

comment:1 Changed 8 years ago by kcrisman

Do you mean elliptic_kc? This is indeed in Maxima, though not yet a "Sage symbolic function". See also the symbolics page on Trac where a few things about this are mentioned.

Oh, I see what you mean about the elliptic - like this Rosetta stone. Anyway, I would think that we can do this fairly easily - also note mpmath has the agm and the elliptic integral in question, and mpmath is probably a go-to for numerical evaluation of our most recent implementations of special functions.

comment:2 Changed 8 years ago by kcrisman

Sorry, to clarify - if we implement elliptic_kc as a symbolic function, you could do this easily as you say, or we can try to combine this with mpmath as well.

comment:3 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:4 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:5 Changed 7 years ago by rws

  • Description modified (diff)

comment:6 Changed 5 years ago by mforets

  • Cc mforets added
  • Milestone changed from sage-6.4 to sage-8.2

comment:7 Changed 4 years ago by chapoton

There is already

sage: a=CDF(1)
sage: b=CDF(sqrt(2))
sage: 1/a.agm(b)

comment:8 Changed 4 years ago by rws


            sage: RBF(sqrt(2)).agm(1)^(-1)
            [0.83462684167407 +/- 3.9...e-15]
Note: See TracTickets for help on using tickets.