Most public functions are actually methods of a 'context' object which
is passed as the first parameter (ctx). The context object stores the
precision, cached data, and a few other things. It also defines
conversions so that the same high-level code can be used for several
different base types (mpf, mpfs in Sage, intervals, Python floats) by
switching contexts.
The default context is called 'mp'. You can call most functions as
mpmath.mp.foo(). The top-level function mpmath.foo() is just an alias
for this.
Fredrik
You can import the mp object as a global variable (or locally in a
function). There's no need to add it as an argument to your functions,
unless you specifically want to support multiple contexts.
from mpmath import mp
def F1(A):
return mp.norm(A) + 37
or simply:
from mpmath import norm
def F1(A):
return norm(A) + 37
Is there a specific reason why you need to pass the context object
explicitly to your functions? I might have misunderstood.
Fredrik