Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CallableSymbolicExpressionRing over subrings of SR #32008

Open
mkoeppe opened this issue Jun 19, 2021 · 10 comments
Open

CallableSymbolicExpressionRing over subrings of SR #32008

mkoeppe opened this issue Jun 19, 2021 · 10 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Jun 19, 2021

  1. Currently, CallableSymbolicExpressionRing allows meaningless operations such as the following.
sage: f(t) = t
sage: f
t |--> t
sage: f * t
t |--> t^2

This should be changed so it gives:

_dummy |--> _dummy * t

f currently is an element of a CallableSymbolicExpressionRing, a ring over the base SR (the only allowed base for this class).

  1. The design of CallableSymbolicExpressionRing has another critical flaw pointed out in Meta-ticket: Callable symbolic expressions #28434 (Syntax for callable symbolic expressions causes too much confusion) as "7. Addition confusion":
sage: f(x) = x^2
sage: g(x) = x^2
sage: var('t')
sage: h(t) = t^2
sage: f+g
x |--> 2*x^2
sage: f+h
(t, x) |--> t^2 + x^2

In this ticket:

  • We remove the distinction between the CallableSymbolicExpressionRing instances based on the names of the argument variable names. Instead, they will be unique by number of arguments, and the set of non-argument symbols that appear in the definition.
  • The element constructor substitutes the arguments in the expression by dummy variables, i.e., unique internal symbols that are only used for this purpose. The argument names are substituted back only in _repr_ and when converted into SR by SymbolicRing._element_constructor_
  • We extend the class to support base rings that are subrings of SR. Then we change the default base ring of a callable expression to be the subring of SR that rejects all dummy variables.

Related:

CC: @rburing @slel @egourgoulhon @tscrim @dkrenn

Component: symbolics

Branch/Commit: u/mkoeppe/callablesymbolicexpressionring_over_subrings_of_sr @ f71de5b

Issue created by migration from https://trac.sagemath.org/ticket/32008

@mkoeppe mkoeppe added this to the sage-9.4 milestone Jun 19, 2021
@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 19, 2021

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

b5a0bbeExpression.function: Pass parent to CallableSymbolicExpressionRing as base ring
f71de5bWIP coercion

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2021

Commit: f71de5b

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 19, 2021

comment:4

With this version, we get:

sage: var('a b c')
(a, b, c)
sage: (a*b*c).function(a, b)
(a, b) |--> a*b*c
sage: _.parent()
Callable function ring with arguments (a, b) over Symbolic Subring rejecting the variables a, b
sage: (a*b*c).function(a, b) * b
TypeError: unsupported operand parent(s) for *: 'Callable function ring with arguments (a, b) over Symbolic Subring rejecting the variables a, b' and 'Symbolic Ring'
sage: (a*b*c).function(a, b) * SR.subring([x])(x)
(a, b) |--> a*b*c*x

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Jul 19, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 14, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 Apr 1, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Aug 31, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.8, sage-9.9 Jan 7, 2023
@mkoeppe mkoeppe removed this from the sage-10.0 milestone Apr 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant