Re: Telling Mathematica that a symbol is going to be a List?
- To: mathgroup at smc.vnet.net
- Subject: [mg50829] Re: Telling Mathematica that a symbol is going to be a List?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 22 Sep 2004 04:52:09 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <ciqvop$in9$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, m = Hold[{{d[[1]], 0, 0}, {0, d[[2]], 0}, {0, 0, d[[3]]}}]; m /. {d -> {d1, d2, d3}} // ReleaseHold Regards Jens AES/newspost wrote: > > I want to define a function containing parameters that are going to be > elements in a list, e.g. something like > > m := { { d[[1]], 0, 0}, {0, d[[2]], 0}, {0, 0, d[[3]]} > > but not define the list of values of d until later (and not put the > parameters in as explicit arguments of m just to keep the appearance > less cluttered and typing easier). > > If I then give an input line > > m /. {d -> {d1, d2, d3} } // MatrixForm > > I get "Part::partd" errors -- but the matrix then displays correctly. > > I can of course just Off[] the errors -- but is there a better way.