On Thursday 3 October 2024 at 04:44:12 UTC-7 Emmanuel Charpentier wrote:
sage: F.limit(X[0]=3) Cell In[9], line 1 F.limit(X[Integer(0)]=Integer(3))
^ SyntaxError: expression cannot contain assignment, perhaps you meant
"=="?
Indeed, the current limit function and method get their arguments (variable
and value) by analysing a single named argument, whose name must be a
literal. From limit?? :
The restriction here is python's processing of optional arguments. These
must have simple names. You can already use
"""
limit(x0,**{str(X[0]):1})
"""
now, which isn't beautiful but at least it establishes the function.
Allowing an explicit dictionary argument would likely open up a whole slew
of other issues. It looks to me like we're missing a very simple form for
limit that should be the primitive to all of this:
limit( f, x, 1)
i.e.: expression to take limit of, variable with respect to take limit,
limit value. Then one could just write limit( F, X[0], 0) and one would get
the default processing of arguments for python for free. We wouldn't rely
on the programmatic pun of using python identifiers to stand in for our
symbolic variables.
Further convenience routines that use syntactic sugar to make things
resemble more mathematical notation can then be built on top, but at least
the general primitive is available underneath.
It may be hard to figure out a way to make such a routine available under
an easily found name while remaining compatible with what exists now.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/sage-support/ed523586-8820-4708-ae4f-f8111e91fbacn%40googlegroups.com.