Ask Your Question

Selfes's profile - activity

2020-09-04 22:51:44 +0100 received badge  Notable Question (source)
2019-01-27 16:24:00 +0100 received badge  Popular Question (source)
2017-04-25 15:21:53 +0100 commented answer How to create a Matrix with real numbers?

Thank you very much.

2017-04-24 20:22:59 +0100 received badge  Scholar (source)
2017-04-24 17:06:42 +0100 asked a question How to create a Matrix with real numbers?

I try to create a matrix with real number. When I try to create one, I get a TypeError message


sage: Z = matrix(2,2)
sage: Z[0,0] = sqrt(2)
TypeError                                 Traceback (most recent call last)
<ipython-input-29-94541bcbfa2b> in <module>()
----> 1 Z[Integer(0),Integer(0)] = sqrt(Integer(2))

sage/matrix/matrix0.pyx in sage.matrix.matrix0.Matrix.__setitem__ (/build/sagemath/src/sage-

sage/matrix/matrix0.pyx in sage.matrix.matrix0.Matrix._coerce_element (/build/sagemath/src/sage-

sage/structure/parent.pyx in sage.structure.parent.Parent.__call__ (/build/sagemath/src/sage-

sage/structure/coerce_maps.pyx in sage.structure.coerce_maps.NamedConvertMap._call_ 

sage/symbolic/expression.pyx in sage.symbolic.expression.Expression._integer_ (/build/sagemath/src/sage-

TypeError: unable to convert sqrt(2) to an integer

Since I couldn't really find a way to create one in the documentation (at least I didn't find one), I would like to ask, if there is a easy solution to this.

Thank you very much