Question: How to apply a function to two unequal length lists

I want to divide every element of A1 list by every element of list A2. Lists are unequal length.


A1:= [a1, a2, a3];

A2:= [b1, b2];

Output would be:

[a1/b1, a2/b1, a3/b1, a1/b2, a2/b2, a3/b2]

I managed to do this by this means:

LinearAlgebra:-OuterProductMatrix([a1, a2, a3], [1/b1, 1/b2]); convert(%, list)

My questions are:

  1. Is there a more succinct, practical method?
  2. How about if I want to use a different operation like say adding or just use a function f?

Thank you all in advanced.

Please Wait...