Skip to content

Unable to compute limit() over a variable coming from a list #38761

Closed
@maxale

Description

@maxale

Steps To Reproduce

Consider an example:

sage: x = var('x',n=3)
sage: f = sum(x); f
x0 + x1 + x2
sage: f.limit(x[1]=1)
  Cell In[3], line 1
    f.limit(x[Integer(1)]=Integer(1))
            ^
SyntaxError: expression cannot contain assignment, perhaps you meant "=="?

sage: f.limit(x[1]==1)
[...]
ValueError: call the limit function like this, e.g. limit(expr, x=2).

Expected Behavior

It should be possible to computing limit without confusing its argument with an assignment. It'd would be much safer to have an interface like .limit(x[1], 1), where the variable and its value are separated.

Actual Behavior

Sage thinks x[1]=1 is an assignment and gives an error.

Additional Information

I was able to compute the limit via the following very roundabout way:

sage: f.limit(**{str(x[1]):1})
x0 + x2 + 1

Environment

  • OS: Ubuntu 24.04.1 LTS
  • Sage Version: 10.5.beta6

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions