Re: Matrices-in-functions question
- To: mathgroup at smc.vnet.net
- Subject: [mg20522] Re: [mg20417] Matrices-in-functions question
- From: BobHanlon at aol.com
- Date: Wed, 27 Oct 1999 02:05:13 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Aram,
mat = Array[b, {3, 3}];
z[m_] := m[[1, 1]] * a + m[[1, 2]]
z[mat]
a b[1, 1] + b[1, 2]
Bob Hanlon
In a message dated 10/26/1999 7:47:53 AM, aram at sirius.com writes:
>Here is a simple one, but I can't work it out.
>
>I would like to be able to define a function this way:
>
>z=mat[[1]][[1]] a + mat[[1]][[2]]
>
>without specifying what "mat" is explicitly. I would evaluate it later
>this
>way:
>
>z/.mat->somePredefinedMatrix
>
>Of course, Mathematica complains about the definition (Part specification
>mat[[1]] is
>longer than depth of object) ... is there a way to make this fly?
>