Ask Your Question

Can I define an n-dimensional matrix?

asked 2013-06-15 08:52:18 -0500

mudd1 gravatar image

updated 2013-06-15 09:09:28 -0500

I'm sure this is a basic question that has been asked before but I'm too stupid to find it.

What I'd like to do is something like this

assume(n, 'integer')
VS = MatrixSpace(SR, n, 1)

to get the space of all n×1 matrices, i.e. column vectors. Is it at all possible to define a generalized n-dimensional vector or n×n matrix? Or am I just taking the completely wrong approach here?

Edit: Forgot to mention that the error I get is

ValueError: cannot convert n to int
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2013-06-16 01:41:07 -0500

tmonteil gravatar image

updated 2013-06-16 01:51:19 -0500

There is no way to define a MatrixSpace without fixing the number of columns and rows. You can see this by looking into the code:

sage: MatrixSpace??
    def __init__(self,...
        nrows = int(nrows)
        ncols = int(ncols)

Hence, Sage can not accept a symbolic variable n as the number of columns/rows.

A question remains : what do you want to ask to Sage about such a general matrix space where entries are not determined ? There maybe a workaround for a precise question.

edit flag offensive delete link more


Well, generally what I'd like to do is some linear algebra without specifying the number of dimensions but just getting results that are true for arbitrary *n*. Guess that was to general an answer? I figured out my current problems by hand but it'd still be nice to have a software that can do such things.

mudd1 gravatar imagemudd1 ( 2013-06-16 12:43:51 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-06-15 08:52:18 -0500

Seen: 130 times

Last updated: Jun 16 '13