Re: Placeholders in matrix notation
- To: mathgroup at smc.vnet.net
- Subject: [mg29956] Re: Placeholders in matrix notation
- From: dooglefish at aol.communicate (D.F.)
- Date: Thu, 19 Jul 2001 03:57:27 -0400 (EDT)
- References: <9j39rr$ikv$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
>Subject: [mg29956] Re: Placeholders in matrix notation >From: "Hugh Philipp" hph at com.dtu.dk To: mathgroup at smc.vnet.net >Date: 7/18/01 2:20 AM Eastern Daylight Time >Message-id: <9j39rr$ikv$1 at smc.vnet.net> > >I've had this problem before and I have used at least a dozen clumsy work >arounds for it. > >Here is one: > >ff ={D[#[[1]],x],0}&; > >ff@{f[x],g[x]} > >Of course, I don't really like this method because you have to do the matrix >operations explicitly in the function - designating the elements. > > >The other way of doing it goes something like this: > >Unprotect[Times] > >d1 f_:=D[f,x] > >Protect[Times] > >{d1,0,d1}.{f[x],g[x],h[x]} > >I don't know if the gurus here think this is O.K. - I'm sure there will be >comments. > >Notice to that: > >d1 d1 f[x] > >evaluates to f''[x] > >...a nice 'feature'. - but BE CAREFUL becaue d1 d1 evaluates to 0. So - >there might be some other hidden 'features' with this approach. > >For example, the vector: {d1 d1,d1} evaluates to {0,d1} > >Hope this helps, > >Hugh. Yes, it works very well. Thank you. \!\(\* RowBox[{\(Unprotect[Times]\), "\n", \(d1\ f_ := D[f, x]\), "\n", \(d2\ f_ := D[f, y]\), "\n", \(d3\ f_ := D[f, x, y]\), "\n", \(Protect[Times]\), "\n", RowBox[{"MatrixForm", "[", RowBox[{ RowBox[{"(", GridBox[{ {"d1", "0"}, {"0", "d2"}, {"0", "d3"} }], ")"}], ".", RowBox[{"(", GridBox[{ {\(f1[x, y]\), \(f2[x, y]\), \(f3[x, y]\)}, {\(g1[x, y]\), \(g2[x, y]\), \(g3[x, y]\)} }], ")"}]}], "]"}]}]\) -Doug