On Tuesday, March 24, 2015 at 12:49:57 PM UTC+1, Oscar Alberto Castillo 
Felisola wrote:
>
> I'd like to obtain something like
>
> f11 = function('f11', t,r)
> f12 = function('f12', t,r)
> f21 = function('f21', t,r)
> f22 = function('f22', t,r)
> M = matrix(2,2, [[f11, f12], [f21, f22]])
>
>
 
Since this is doable via a functional mapping from the indices to the 
desired objects, you can use the matrix to do this via the lambda operator:

sage: var("t r")
(t, r)
sage: matrix(5, 5, lambda x,y : function("f%s%s" % (x,y), t, r))
[f00(t, r) f01(t, r) f02(t, r) f03(t, r) f04(t, r)]
[f10(t, r) f11(t, r) f12(t, r) f13(t, r) f14(t, r)]
[f20(t, r) f21(t, r) f22(t, r) f23(t, r) f24(t, r)]
[f30(t, r) f31(t, r) f32(t, r) f33(t, r) f34(t, r)]
[f40(t, r) f41(t, r) f42(t, r) f43(t, r) f44(t, r)]

It's zero-based indexed, as everything else in Python, but you can fix it 
easily. Hope this helps.

-- Harald



-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to