Ask Your Question

raykan's profile - activity

2022-08-12 00:10:50 +0100 received badge  Nice Question (source)
2022-08-12 00:10:45 +0100 received badge  Famous Question (source)
2021-02-05 00:01:37 +0100 received badge  Famous Question (source)
2020-08-27 17:55:48 +0100 received badge  Popular Question (source)
2020-08-27 17:55:48 +0100 received badge  Notable Question (source)
2020-06-06 11:27:24 +0100 received badge  Notable Question (source)
2020-06-06 11:27:24 +0100 received badge  Popular Question (source)
2019-01-27 17:56:45 +0100 received badge  Supporter (source)
2019-01-27 17:56:33 +0100 received badge  Scholar (source)
2019-01-27 16:34:47 +0100 asked a question Convert real matrix into Integer matrix

Suppose I have a real matrix with integer entries

A = matrix(RR,[[1,2,3],[4,5,6]])

I would like to convert it to an Integer matrix (ZZ). I can do it element by element but is there a function that will do this for the entire matrix. Doing B=ZZ(A) will return an error message

unable to coerce <type 'sage.matrix.matrix_generic_dense.matrix_generic_dense'=""> to an integer.

2019-01-24 21:49:23 +0100 received badge  Editor (source)
2019-01-24 21:46:38 +0100 answered a question How do I save a rational matrix for Mathematica and Matlab to read?

Thanks so much. Just to add this from my experience. In Sage, I do this (say A is the rational matrix):

o = open('file.txt','w'); o.write(str(A._mathematica_init())); o.close();

Then in Mathematica, I do this

A = ReadList("file.txt")[[1]]

I need the [[1]] to make it as a matrix. Otherwise, it is a 3-dimensional matrix.

For MATLAB, octave_init does not work. Any suggestions would be appreciated.

I also never get Mathematica interface working in Sage (8.5 Windows 64bit version) :(

2019-01-23 18:31:23 +0100 received badge  Student (source)
2019-01-23 07:26:50 +0100 asked a question How do I save a rational matrix for Mathematica and Matlab to read?

Hi,

I create a rational matrix (rather large, say 1000x1000), and I want to save it in a file that can be read by Mathematica or MATLAB (with symbolic toolbox). Is there a simple way to do that?

Right now, I use

o = open('file.txt','w')

o.write(str(A))

o.close()

where A is the matrix. However, it has these "[" and "]" at the beginning of line that makes it difficult for Mathetmatica and MATLAB to read. Any suggestions would be appreciated.