Multiplication with mathematica

Click For Summary
SUMMARY

The discussion focuses on multiplying two lists in Mathematica to achieve element-wise multiplication. Users encountered issues when attempting to use the dot operator (.) for this purpose, which results in a scalar dot product. The correct approach is to use either a space between the two lists or the asterisk (*) operator, which will yield the desired array multiplication result.

PREREQUISITES
  • Familiarity with Mathematica syntax
  • Understanding of list data structures in programming
  • Knowledge of array operations
  • Basic concepts of element-wise multiplication
NEXT STEPS
  • Explore Mathematica's array manipulation functions
  • Learn about different multiplication operators in Mathematica
  • Investigate list comprehensions and their applications in Mathematica
  • Review documentation on Mathematica's handling of lists and arrays
USEFUL FOR

Mathematica users, programmers working with list operations, and anyone interested in performing mathematical computations using array multiplication.

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
3K
  • · 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 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K