On 04/06/2013 21:11, Mike wrote:
The following code snippet works, until you uncomment the "c=x-a" line,
at which point you get the error
"TypeError: f() takes exactly 2 arguments (1 given)". The line "c=x"
causes no problems. What's going on?
(Note: I know you don't need that line; this replicates the TypeError
in a more complicated problem.)
from mpmath import *
def f(a,b):
# c=x-a
return a-2, b-3
print findroot(f, (5, 6))
Hi
The problem is that the findroot function calls your function f with
parameters of a multiprecision type which is not compatible with
symbolic expressions. Although you can evaluate f(5,6) you cannot do
f(mp.convert(5),mp.convert(6))
as Sage cannot do
x-mp.convert(5)
HTH
Alastair Irving
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.