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

Parse unevaluated integral from giac #22997

Closed
mforets mannequin opened this issue May 14, 2017 · 20 comments
Closed

Parse unevaluated integral from giac #22997

mforets mannequin opened this issue May 14, 2017 · 20 comments

Comments

@mforets
Copy link
Mannequin

mforets mannequin commented May 14, 2017

If integrate(..., algorithm='giac') does not find a solution, Sage should return an unevaluated expression.

For example, consider integrate(exp(-x^2)*log(x), x, algorithm='giac').

It returns either

Traceback (most recent call last):
...
NotImplementedError: Unable to parse Giac output: integrate(ln(x)*exp(-x^2),x)

or

integration(e^(-x^2)*ln(x), x)

depending on the user's locale settings (EN and FR respectively).

OTOH, both Maxima and SymPy return integrate(e<sup>(-x</sup>2)*log(x), x).

Component: calculus

Keywords: integrate, interfaces, giac

Author: Marcelo Forets

Branch/Commit: 0e5bdf0

Reviewer: Steven Trogdon

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

@mforets mforets mannequin added this to the sage-8.0 milestone May 14, 2017
@mforets mforets mannequin added c: calculus labels May 14, 2017
@mforets
Copy link
Mannequin Author

mforets mannequin commented May 14, 2017

Commit: f3c9d15

@mforets
Copy link
Mannequin Author

mforets mannequin commented May 14, 2017

Branch: u/mforets/22997

@mforets
Copy link
Mannequin Author

mforets mannequin commented May 14, 2017

comment:1

does it correspond at the level or giac_integrator (see symbolic/integration/external.py)? or at the level of the giac interface? (see def _sage_(self, locals={})).

in the former case, is this correct?

...
if 'integrate' in format(result) or 'integration' in format(result):
    return integrate(expr, v, a, b, hold=True) # ???
else:
    return result._sage_()

New commits:

f3c9d15add one doctest

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 14, 2017

Changed commit from f3c9d15 to 2bba41d

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 14, 2017

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

2bba41dparse result in giac_integrator

@mforets mforets mannequin added the s: needs review label May 14, 2017
@strogdon
Copy link

comment:4

Perhaps this exposes a bug in sympy_integrator. These work

sage: integrate(e^(-x^2)*log(x), x, algorithm='giac')
integrate(e^(-x^2)*log(x), x)
sage: integrate(e^(-x^2)*log(x), x, algorithm='maxima')
integrate(e^(-x^2)*log(x), x)

although algorithm='maxima' was not doctested, but

integrate(e^(-x^2)*log(x), x, algorithm='sympy')

just hangs.

@mforets
Copy link
Mannequin Author

mforets mannequin commented May 18, 2017

comment:5

here it works only after a looong time:

sage: integrate(e^(-x^2)*log(x), x, algorithm='sympy') # 15-20 minutes, processor intensive
integrate(e^(-x^2)*log(x), x)

@strogdon
Copy link

Reviewer: Steven Trogdon

@strogdon
Copy link

comment:6

OK, I was impatient. It took 30+ minutes here.

@strogdon
Copy link

Author: Marcelo Forets

@mforets
Copy link
Mannequin Author

mforets mannequin commented May 18, 2017

comment:7

Replying to @strogdon:

OK, I was impatient. It took 30+ minutes here.

Thanks for the review!

@vbraun
Copy link
Member

vbraun commented May 18, 2017

comment:8

Merge conflict

@strogdon
Copy link

comment:9

This really should have depended on #22833 since src/sage/symbolic/integration/external.py was touched there. I though I had that ticket merged when I tested things here, but apparently not, or else I would have noticed the conflict. #22833 is now in 8.0.beta7 and so this will have to be rebased. Just change it back to positive_review when that is done.

@mforets
Copy link
Mannequin Author

mforets mannequin commented May 19, 2017

comment:10

Replying to @strogdon:

This really should have depended on #22833 since src/sage/symbolic/integration/external.py was touched there.

