MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: HoldForm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68100] Re: HoldForm
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Mon, 24 Jul 2006 00:55:41 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <e9v992$gjr$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Bruce Colletti wrote:
> Re Mathematica 5.2.0.0.
> 
> This code displays the component differences of matrix subtraction (A-B):
> 
> A = {{1, 2}, {3, 4}};
> 
> B = {{5, 6}, {7, -8}};
> 
> Map[MapThread[HoldForm[#1 - #2] &, {A[[#]], B[[#]]}] &, Range@2]
> 
> As desired, the output is {{1 - 5, 2 - 6}, {3 - 7, 4--8}}.
> 
> Two questions:
> 
> - What's a better way to do this?
> 
> - How can I replace the -- by +? 
> 
> Thankx.
> 
> Bruce
> 
> 
A simpler approach that my preceding post is

MapThread[TraditionalForm[HoldForm[#1] - #2] &, Flatten /@ {A, B}]

that returns {1 - 5, 2 - 6, 3 - 7, 4 + 8}.

Regards,
Jean-Marc


  • Prev by Date: Seemingly strange behavior - HoldForm and Evaluate
  • Next by Date: simple antiderivative
  • Previous by thread: Re: HoldForm
  • Next by thread: Re: HoldForm