Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14913 > unrolled thread

Re: Working with arrays

Started byBob Hanlon <hanlonr357@gmail.com>
First post2013-06-17 10:16 +0000
Last post2013-06-17 10:16 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Working with arrays Bob Hanlon <hanlonr357@gmail.com> - 2013-06-17 10:16 +0000

#14913 — Re: Working with arrays

FromBob Hanlon <hanlonr357@gmail.com>
Date2013-06-17 10:16 +0000
SubjectRe: Working with arrays
Message-ID<kpmnls$h37$1@smc.vnet.net>
Clear[IA,xtest,$Post];

CenterDot is not really an operator, it is a notation

IA\[CenterDot]xtest

IA\[CenterDot]xtest

IA=Array[a,{3,3}];

xtest=Array[x,3];

IA\[CenterDot]xtest

{{a[1,1],a[1,2],a[1,3]},{a[2,1],a[2,2],a[2,3]},{a[3,1],a[3,2],a[3,3]}}\[CenterDot]{x[1],x[2],x[3]}

If you want CenterDot to carry out the operation Dot, you can use a
replacement rule

IA.xtest == Dot[IA,xtest]==
Inner[Times,IA,xtest,Plus]==
(IA\[CenterDot]xtest/.CenterDot->Dot)==
(CenterDot[IA,xtest]/.CenterDot->Dot)

True

If you want CenterDot to always act like Dot with lists then use $Post to
automatically use the replacement rule.

$Post=#/.CenterDot[x_List,y_List]->
Dot[x,y]&;

IA.xtest == Dot[IA,xtest]==
Inner[Times,IA,xtest,Plus]==
IA\[CenterDot]xtest==CenterDot[IA,xtest]

True

Symbolic use of CenterDot is not changed

x\[CenterDot]y

x\[CenterDot]y


Bob Hanlon


On Sun, Jun 16, 2013 at 5:19 AM, amannucci
<Anthony.J.Mannucci@jpl.nasa.gov>wrote:

> I thought I understood variables. This sequence completely mystifies me:
> Clear[lA, xtest]
> lA = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
> xtest = {4, 5, 6};
> lA\[CenterDot]xtest (* First case *)
> {{a, b}, {c, d}} . {x, y} (* Second case *)
>
> The output is:
>
> {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}\[CenterDot]{4, 5, 6}
>
> {a x + b y, c x + d y}
>
> How do I force matrix multiplication to actually occur, as in the second
> answer? Why does Mathematica do the matrix multiply in the second case but
> not the first?
>
> Thanks for any help.
>
> -Tony
>
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web