symbolic linear algebra: beginner questions

41 views
Skip to first unread message

Felix Breuer

unread,
Nov 24, 2009, 11:59:03 AM11/24/09
to sage-support
Hello!

I want to do symbolic linear algebra with Sage, i.e. I want to
calculate, say, the determinant of a matrix, where the entries of the
matrix are symbolic expressions. I am under the impression that maxima
is the right package for this task. Correct?

I am now faced with the following problem: I have a list of vectors
(with symbolic entries) and I want to form a matrix that has these
vectors as columns. How do I achieve that?

For what it's worth, here is what I tried:

a = maxima('matrix([a1],[a2])')
b = maxima('matrix([b1],[b2])')
c = maxima('matrix([c1],[c2])')
M = maxima('matrix(a-c,b-c)')
M = maxima('matrix(transpose(a-c),transpose(b-c))')

In the last two lines I get errors about the arguments being "invalid
rows".

Any suggestions?

Thanks,
Felix

William Stein

unread,
Nov 24, 2009, 12:27:09 PM11/24/09
to sage-support
Use Sage. Don't use Maxima.

var('a1,a2,b1,b2,c1,c2')
a = matrix([[a1],[a2]])
b = matrix([[b1],[b2]])
c = matrix([[c1],[c2]])
M = (a-c).stack(b-c)
N = transpose(a-c).stack(transpose(b-c))

or

R.<a1,a2,b1,b2,c1,c2> = QQ[]
a = matrix([[a1],[a2]])
b = matrix([[b1],[b2]])
c = matrix([[c1],[c2]])
M = (a-c).stack(b-c)
N = transpose(a-c).stack(transpose(b-c))

See

http://sagenb.org/home/pub/1123/

William

William Stein

unread,
Nov 24, 2009, 12:28:30 PM11/24/09
to sage-support
On Tue, Nov 24, 2009 at 9:27 AM, William Stein <wst...@gmail.com> wrote:
> On Tue, Nov 24, 2009 at 8:59 AM, Felix Breuer <fe...@fbreuer.de> wrote:
>> Hello!
>>
>> I want to do symbolic linear algebra with Sage, i.e. I want to
>> calculate, say, the determinant of a matrix, where the entries of the
>> matrix are symbolic expressions. I am under the impression that maxima
>> is the right package for this task. Correct?
>>
>> I am now faced with the following problem: I have a list of vectors
>> (with symbolic entries) and I want to form a matrix that has these
>> vectors as columns. How do I achieve that?
>>
>> For what it's worth, here is what I tried:
>>
>> a = maxima('matrix([a1],[a2])')
>> b = maxima('matrix([b1],[b2])')
>> c = maxima('matrix([c1],[c2])')
>> M = maxima('matrix(a-c,b-c)')
>> M = maxima('matrix(transpose(a-c),transpose(b-c))')
>>
>> In the last two lines I get errors about the arguments being "invalid
>> rows".
>>
>> Any suggestions?
>
> Use Sage.  Don't use Maxima.

Oh, but just for the record, Sage may use Maxima automatically in the
background for some operations, when you do what I suggested.


> var('a1,a2,b1,b2,c1,c2')
> a = matrix([[a1],[a2]])
> b = matrix([[b1],[b2]])
> c = matrix([[c1],[c2]])
> M = (a-c).stack(b-c)
> N = transpose(a-c).stack(transpose(b-c))
>
> or
>
> R.<a1,a2,b1,b2,c1,c2> = QQ[]
> a = matrix([[a1],[a2]])
> b = matrix([[b1],[b2]])
> c = matrix([[c1],[c2]])
> M = (a-c).stack(b-c)
> N = transpose(a-c).stack(transpose(b-c))
>
> See
>
>  http://sagenb.org/home/pub/1123/
>
> William
>



--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org
Reply all
Reply to author
Forward
0 new messages