login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Assume that I have a List, like:

fricas
(1) -> L := [[- 1,3,- 3,1],[3,- 6,3],[- 3,3],[1]]

\label{eq1}\left[{\left[ - 1, \: 3, \: - 3, \: 1 \right]}, \:{\left[ 3, \: - 6, \: 3 \right]}, \:{\left[ - 3, \: 3 \right]}, \:{\left[ 1 \right]}\right](1)
Type: List(List(Integer))

(which is calculated from some earlier expressions). How can I convert it into a SquareMatrix.

fricas
L2:=[concat([L.i.j for j in 1..#L.i],[0 for j in ((#L.i)+1)..#L]) for i in 1..#L]

\label{eq2}\left[{\left[ - 1, \: 3, \: - 3, \: 1 \right]}, \:{\left[ 3, \: - 6, \: 3, \: 0 \right]}, \:{\left[ - 3, \: 3, \: 0, \: 0 \right]}, \:{\left[ 1, \: 0, \: 0, \: 0 \right]}\right](2)
Type: List(List(Integer))

Namely I want to have a matrix like:

fricas
A := matrix L2

\label{eq3}\left[ 
\begin{array}{cccc}
- 1 & 3 & - 3 & 1 
\
3 & - 6 & 3 & 0 
\
- 3 & 3 & 0 & 0 
\
1 & 0 & 0 & 0 
(3)
Type: Matrix(Integer)

so that I can do

fricas
vp := vector[p0,p1,p2,p3]

\label{eq4}\left[ p 0, \: p 1, \: p 2, \: p 3 \right](4)
Type: Vector(OrderedVariableList([p0,p1,p2,p3]))

and

fricas
vp * A

\label{eq5}\left[{p 3 -{3 \  p 2}+{3 \  p 1}- p 0}, \:{{3 \  p 2}-{6 \  p 1}+{3 \  p 0}}, \:{{3 \  p 1}-{3 \  p 0}}, \: p 0 \right](5)
Type: Vector(Polynomial(Integer))




  Subject:   Be Bold !!
  ( 15 subscribers )  
Please rate this page: