Opened 6 years ago
Closed 4 years ago
#20179 closed enhancement (fixed)
add a free_variables() method?
Reported by:  wonder  Owned by:  

Priority:  major  Milestone:  sage8.0 
Component:  symbolics  Keywords:  
Cc:  charpent  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 6 years ago by
comment:2 Changed 6 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 5 years ago by
Implemented in pynac git master. Will be in the upcoming Pynac0.7.6.
comment:4 Changed 5 years ago by
 Branch set to u/rws/add_a_free_variables___method_
comment:5 Changed 5 years ago by
 Commit set to 5b93a067769f0a49267a010401366de43c0cfdb0
 Milestone changed from sage7.1 to 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 5 years ago by
 Dependencies set to #22844
comment:7 Changed 5 years ago by
 Cc charpent added
comment:8 Changed 5 years ago by
 Dependencies changed from #22844 to #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 4 years ago by
 Dependencies changed from #22844, pynac0.7.8 to #22844, #23134
comment:10 Changed 4 years ago by
 Reviewers set to Travis Scrimshaw
Is this ready for review? If so, then you can set it to positive review on my behalf.
comment:11 Changed 4 years ago by
 Status changed from new to 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 4 years ago by
 Status changed from needs_review to positive_review
comment:13 Changed 4 years ago by
 Branch changed from u/rws/add_a_free_variables___method_ to 5b93a067769f0a49267a010401366de43c0cfdb0
 Resolution set to fixed
 Status changed from positive_review to closed
These are practically all variables, minus the one(s) the limit is over?