How to remove list to obtain sequence ?



On Thursday 28 of July 2011 16:03:27 you wrote:
> diag_matrix does not take an n-long list as an argument, but takes n
> individual arguments.  (as documented)

Yes, I knew it, but I didn't know how to use it with many individual 
arguments. You give me the answer with "apply" below.

> Try this:
> 
> (%i1) display2d:false;
> (%o1) false
> (%i2) P: makelist(P[i], i, 1, 3);
> (%o2) [P[1],P[2],P[3]]
> (%i3) apply('diag_matrix,P);
> (%o3) matrix([P[1],0,0],[0,P[2],0],[0,0,P[3]])

Thank you very much.

Regards,
Zbigniew