Opened 7 years ago

Closed 5 years ago

#20179 closed enhancement (fixed)

add a free_variables() method?

Reported by: Lee Worden Owned by:
Priority: major Milestone: sage-8.0
Component: symbolics Keywords:
Cc: Emmanuel Charpentier Merged in:
Authors: Ralf Stephan Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 5b93a06 (Commits, GitHub, GitLab) Commit: 5b93a067769f0a49267a010401366de43c0cfdb0
Dependencies: #22844, #23134 Stopgaps:

Status badges


It can be useful to query the free variables in an expression. SR's variables() and arguments() return all variables in an expression, whether free or bound. For example:

sage: var('y')
sage: function('f')
sage: e = limit( f(x,y), x=0 )
sage: e
limit(f(x, y), x, 0)
sage: e.variables()
(x, y)

I would like to have a free_variables() method that returns only y in this case. Is there a recommended way to get this information from an expression?

Change History (13)

comment:1 Changed 7 years ago by Ralf Stephan

These are practically all variables, minus the one(s) the limit is over?

comment:2 Changed 7 years ago by Lee Worden

The free variables in an expression are all its variables excluding any that are bound, for example, in limits, sums, products, or integrals.

See for example for a definition.

comment:3 Changed 6 years ago by Ralf Stephan

Implemented in pynac git master. Will be in the upcoming Pynac-0.7.6.

comment:4 Changed 6 years ago by Ralf Stephan

Branch: u/rws/add_a_free_variables___method_

comment:5 Changed 6 years ago by Ralf Stephan

Authors: Ralf Stephan
Commit: 5b93a067769f0a49267a010401366de43c0cfdb0
Milestone: sage-7.1sage-8.0

This is not ready for review because it doesn't work as expected but at least the interface is there now.

New commits:

3c848da22838: pkg version/checksum
d89e6d022838: remove unnecessary patch
4a3011922838: interface change
7d3fd6022838: doctest adaptation to ticket 10070
5b93a0620179: interface to Pynac's ex::free_symbols()
Last edited 6 years ago by Ralf Stephan (previous) (diff)

comment:6 Changed 6 years ago by Ralf Stephan

Dependencies: #22844

comment:7 Changed 6 years ago by Emmanuel Charpentier

Cc: Emmanuel Charpentier added

comment:8 Changed 6 years ago by Ralf Stephan

Dependencies: #22844#22844, pynac-0.7.8

The problems seem resolved, now that there is a symbolic limit, and code in Pynac master that recognizes it and its bound symbols.

comment:9 Changed 6 years ago by Ralf Stephan

Dependencies: #22844, pynac-0.7.8#22844, #23134

comment:10 Changed 6 years ago by Travis Scrimshaw

Reviewers: Travis Scrimshaw

Is this ready for review? If so, then you can set it to positive review on my behalf.

comment:11 Changed 6 years ago by Ralf Stephan

Status: newneeds_review

Yes, I usually wait until the merge of the Pynac upgrade because not all reviewers want to go through the hassle of manual Pynac install. Thanks.

comment:12 Changed 6 years ago by Ralf Stephan

Status: needs_reviewpositive_review

comment:13 Changed 5 years ago by Volker Braun

Branch: u/rws/add_a_free_variables___method_5b93a067769f0a49267a010401366de43c0cfdb0
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.