title: why does mpmath throw an error when i trying to plug in the Chudnovsky algorithm?
body: <p>im trying to use the <a href="https://en.wikipedia.org/wiki/Chudnovsky_algorithm" rel="nofollow noreferrer">Chudnovsky algorithm</a> in mpmath for python and so i wrote this code:</p>
  <pre><code>from mpmath import *
  import csv
  mp.dps = 100; mp.pretty = True
  x = mpf(426880)*sqrt(10005)*(nsum(lambda q: ((mpf(-1))^(q)*fac((mpf(6)*q))*(mpf(545140134*q+13591409)))/((fac(mpf(3*q)))*(fac(q)^(mpf(3)))*
  (mpf(-262537412640768000))^(q)), [0, inf]))^(mpf(-1))
  
  with open('main.txt', 'w', newline='') as txt:
      txt.write(str(x))
  </code></pre>
  <p>but i keep getting this error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;C:\Coding Adventures\Python\millionpi\V2\main.py&quot;, line 4, in &lt;module&gt;
      x = mpf(426880)*sqrt(10005)*(nsum(lambda q: ((mpf(-1))^(q)*fac((mpf(6)*q))*(mpf(545140134*q+13591409)))/((fac(mpf(3*q)))*(fac(q)^(mpf(3)))*(mpf(-262537412640768000))^(q)), [0, inf]))^mpf(-1)
    File &quot;C:\Coding Adventures\Python\millionpi\venv\lib\site-packages\mpmath\calculus\extrapolation.py&quot;, line 1718, in nsum
      return +ctx.adaptive_extrapolation(update, emfun, options)
    File &quot;C:\Coding Adventures\Python\millionpi\venv\lib\site-packages\mpmath\calculus\extrapolation.py&quot;, line 1165, in adaptive_extrapolation     
      update(partial, xrange(index, index+step))
    File &quot;C:\Coding Adventures\Python\millionpi\venv\lib\site-packages\mpmath\calculus\extrapolation.py&quot;, line 1706, in update
      psum = psum + g(ctx.mpf(k))
    File &quot;C:\Coding Adventures\Python\millionpi\venv\lib\site-packages\mpmath\calculus\extrapolation.py&quot;, line 1753, in g
      return f(*args)
    File &quot;C:\Coding Adventures\Python\millionpi\venv\lib\site-packages\mpmath\calculus\extrapolation.py&quot;, line 1808, in g
      return f(*args)
    File &quot;C:\Coding Adventures\Python\millionpi\V2\main.py&quot;, line 4, in &lt;lambda&gt;
      x = mpf(426880)*sqrt(10005)*(nsum(lambda q: ((mpf(-1))^(q)*fac((mpf(6)*q))*(mpf(545140134*q+13591409)))/((fac(mpf(3*q)))*(fac(q)^(mpf(3)))*(mpf(-262537412640768000))^(q)), [0, inf]))^mpf(-1)
  TypeError: unsupported operand type(s) for ^: 'mpf' and 'mpf'
  </code></pre>
  <p>and im completely stumped as how to solve it so any help would be great</p>