matrix over TropicalSemiring
I try to build a matrix with entries from TropicalSemiring, but I get an error. This was done on SageMathCell:
T=TropicalSemiring(RR)
matrix([[T(1),T(2)],[T(3),T(4)]])
and yields:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-415e7359a236> in <module>()
1 T=TropicalSemiring(RR)
----> 2 matrix([[T(Integer(1)),T(Integer(2))],[T(Integer(3)),T(Integer(4))]])
/home/sc_serv/sage/local/lib/python2.7/site-packages/sage/matrix/constructor.pyc in _matrix_constructor(*args, **kwds)
647
648 if nrows > 0 and ncols > 0 and ring is None:
--> 649 entries, ring = prepare(entries)
650
651 elif isinstance(args[0], dict):
/home/sc_serv/sage/local/lib/python2.7/site-packages/sage/matrix/constructor.pyc in prepare(w)
805 ring = rings.CDF
806 elif not is_Ring(ring):
--> 807 raise TypeError("unable to find a common ring for all elements")
808 return entries, ring
809
TypeError: unable to find a common ring for all elements
If instead I use this syntax:
T=TropicalSemiring(RR)
matrix(T,[[1,2],[3,4]])
I get a different error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-1-02718e38d49f> in <module>()
1 T=TropicalSemiring(RR)
----> 2 matrix(T,[[Integer(1),Integer(2)],[Integer(3),Integer(4)]])
/home/sc_serv/sage/local/lib/python2.7/site-packages/sage/matrix/constructor.pyc in _matrix_constructor(*args, **kwds)
713 raise ValueError("Invalid matrix constructor. Type matrix? for help")
714 else:
--> 715 raise ValueError("Invalid matrix constructor. Type matrix? for help")
716
717 if nrows is None:
ValueError: Invalid matrix constructor. Type matrix? for help
How can I do it correctly?