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:  sage8.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: 
Description
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') y sage: function('f') 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
comment:2 Changed 7 years ago by
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 https://en.wikipedia.org/wiki/Free_variables_and_bound_variables for a definition.
comment:3 Changed 6 years ago by
Implemented in pynac git master. Will be in the upcoming Pynac0.7.6.
comment:4 Changed 6 years ago by
Branch:  → u/rws/add_a_free_variables___method_ 

comment:5 Changed 6 years ago by
Authors:  → Ralf Stephan 

Commit:  → 5b93a067769f0a49267a010401366de43c0cfdb0 
Milestone:  sage7.1 → sage8.0 
This is not ready for review because it doesn't work as expected but at least the interface is there now.
New commits:
3c848da  22838: pkg version/checksum

d89e6d0  22838: remove unnecessary patch

4a30119  22838: interface change

7d3fd60  22838: doctest adaptation to ticket 10070

5b93a06  20179: interface to Pynac's ex::free_symbols()

comment:6 Changed 6 years ago by
Dependencies:  → #22844 

comment:7 Changed 6 years ago by
Cc:  Emmanuel Charpentier added 

comment:8 Changed 6 years ago by
Dependencies:  #22844 → #22844, pynac0.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
Dependencies:  #22844, pynac0.7.8 → #22844, #23134 

comment:10 Changed 6 years ago by
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
Status:  new → needs_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
Status:  needs_review → positive_review 

comment:13 Changed 5 years ago by
Branch:  u/rws/add_a_free_variables___method_ → 5b93a067769f0a49267a010401366de43c0cfdb0 

Resolution:  → fixed 
Status:  positive_review → closed 
These are practically all variables, minus the one(s) the limit is over?