Opened 5 years ago
Last modified 10 months ago
#22763 needs_work defect
Assumptions on symbols not preserved with some unevaluated integrals
Reported by:  rws  Owned by:  

Priority:  major  Milestone:  sage8.2 
Component:  symbolics  Keywords:  
Cc:  nbruin  Merged in:  
Authors:  Ralf Stephan  Reviewers:  
Report Upstream:  N/A  Work issues:  
Branch:  u/rws/assumptions_on_symbols_not_preserved_with_some_unevaluated_integrals (Commits, GitHub, GitLab)  Commit:  39567f474257574983fb0f16bf6fc45aff4c238a 
Dependencies:  Stopgaps: 
Description
In a fresh Sage, assumptions on symbols within expressions are preserved when Maxima returns the same expression in an unevaluated integral. But in this case the domain/flag information of m
is somehow cleared/deleted:
sage: _ = var('m') sage: (x^m / sqrt(2+3*x)).integral(x) integrate(x^m/sqrt(3*x + 2), x) sage: _= var('m', domain='integer') sage: (x^m / sqrt(2+3*x)).integral(x) integrate(x^m/sqrt(3*x + 2), x) sage: _.operands()[0].operands()[1] x^m sage: _.operands()[1].is_integer() False
assume(m, 'integer')
cannot restore the flag of m
in the returned integral.
The problem does not occur without the first two lines. Maybe the first creation of m
does somehow irrevocably set something in Maxima (or Sage's module for backtranslation)?
Change History (7)
comment:1 Changed 5 years ago by
comment:2 Changed 5 years ago by
It looks like sage.interfaces.maxima_lib.sr_to_max
has several symbol dicts. sage_sym_dict
's keys are symbols and registered constants. At the first encounter of (x^m / sqrt(2+3*x)).integral(x)
m
is inserted there. The hash of the second m
is the same, and presumably that's why there is no change in the dictionary. As the m
s are different the hash should be different too and there is the Pynac bug that if fixed should fix this ticket too. Alternatively the dicts should be updated in var
when variables are created.
comment:3 Changed 5 years ago by
Actually hashes have nothing to do with it. The vars are not the keys in the dictionary and, even if they were, hash makes no difference because keys are compared via bool(a==b)
, ie ex.__nonzero__()
is used and there lhsrhs is zero even for vars with different flags or hashes.
comment:4 Changed 5 years ago by
 Branch set to u/rws/assumptions_on_symbols_not_preserved_with_some_unevaluated_integrals
comment:5 Changed 5 years ago by
 Commit set to 39567f474257574983fb0f16bf6fc45aff4c238a
 Status changed from new to needs_review
New commits:
39567f4  22763: update maxima_lib about variable changes

comment:6 Changed 4 years ago by
 Milestone changed from sage8.0 to sage8.2
comment:7 Changed 10 months ago by
 Status changed from needs_review to needs_work
red branch => needs work
#22650 depends on this.