Hi Folks -- Suppose I have three vectors A, B, and C ... or more specifically A1:A5, B1:B5, and C1:C5.
Suppose I want to calculate (A+B)•C. I start by adding A to B, as vectors. That means adding them component-by-component. Then I multiply by C, multiplying component-by-component. Then I sum over components. For floats, this is super-easy to do: =sumproduct(A1:A3+B1:B3,C1:C3) [1] However, for complex numbers I don't see how to do it. The obvious approach fails several times over. 1a) For one thing, the "+" operator cannot be used to form the sum A+B. 1b) The imsum(...) function cannot be plugged into equation [1] in any obvious way. Specifically, imsum(A1:A5,B1:B5) returns a scalar, not the vector sum, i.e. not the component-by-component sum. 2) There does not seem to be any imsumproduct(...) AFAICT. I could easily write a function to do the vector sum, component by component ... but I have a question. What should such a function be called? -- Before you answer "imvectorsum" beware that we will want the corresponding component-by-component product, and we should *not* call that the "vector product" because that means something else. -- The best I've come up with so far is imcomsum(...) and imcomproduct(...). If anybody has any constructive suggestions, please let us know. ======= As a related point, suppose I want to multiply A1:A5 by a scalar. For floats this is easy, but for complex vectors I don't see any easy way to do it. In particular, improduct(A1:A5,3) returns a scalar, not the component-by-component product. I reckon we can get imcomproduct(...) to handle this case. ======= As yet another related point, imsumproduct(...) seems easy and non-problematic. ======= Also: Given a sumproduct function, one can code the dot product, namely =imsumproduct(A1:A5,imconjugate(B1:B5)) [2] At this point another question arises: Given the tremendous practical importance of [2], would it be worth hard-coding this as a built-in function? =imdotproduct(A1:A5,B1:B5) [3] ============================ See also next message. _______________________________________________ gnumeric-list mailing list gnumeric-list@gnome.org https://mail.gnome.org/mailman/listinfo/gnumeric-list