On Jun 17, 8:29 am, goric <[EMAIL PROTECTED]> wrote:
> Hello,
> I need some methods that permit to add a line or a column in a matrix
> in that way:
>
> M = Matrix(3,3,lambda i,j: i+j)
> M
> ⎡0 1 2⎤
> ⎢1 2 3⎥
> ⎣2 3 4⎦
> V = Matrix(3,1,lambda i,j: 3+i+j)
> V
> ⎡3⎤
> ⎢4⎥
> ⎣5⎦
> M.append_col(V)
> M
> ⎡0 1 2 3⎤
> ⎢1 2 3 4⎥
> ⎣2 3 4 5⎦
> VL = [3,4,5,6]
> M.append_line(VL)
> M
> ⎡0 1 2 3⎤
> ⎢1 2 3 4⎥
> ⎢2 3 4 5⎥
> ⎣3 4 5 6⎦
>
> Can I implement them? The names I gave to them are good or do you
> suggest any other name? I'll wait your opinion to start working.
I'd suggest using names:
insert_row, insert_column, append_row, append_column
where insert_row(index, row) etc.
Another option is to have something similar to numpy
insert(index, seq, axis=None)
append(seq, axis=None)
See numpy.insert and numpy.append functions for more info.
Pearu
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---