Skip to main content
6-Contributor
September 12, 2022
Solved

Unequal vector multiplication

  • September 12, 2022
  • 1 reply
  • 1166 views

I have a 4 row vector (A) and a 2 row vector (B) and I want to multiply the 1st two row elements of (A) each by the first element of (B) and the 3rd & 4th row elements of (A) each by the 2nd row element of (B). I want to do this element by element to give me a 4 row vector at the end. It's made more complicated by the fact the numbers of rows in both vectors can change although (A) will always have twice the number of rows as (B). I thought of trying to match the number of rows in (B) to (A) so I can simply multiply the two but not sure how to go about this. 

 

Any help appreciated. 

 

Best answer by Werner_E

Here is a function which should do the job:

Werner_E_0-1663023943962.png

MC15 sheet attached

1 reply

Werner_E25-Diamond IAnswer
25-Diamond I
September 12, 2022

Here is a function which should do the job:

Werner_E_0-1663023943962.png

MC15 sheet attached

Gaz_Ball6-ContributorAuthor
6-Contributor
September 13, 2022

Thanks very much Werner, that works exactly how I was hoping it would!

 

I've only been using Mathcad/Prime for a relatively short time so it's great that this forum exists to help people out.