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

Assumptions on symbols not preserved with some unevaluated integrals #22763

Open
rwst opened this issue Apr 5, 2017 · 8 comments
Open

Assumptions on symbols not preserved with some unevaluated integrals #22763

rwst opened this issue Apr 5, 2017 · 8 comments

Comments

@rwst
Copy link

rwst commented Apr 5, 2017

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)?

CC: @nbruin

Component: symbolics

Author: Ralf Stephan

Branch/Commit: u/rws/assumptions_on_symbols_not_preserved_with_some_unevaluated_integrals @ 39567f4

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

@rwst rwst added this to the sage-8.0 milestone Apr 5, 2017
@rwst
Copy link
Author

rwst commented Apr 5, 2017

comment:1

#22650 depends on this.

@rwst
Copy link
Author

rwst commented Apr 6, 2017

comment:2

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 ms 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.

@rwst
Copy link
Author

rwst commented Apr 6, 2017

comment:3

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 lhs-rhs is zero even for vars with different flags or hashes.

@rwst
Copy link
Author

rwst commented Apr 7, 2017

@rwst
Copy link
Author

rwst commented Apr 7, 2017

Author: Ralf Stephan

@rwst
Copy link
Author

rwst commented Apr 7, 2017

Commit: 39567f4

@rwst
Copy link
Author

rwst commented Apr 7, 2017

New commits:

39567f422763: update maxima_lib about variable changes

@rwst rwst modified the milestones: sage-8.0, sage-8.2 Mar 3, 2018
@fchapoton
Copy link
Contributor

comment:7

red branch => needs work

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

3 participants