Opened 3 years ago

Closed 2 years ago

#20179 closed enhancement (fixed)

add a free_variables() method?

Reported by: wonder Owned by:
Priority: major Milestone: sage-8.0
Component: symbolics Keywords:
Cc: charpent Merged in:
Authors: Ralf Stephan Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 5b93a06 (Commits) 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 3 years ago by rws

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

comment:2 Changed 3 years ago by wonder

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 2 years ago by rws

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

comment:4 Changed 2 years ago by rws

  • Branch set to u/rws/add_a_free_variables___method_

comment:5 Changed 2 years ago by rws

  • Authors set to Ralf Stephan
  • Commit set to 5b93a067769f0a49267a010401366de43c0cfdb0
  • Milestone changed from sage-7.1 to sage-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 2 years ago by rws (previous) (diff)

comment:6 Changed 2 years ago by rws

  • Dependencies set to #22844

comment:7 Changed 2 years ago by charpent

  • Cc charpent added

comment:8 Changed 2 years ago by rws

  • Dependencies changed from #22844 to #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 2 years ago by rws

  • Dependencies changed from #22844, pynac-0.7.8 to #22844, #23134

comment:10 Changed 2 years ago by tscrim

  • 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 2 years ago by rws

  • 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 2 years ago by rws

  • Status changed from needs_review to positive_review

comment:13 Changed 2 years ago by vbraun

  • Branch changed from u/rws/add_a_free_variables___method_ to 5b93a067769f0a49267a010401366de43c0cfdb0
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.