Hi, all,
I want to create a "function" within a function, and return it as the value of
the latter function, something along the lines of:
def g(a,b,c):
var('x y')
f = a*x^2 + b*y + c
return f
This works, almost. I have to invoke the return value as a function returning
a function:
sage: f = g(1,2,3)
sage: f(0)
2*y + 3
sage: f(0)(1)
5
I can't treat it as a function of two variables:
sage: f(0,1)
---------------------------------------------------------------------------
<type 'exceptions.TypeError'> Traceback (most recent call last)
/SandBox/Justin/sb/Sage/Code/<ipython console> in <module>()
<type 'exceptions.TypeError'>: __call__() takes at most 2 arguments (3 given)
sage:
It's not clear from the doc what should happen, but this is a bit of a surprise.
Justin
--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Enhancement of the Director's Income
--------
When LuteFisk is outlawed,
Only outlaws will have LuteFisk
--------
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---