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

symbolic functions dont work with numpy.int32 #8949

Closed
sagetrac-whuss mannequin opened this issue May 11, 2010 · 4 comments
Closed

symbolic functions dont work with numpy.int32 #8949

sagetrac-whuss mannequin opened this issue May 11, 2010 · 4 comments

Comments

@sagetrac-whuss
Copy link
Mannequin

sagetrac-whuss mannequin commented May 11, 2010

sage: import numpy
sage: a = numpy.array([1,2])
sage: type(a[0])
<type 'numpy.int32'>
sage: f(x) = x^2
sage: f(a[0])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
./sage-4.4.2/<ipython console> in <module>()

./sage-4.4.2/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.__call__ (sage/symbolic/expression.cpp:15476)()

./sage-4.4.2/local/lib/python2.6/site-packages/sage/symbolic/callable.pyc in _call_element_(self, _the_element, *args, **kwds)
    454         d = dict(zip(map(repr, self.arguments()), args))
    455         d.update(kwds)
--> 456         return SR(_the_element.substitute(**d))
    457
    458

./sage-4.4.2/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.substitute (sage/symbolic/expression.cpp:14850)()

./sage-4.4.2/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.coerce_in (sage/symbolic/expression.cpp:10193)()

./sage-4.4.2/local/lib/python2.6/site-packages/sage/structure/parent_old.so in sage.structure.parent_old.Parent._coerce_ (sage/structure/parent_old.c:3288)()

./sage-4.4.2/local/lib/python2.6/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.coerce (sage/structure/parent.c:6970)()

TypeError: no canonical coercion from <type 'numpy.int32'> to Callable function ring with arguments (x,)

CC: @jasongrout

Component: symbolics

Reviewer: Jeroen Demeyer

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

@sagetrac-whuss sagetrac-whuss mannequin added this to the sage-5.11 milestone May 11, 2010
@sagetrac-whuss sagetrac-whuss mannequin assigned burcin May 11, 2010
@jasongrout
Copy link
Member

comment:2

I think #8824 may have the solution for this.

@sagetrac-bascorp2
Copy link
Mannequin

sagetrac-bascorp2 mannequin commented May 26, 2010

comment:3

computer pictures

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@videlec
Copy link
Contributor

videlec commented Mar 28, 2015

comment:8

Hello,

I propose to close this as duplicates because of #18076. With the branch applied

sage: import numpy
sage: cos(numpy.float('12'))
0.8438539587324921

Though it is not perfect since the result is a Python float and not a numpy float.

Vincent

@videlec videlec removed this from the sage-6.4 milestone Mar 28, 2015
@jdemeyer
Copy link

Reviewer: Jeroen Demeyer

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

5 participants