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

MaximaElements should not coerce into SR. #3970

Closed
mwhansen opened this issue Aug 27, 2008 · 11 comments
Closed

MaximaElements should not coerce into SR. #3970

mwhansen opened this issue Aug 27, 2008 · 11 comments

Comments

@mwhansen
Copy link
Contributor

sage: f = maxima.function('x','sin(x)')
sage: f + x  #correct
sin(x)+x
sage: x+f    #wrong
x + sage6

Component: calculus

Author: Mike Hansen

Reviewer: Adam Webb

Merged: sage-4.2.alpha0

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

@mwhansen mwhansen added this to the sage-4.2 milestone Aug 27, 2008
@mwhansen
Copy link
Contributor Author

comment:1

After:

sage: f = maxima.function('x','sin(x)')
sage: f+x
sin(x)+x
sage: x+f
sin(x)+x
sage: type(_)
<class 'sage.interfaces.maxima.MaximaFunction'>

@mwhansen

This comment has been minimized.

@mwhansen
Copy link
Contributor Author

comment:2

Patch added which fixes the issue. This depends on #132.

@mwhansen
Copy link
Contributor Author

comment:3

This patch actually breaks everything in calculus.py. I must have ran the tests without having it actually applied.

@jasongrout
Copy link
Member

comment:4

What is the status of this now? Apparently it still is a problem in 4.0:

----------------------------------------------------------------------
| Sage Version 4.0, Release Date: 2009-05-29                         |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: f = maxima.function('x','sin(x)')
sage: f + x  #correct
sin(x)+x
sage: x+f    #wrong
sage0 + x
sage: 

@mwhansen
Copy link
Contributor Author

Author: Mike Hansen

@maxthemouse
Copy link
Mannequin

maxthemouse mannequin commented Oct 6, 2009

comment:6

I get an error with sage -t -long sage/symbolic/ring.pyx. I am not sure that I understand the patch as it seems to apply for both maxima and pari. Is this by intention?

sage -t -long "devel/sage-myver/sage/symbolic/ring.pyx"
**********************************************************************
File "/home/adamwebb/local/sage/devel/sage-myver/sage/symbolic/ring.pyx", line 97:
    sage: SR.coerce(pari(2/5))
Exception raised:
    Traceback (most recent call last):
      File "/home/adamwebb/local/sage/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/home/adamwebb/local/sage/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/home/adamwebb/local/sage/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_7[3]>", line 1, in <module>
        SR.coerce(pari(Integer(2)/Integer(5)))###line 97:
    sage: SR.coerce(pari(2/5))
      File "parent.pyx", line 402, in sage.structure.parent.Parent.coerce (sage/structure/parent.c:4859)
      File "parent.pyx", line 429, in sage.structure.parent.Parent.coerce (sage/structure/parent.c:4806)
    TypeError: no canonical coercion from Interface to the PARI C library to Symbolic Ring
**********************************************************************
1 items had failures:
   1 of  12 in __main__.example_7
***Test Failed*** 1 failures.

if I put back the Pari stuff:

from sage.libs.pari.gen import PariInstance

elif isinstance(R, (PariInstance)): 
    return True

Then everything works.

Cheers,
Adam

@mwhansen
Copy link
Contributor Author

mwhansen commented Oct 7, 2009

comment:7

Attachment: trac_3970.patch.gz

I forgot to remove the pari doctest. It should also be removed since these parents should not have coercions going in both directions.

This is taken care of in the new patch.

@maxthemouse
Copy link
Mannequin

maxthemouse mannequin commented Oct 7, 2009

comment:8

In that case, everything looks good. A quick retest also passes. ~ Adam

@maxthemouse
Copy link
Mannequin

maxthemouse mannequin commented Oct 7, 2009

Reviewer: Adam Webb

@mwhansen
Copy link
Contributor Author

Merged: sage-4.2.alpha0

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