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

Decide what to do with e^(y=x) #11651

Open
kcrisman opened this issue Aug 5, 2011 · 2 comments
Open

Decide what to do with e^(y=x) #11651

kcrisman opened this issue Aug 5, 2011 · 2 comments

Comments

@kcrisman
Copy link
Member

kcrisman commented Aug 5, 2011

This sage-support thread describes the following problem:

sage: var('y') 
y 
sage: (y==x).log() 
log(y == x) 
sage: (y==x).log().simplify() # just sends to Maxima and back to Sage 
log(y) == log(x) 
sage: (y==x).exp() 
e^(y == x) 
sage: (y==x).exp().simplify() # just sends to Maxima and back to Sage 
TypeError: unable to make sense of Maxima expression 'e^(y=x)' in Sage 

Basically, one can consider the problem in two ways - a Sage bug or a Maxima bug/feature. Depends on how you look at it.

  • Option 1: We don't expect an = sign inside of expressions in our parser in sage/misc/parser.py. Once you leave Parser.p_eqn, there is a lot of jumping around that happens, but it never gets back there, and that is the only place that replaces = with ==. So we should fix that.
  • Option 2: Maxima erroneously doesn't change e^(y=x) to e<sup>y=e</sup>x. With log, it does:
sage: var('y'); a = (y==x).log() 
sage: a._maxima_() 
log(y)=log(x) 

But with exp, it doesn't:

sage: var('y'); a = (y==x).exp() 
y 
sage: a._maxima_() 
%e^(y=x) 

For now putting the upstream as 'none of the above' since it's not clear the bug is upstream.

Upstream: Reported upstream. Developers deny it's a bug.

CC: @robertwb

Component: symbolics

Keywords: maxima parsing

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

@kcrisman kcrisman added this to the sage-5.11 milestone Aug 5, 2011
@kcrisman
Copy link
Member Author

kcrisman commented Aug 8, 2011

Changed upstream from None of the above - read trac for reasoning. to Reported upstream. Developers deny it's a bug.

@kcrisman
Copy link
Member Author

kcrisman commented Aug 8, 2011

comment:1

See this Maxima list message, and the ensuing comments, for more information.

For now I'm putting this as "upstream denies bug" because the sense on the list was not unanimous that it should always happen; certainly one doesn't always want to expand the ==, though for exp one might want to.

Robert Dodier had a partial fix:


Well, log is declared to distrubute over lists, matrices, and equations,
while exp is not so declared.
You can get the desired effect like this in a Maxima session,
or just put the Lisp code in maxima-init.lisp.

:lisp (setf (get '%exp 'distribute_over) '(mlist mequal))

(Note that this also declares that exp distributes over lists;
I hope that's not controversial. Exp shouldn't distribute over
matrices since exp(matrix) has another interpretation.)

However, this would not work with %e^(y=x), only exp(y=x), apparently.

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
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

4 participants