Ticket #1189 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

[with patch, with positive review] SymPy <-> SAGE automatic conversion

Reported by: certik Owned by: was
Priority: major Milestone: sage-2.9
Component: calculus Keywords:
Cc: Author(s):
Report Upstream: Reviewer(s):
Merged in: Work issues:

Description

Please update to sympy 0.5.7 using the attached spkg.

Then apply the attached patch that will allow SAGE to freely mix SymPy? and SAGE expressions.

Attachments

sympy.patch Download (3.9 KB) - added by certik 3 years ago.
sympy2.patch Download (4.7 KB) - added by certik 3 years ago.
sympy-coerce.patch Download (1.0 KB) - added by robertwb 3 years ago.

Change History

Changed 3 years ago by certik

Changed 3 years ago by certik

  • type changed from defect to enhancement
  • component changed from algebraic geometry to calculus

Here is the link to the new sympy spkg:

 http://dakol.fsik.cvut.cz/~ondra/sympy-0.5.7.spkg

Please update this first, only then use the patch above.

Changed 3 years ago by certik

After upgrading the spkg and applying the patch, please check, that everything works as it should by:

$ ./sage -t devel/sage/sage/calculus/test_sympy.py sage -t devel/sage-main/sage/calculus/test_sympy.py

[2.9 s]


All tests passed! Total time for all tests: 2.9 seconds

Changed 3 years ago by mabshoff

  • summary changed from update sympy to 0.5.7, patch to make SymPy and SAGE work nicely to [with patch|spkg] update sympy to 0.5.7, patch to make SymPy and SAGE work nicely
  • milestone set to sage-2.8.13

Changed 3 years ago by certik

Changelog of the spkg:

* Script "get-hg" for getting hg sources added * get-orig-sources updated to download SymPy? 0.5.7

Changelog of the patch:

* basic SymPy? and SAGE objects can now be freely mixed

Changed 3 years ago by certik

Once again, this time with correct formatting.

Changelog of the spkg:

* Script "get-hg" for getting hg sources added

* "get-orig-sources" updated to download SymPy 0.5.7

Changelog of the patch:

* basic SymPy and SAGE objects can now be freely mixed

Changed 3 years ago by mabshoff

  • status changed from new to closed
  • resolution set to fixed

Merged in 2.8.13.alpha0.

Changed 3 years ago by mabshoff

Arrg, the bit of the patch in coerce.pyx causes segfaults. So the patch is backed out, but the spkg is still in.

Ondrej: Either open a new ticket and resubmit the patch or reopen this ticket.

Cheers,

Michael

Changed 3 years ago by certik

  • status changed from closed to reopened
  • resolution fixed deleted
  • milestone sage-2.8.13 deleted

Oops. I only executed the tests in calculus/test_sympy.py.

I am openning the ticket, but leaving it to a later milestone, because I don't have time at the moment to fix that. Is there someone more experienced to maybe see immediatelly what is wrong?

I run "./sage -t *" and indeed I am getting these errors:

sage -t devel/sage-main/sage/schemes/generic/spec.py sh: line 1: 9143 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_spec.py >.doctest/out 2>.doctest/err

A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.

sage -t devel/sage-main/sage/rings/number_field/order.py sh: line 1: 9354 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_order.py >.doctest/out 2>.doctest/err

A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.

sage -t devel/sage-main/sage/rings/integer_ring.pyx sh: line 1: 9855 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_integer_ring.py >.doctest/out 2>.doctest/err

A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.

sage -t devel/sage-main/sage/rings/complex_field.py sh: line 1: 9919 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_complex_field.py >.doctest/out 2>.doctest/err

A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.

sage -t devel/sage-main/sage/rings/quotient_ring.py sh: line 1: 9934 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_quotient_ring.py >.doctest/out 2>.doctest/err

A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.

sage -t devel/sage-main/sage/rings/polynomial/multi_polynomial_ideal.pysh: line 1: 10028 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_multi_polynomial_ideal.py >.doctest/out 2>.doctest/err

A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.

sage -t devel/sage-main/sage/rings/real_rqdf.pyx sh: line 1: 10557 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_real_rqdf.py >.doctest/out 2>.doctest/err

A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.

...

Changed 3 years ago by mabshoff

  • summary changed from [with patch|spkg] update sympy to 0.5.7, patch to make SymPy and SAGE work nicely to make SymPy and SAGE work nicely together
  • milestone set to sage-2.9

Hehe, I assumed you ran testall, especially after touching coerce.pyx. I tagged this against 2.9 for now. It will automatically get moved forward every time we complete a milestone.

I also changed the summary to reflect the remaining issue.

Cheers,

Michael

Changed 3 years ago by certik

Hehe, I assumed you ran testall, especially after touching coerce.pyx.

Yeah, I am still learning how to properly contribute to SAGE. :)

Changed 3 years ago by certik

Changed 3 years ago by certik

  • milestone changed from sage-2.9 to sage-2.8.15

The patch was fixed, now it passes all tests:

 http://sagetrac.org/sage_trac/attachment/ticket/1189/sympy2.patch

But probably needs some review before committing.

Changed 3 years ago by certik

  • summary changed from make SymPy and SAGE work nicely together to [with patch] SymPy <-> SAGE automatic conversion

Changed 3 years ago by robertwb

I was not able to apply sympy2.patch cleanly against Sage 2.8.14.

That said, I think _verify_canonical_coercion_c is the wrong thing to call here--please see the attached change which should fix the segfault issue in a much cleaner way and allow stuff like

sage: Integer(1) + sympy.Symbol("x")
x + 1

Changed 3 years ago by robertwb

Changed 3 years ago by certik

Unfortunately, I don't have time to do it (leaving to Spain tomorrow). But please use the original sympy.patch + sympy-coerce.patch from Robert, that should do the job.

Thanks a lot.

Changed 3 years ago by mabshoff

  • status changed from reopened to closed
  • resolution set to fixed

Merged in 2.8.15.rc0 - finally ;)

Changed 3 years ago by mabshoff

  • status changed from closed to reopened
  • resolution fixed deleted

On sage.math the above two patches cause doctest failures in rings/polynomial/multi_polynomial_ideal.py - so reopen.

Cheers,

Michael

Changed 3 years ago by mabshoff

  • summary changed from [with patch] SymPy <-> SAGE automatic conversion to [with patch, with negative review] SymPy <-> SAGE automatic conversion

This is probably not the patches direct fault, but we need to fix the other segfault first before merging this. Sage not working on sage.math isn't really an option.

Sorry, Ondrej.

Cheers,

Michael

Changed 3 years ago by robertwb

I wasn't able to reproduce the errors in rings/polynomial/multi_polynomial_ideal.py, or anywhere for that matter. Could you clarify?

Still running testall...

Changed 3 years ago by robertwb

  • summary changed from [with patch, with negative review] SymPy <-> SAGE automatic conversion to [with patch, with positive review] SymPy <-> SAGE automatic conversion

Testall succeeded for me with these patches.

Changed 3 years ago by mabshoff

Well, the segfault happened to me on sage.math.

Cheers,

Michael

Changed 3 years ago by mabshoff

  • status changed from reopened to closed
  • resolution set to fixed

Finally merged in 2.9.alpha5 :)

Note: See TracTickets for help on using tickets.