Mathematica Multiplication with mathematica

Click For Summary
To multiply two lists element-wise in the format {a1, b1, c1...} * {a2, b2, c2...}, the correct command is either using a space between the lists (a b) or using the asterisk (a*b). The dot operator (a.b) results in a scalar dot product, which is not suitable for element-wise multiplication. Using the appropriate syntax will yield the desired output of {a1*a2, b1*b2, c1*c2,...}.
jtassilo
Messages
14
Reaction score
0
Hi,
I want to multiply two lists of the format {a1,b1,c1...}*{a2,b2,c2...} to obtain the list {a1*a2,b1*b2,c1*c2,...}. I tried using . to multiply the two lists but that didn't work.
What command do I have to use to obtain the desired result?
Thanks
 
Physics news on Phys.org
a.b will give the scalar dot product of a and b. You want a b (space between a and b) or a*b either of which will give you the array multiplication of a and b.
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 14 ·
Replies
14
Views
3K