2

I wanted to differentiate a function by using mpmaths function diff. In order to just try if everything works on a simple example, I used an example being described in the documentary. But it threw the error "AttributeError: 'MPContext' object has no attribute 'difference'". The example I used is:

from mpmath import *

dps=15
pretty = True
diff(lambda x: x**2 + x, 1.0)

Here I didn´t understand either, that in the documentary they used diff obviously with just introducing 2 arguments (diff(f,x)), while the function in the documetary schematically looks like this:

mpmath.diff(ctx, f, x, n=1, **options)

So why can they just ignore the "ctx" (whatever this variable should be), shouldn´t that be syntactically wrong anyways as you have to pass over to a function all obligatory arguments which aren´t preset (like it would be with ctx="something")?

Thanks a lot in advance, would really help me.

Kind regards, Jonathan

Johnny A
  • 21
  • 3

0 Answers0