Motivation in this ask.sagemath.org question
<https://ask.sagemath.org/question/79446/limit-with-variables-from-array/>.
sage: X=var("x", n=3) sage: F=sum(X) ; F x0 + x1 + x2 sage: F.limit(x0=3)
x1 + x2 + 3
So far, so good. But
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?? :
def limit(ex, dir=None, taylor=False, algorithm='maxima', **argv):
[ Docstring elided ]
if not isinstance(ex, Expression): ex = SR(ex) if len(argv) != 1: raise
ValueError("call the limit function like this, e.g. limit(expr, x= 2).")
else: k, = argv.keys() v = var(k) a = argv[k]
[ Then proceeds to keyword management. ]
This call syntax :
- must be kept for reverse compatibility’s sake, but
- must be extended to accept at minimum limit(variable, value, ...)
syntax.
But we may take inspiration from the subs call syntax, which accepts more
flexible calls ; for example, a “dictionary” argument may be useful to
implement multi-variable limits.
Advice ?
--
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/e7eceb39-d435-4208-bec2-8c6022c5860an%40googlegroups.com.