-
-
Notifications
You must be signed in to change notification settings - Fork 489
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
substitution in denominator is skipped #21071
Comments
This comment has been minimized.
This comment has been minimized.
Upstream: Reported upstream. Developers acknowledge bug. |
comment:2
Note that there is the walkaround of substituting twice, i.e. as given followed by a substitution of the inverse pattern with the inverse replacement, e.g., |
Author: Ralf Stephan |
Commit: |
Changed upstream from Reported upstream. Developers acknowledge bug. to none |
comment:4
Remaining fail, hopefully the author(s) can see where they worked around this bug so that their workaround can be removed:
New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:8
I'm not completely sure I agree with this: sage: eq.substitute(a=x, x=1)
- x + 1 == sin(1/x)
+ x + 1 == sin(1) On the LHS, you simplify |
comment:9
I agree, but the inconsistency already exists in develop:
(EDIT: simplified) |
comment:10
However, the following shows that it is not due to sequential application but premature evaluation (
|
comment:11
Quoting from http://www.ginac.de/reference/basic_8cpp_source.html#l00606, it looks like this is pretty fundamental:
The problem is that substitutions are done on the subexpressions and then on the entire expression. So, we have:
I'm pretty sure this is because of line 629. This is not because of premature evaluation (which, as you show, can also be an issue) |
comment:12
I would like to solve this outside Pynac via an intermediate substitution step. It would depend on #22102. |
Dependencies: #22102 |
comment:13
There is an ambiguity. What is the expected result of
Plot expects this to be |
comment:14
I think |
comment:16
I think what it should do is return the constant function 3 as this would be in line with how
|
comment:17
Substitution in computer algebra systems doesn't tend to be semantically defined. It's an operation on syntax trees. So I think piecewise functions can be treated in two ways: Either you regard them as "atomic" objects. Then substitution doesn't do anything within them. That's not unreasonable. A piecewise function cannot be evaluated at a symbolic input either ... Or you regard them as a syntax tree (probably a list of (a,b,expression) tuples or so) and you do a substitution on that (hopefully raising an error when the substitution leads to something illegal). |
The following comes very unexpected
The problem is the internal representation as
Reported upstream as pynac/pynac#186
Depends on #22102
CC: @tscrim @dkrenn
Component: symbolics
Author: Ralf Stephan
Branch/Commit: u/rws/substitution_in_denominator_is_skipped @
5e39b7b
Issue created by migration from https://trac.sagemath.org/ticket/21071
The text was updated successfully, but these errors were encountered: