I dont quite understand the defining rule for your matrix, but in
general you can just put whichever rule you have as a function
def f(i,j):
if ((i<=5) and (j in [1,2,3, 7, ..., 20]))
return 1
if i in [6,7,13,..., 20]:
return 3
return -1
and then create your matrix using this function:
m = Matrix([[ f(i,j) for j in [1..20]] for i in [1..20]])
For this to work, the sets in the definition of f have to be well
defined.
Hope this helps
Cheers
Javier
On Jun 4, 9:19 pm, "Kim, In-Jae" <[email protected]> wrote:
> Thank you for your help, Jason.
>
> Can I get some help on the following matrix too?
>
> a_{i,j} = 1 for 1 \leq i \leq 5 and j \in \{1,2,3, 7, ..., 20};
> a_{i,j} =3 for i \in \{6, 7, 13, ..., 19\};
> a_{ij}=-1 otherwise
--~--~---------~--~----~------------~-------~--~----~
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/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---