multiply two vectors, component by component [closed]

multiply two vectors, component by component [closed]



Would like to take two vectors and multiply components at the same index.For example a1, a2, a3 x b1, b2, b3 to produce a1 b1, a2 b2, a3 b3.
The following works, but are there some alternatives?


aMat = DiagonalMatrix[a1, a2, a3];
bMat = DiagonalMatrix[b1, b2, b3];
Diagonal @ Dot[aMat, bMat]
result: a1 b1, a2 b2, a3 b3



This question appears to be off-topic. The users who voted to close gave this specific reason:





$begingroup$
a1,a2,a3*b1,b2,b3 will give the required answer
$endgroup$
– mikado
Sep 8 '18 at 19:22


a1,a2,a3*b1,b2,b3




1 Answer
1



No need to do anything fancy. This is just how ordinary list multiplication works:


a1, a2, a3 b1, b2, b3



yields


a1 b1, a2 b2, a3 b3





$begingroup$
thanks! didn't even think to try that.
$endgroup$
– user6546
Sep 8 '18 at 19:25

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế