How can I determine the expected sum of randomly chosen numbers from vector? (combinatorics)
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
T FW
el 23 de Abr. de 2020
Respondida: Joost
el 26 de Abr. de 2020
Hello there,
I would like to solve the following problem with Matlab.
If you choose two numbers out of this vector [-1 -1 -1 1], what is their sum, on average?
With nchoosek(4,2) I can determine that there are 6 combinations, but how can I iterate through these combinations to determine each of the 6 sums?
Thanks,
Tobias
0 comentarios
Respuesta aceptada
Joost
el 26 de Abr. de 2020
The nchoosek function can give you all combinations of 2 elements from the vector.
Instead of nchoosek(4, 2), use nchoosek([-1 -1, -1, 1], 2)
I am not sure how it deals with replicas.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Elementary Math en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!