my fault, thanks for pointing it out.

I though I had that ticket merged when I tested things here, but apparently not, or else I would have noticed the conflict. #22833 is now in 8.0.beta7 and so this will have to be rebased.

there's something that i don't understand. i do:

(in t/mforets/22997) $ git rebase develop
(... solve the merge conflict manually ...)
(in t/mforets/22997) $ git add src/sage/symbolic/integration/external.py
(in t/mforets/22997) $ git status
rebase in progress; onto 7a36941
You are currently rebasing branch 't/22997/22997' on '7a36941'.
  (all conflicts fixed: run "git rebase --continue")

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	modified:   src/sage/symbolic/integration/external.py
(in t/mforets/22997) $ git rebase --continue
Applying: parse result in giac_integrator

up to now everything seems to work fine, locally. however i try to push to the remote branch and it breaks:

(in t/mforets/22997) $ git push trac HEAD:u/mforets/22997
To trac.sagemath.org:sage.git
 ! [rejected]        HEAD -> u/mforets/22997 (non-fast-forward)
error: failed to push some refs to 'git@trac.sagemath.org:sage.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

it also breaks if i use the automatic command:

(in t/mforets/22997) $ git trac push
Pushing to Trac #22997...
Guessed remote branch: u/mforets/22997
Traceback (most recent call last):
  File "/usr/local/bin/git-trac", line 18, in <module>
    cmdline.launch()
  File "/Users/forets/sage-src/sage/git-trac-command/git_trac/cmdline.py", line 223, in launch
    app.push(ticket_number, remote=args.remote, force=args.force)
  File "/Users/forets/sage-src/sage/git-trac-command/git_trac/app.py", line 216, in push
    self.repo.push(remote, force)
  File "/Users/forets/sage-src/sage/git-trac-command/git_trac/git_repository.py", line 197, in push
    self.git.echo.push('trac', refspec)
  File "/Users/forets/sage-src/sage/git-trac-command/git_trac/git_interface.py", line 341, in meth
    return self.execute(git_cmd, *args, **kwds)
  File "/Users/forets/sage-src/sage/git-trac-command/git_trac/git_interface.py", line 98, in execute
    popen_stderr=subprocess.PIPE)
  File "/Users/forets/sage-src/sage/git-trac-command/git_trac/git_interface.py", line 263, in _run
    raise GitError(result)
git_trac.git_error.GitError: git returned with non-zero exit code (1) when executing "git push trac HEAD:refs/heads/u/mforets/22997"
    STDERR: To trac.sagemath.org:sage.git
    STDERR:  ! [rejected]        HEAD -> u/mforets/22997 (non-fast-forward)
    STDERR: error: failed to push some refs to 'git@trac.sagemath.org:sage.git'
    STDERR: hint: Updates were rejected because a pushed branch tip is behind its remote
    STDERR: hint: counterpart. Check out this branch and integrate the remote changes
    STDERR: hint: (e.g. 'git pull ...') before pushing again.
    STDERR: hint: See the 'Note about fast-forwards' in 'git push --help' for details.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 19, 2017

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

0e5bdf0Merge branch 'develop' into t/mforets/22997

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 19, 2017

Changed commit from 2bba41d to 0e5bdf0

@mforets
Copy link
Mannequin Author

mforets mannequin commented May 19, 2017

comment:12

(merged into v.8.0.beta7)

@mforets mforets mannequin added s: positive review and removed s: needs work labels May 19, 2017
@fchapoton
Copy link
Contributor

comment:13

The doctest is going to fail with the French locale:

sage: from sage.symbolic.integration.external import *
sage:  giac_integrator(e^(-x^2)*log(x), x)
integration(e^(-x^2)*ln(x), x)

@fchapoton
Copy link
Contributor

comment:14

oops, sorry.

@vbraun
Copy link
Member

vbraun commented May 20, 2017

Changed branch from u/mforets/22997 to 0e5bdf0

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