On Dec 5, 2006, at 9:10 PM, Robert Bradshaw wrote:
> I guess I'm fine with the expression paradigm (where would they live/
> what would their parent be?), but I think it would be very nice to
> make them callable (which I guess would be abuse of notation).
> Argument naming/order (and, in some cases perhaps number) is the big
> difficulty here (and I think just forcing alphabetical is not a good
> solution (with polynomials the order is defined at ring creation
> time)). Either that or make substations very easy and natural.
I don't know why I didn't see the obvious use of unspecified keywords
in python functions sooner. So, here's another fantasy session for
maximum flexibility:
sage: f = sin(x) + y
sage: f(x=1, y=4)
sin(1) + 4
sage: f({x: 1, y: 4})
sin(1)+4
sage: f.integrate(x)
-cos(x) + xy
sage: x = 99
sage: f.integrate(x)
Traceback ...
sage: f.integrate('x') # here x (the indetermanent) is over-ridden,
but we can still refer to it by its (immutable) name
-cos(x) + xy
sage: f({'x': 1, 'y': 4})
sin(1)+4
sage: g = f(y=2); g
sin(x) + 2
sage: g(7): # ONE free variable, can use that by default
sin(7) + 2
sage: g.derivative() # again, ONE free variable
cos(x)
sage: g.derivative(y)
0
sage: f(2,1)
?? error/alphabetical ordering
sage: f(2, x=5, u=9)
?? should it be smart enough to figure this out? Order the unnamed
ones as above?
- Robert
--~--~---------~--~----~------------~-------~--~----~
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-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---