Sum of subset products - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Calculators (and very old HP Computers) ( /forum-3.html)+--- Forum: HP Prime ( /forum-5.html)+--- Thread: Sum of subset products ( /thread-520.html) |

Sum of subset products - Joe Horn - 01-26-2014 09:14 AM
I hope somebody here can think of an elegant way of calculating the sum of the products of all the (n-1) element subsets of an n-element set in PPL. In other words: {A B} --> A+B {A B C} --> AB+AC+BC {A B C D} --> ABC+ABD+ACD+BCD etc. Brute force by looping is ... brutish. There must be an elegant way of doing this on the HP Prime, since it has so many list and array functions. Thanks in advance! RE: Sum of subset products - Joe Horn - 01-26-2014 10:03 AM
Found it: SumList(PiList(list)/list)). I'll write this up for a more accurate "parallel resistors" program in the Prime Program Library. |