MathGroup Archive 2006

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

Search the Archive

Re: HoldForm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68101] Re: [mg68094] HoldForm
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 24 Jul 2006 00:55:43 -0400 (EDT)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

A={{1,2},{3,4}};

B={{5,6},{7,-8}};

MapThread[HoldForm[#1 + #2] &, {A, -B},2]

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


Bob Hanlon

---- Bruce Colletti <vze269bv at verizon.net> 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
> 
> 


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