-
Muology
posted in technical issues • read moreThank you all.
@whale-av
@ben.wes
How would you implement the combinations formula (C (n, r) = n!/r! (n-r)!) in an efficient way? So that an n and r can be entered in and print all possible combinations?
I used the factorial expression object to calculate the combinations formula using- expr (fact($f1)) / ((fact($f2)) * (fact($f1 - $f2)))
What approach would you take to calculate the combinations formula without using the expressions object?
What approach would you take to calculate the combinations formula with using the expressions object?Adding a List and or Array
How would you approach being able to add any type of customizable list/array (for example, list/array = A, B, C, D, E, F) and then telling the patch you want to generate any type of combination and then print all possible combinations?
For example, customizable list/array = A, B, C, D, E, F (n)
generate all possible combinations of 2 (r) also customizable
Print-
All possible combinations = 15
A, B
A, C
A, D
A, E
A, F
B, C
B, D
B, E
B, F
C, D
C, E
C, F
D, E
D, F
E, F -
Muology
posted in technical issues • read morefac.pd
I built a patch that is supposed allow you to enter in a number and calculate the factorial (without using the expressions object).
Factorial of n = n! = n × (n – 1) × (n – 2) × … × 1
Example 5! is 5 × 4 × 3 × 2 × 1 = 120I used this max msp factorial patch as a guide.
Looking for assistance in making the factorial patch in Pure Data as efficient as possible.
I want to build this patch using Pure Data primitives instead of using the expression object.Please note that there is a discussion here that using float values instead of integers allows the recursive method for calculating factorials to have higher input values before failure.
https://cycling74.com/forums/recursive-factorial-function-limits