Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Defining a function instead worked for me:

sage: f = lambda x: elliptic_kc(x) - 2
sage: find_root(f, 0, 0.9)
0.6438562191479369


Alternatively, one can use the solve functionality from pari/gp:

sage: gp("solve(x=0, 0.7, ellK(x^(1/2)) - 2)")
0.64385621914775464686672115765108324989

Note that the pari/gp function ellK is not the same (complete) elliptic $K$ function from sage. For instance, the values in $1/4$ differ:

sage: elliptic_kc(1/4.)
1.68575035481260

and

? ellK(1/4)
%12 = 1.5962422221317835101489690714979498795

However:

? ellK(1/2)
%13 = 1.6857503548125960428712036577990769895

Just as a note: pari/gp can give us more decimal places:

? \p 150
   realprecision = 154 significant digits (150 digits displayed)
? solve(x=0, 0.7, ellK(x^(1/2)) - 2)
%14 = 0.643856219147754646866721157651083249845248156171320703143872009317482774610540686232984439485823088513555922361027026184004141998761703004038574916462
?