Use X.applyfunc(Integer), or X.applyfunc(round) if you want to round
(Integer will truncate).

Aaron Meurer

On Mon, Dec 7, 2015 at 11:58 PM, Oyster <[email protected]> wrote:
> If we do not use enumeration, can we do float/int on every Matrix element? I
> ask this because I want to show my result while round the float number to
> integer. Thanks
>
>
> currently
>
>>>> from sympy import *
>>>> X=Matrix([1.0, 2.0, 3.14])
>>>> print X
> Matrix([[1.00000000000000], [2.00000000000000], [3.14000000000000]])
>>>> print X.evalf(1)     #in fact, I need Matrix([[1], [2], [3]])
> Matrix([[1.], [2.], [3.]])
>>>> print int(X.evalf(1))
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: int() argument must be a string or a number, not
> 'MutableDenseMatrix'
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/f2bf4a42-a4de-4e43-8b48-d7bf9837643c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2B896RPYN_WYyqcSYrbxm5SzofyZQ_mWdnzp5LovNes%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to