Motivation in this ask.sagemath.org question.
sage: X=var("x", n=3) sage: F=sum(X) ; F x0 + x1 + x2 sage: F.limit(x0=3) x1 + x2 + 3So 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 :
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 ?
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?? :