如果有M个不同的盒子和N个相同的球

发布于 2024-08-13 11:06:11 字数 78 浏览 4 评论 0原文

我们需要把这些球放进盒子里。

州中的州可能有多少个?

这是计算机模拟谜题的一部分。我几乎忘记了所有的数学知识。

and we need to put these balls into boxes.

How many states of the states could there be?

This is part of a computer simulation puzzle. I've almost forget all my math knowledges.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

独闯女儿国 2024-08-20 11:06:11

我相信您正在寻找多项系数
我会检查自己并扩展我的答案。

编辑:
如果您查看我提供链接的维基百科文章,您可以看到您在问题中定义的 MN 对应于 m< /code> 和 nTheorem 部分中定义。

这意味着您的问题对应于:“将多项式展开为任意幂时可能的系数排序数是多少?”,其中 N 是幂,并且M 是多项式中变量的数量。

换句话说:
您要寻找的是对 M 变量多项式的多项系数求和,该多项式在求 N 次方时展开。

确切的方程有点长,但维基百科上解释得非常清楚。

为什么这是真的:
多项式系数为您提供了当分组为特定分组时在篮子之间排序相同球的方法数(例如,4 个球分为 3、1 和 1 - 在本例中 M=4 和 N=3)。对所有分组选项求和时,您将获得所有可能的组合。

我希望这对你有帮助。

I believe you are looking for the Multinomial Coefficient.
I will check myself and expand my answer.

Edit:
If you take a look at the wikipedia article I gave a link to, you can see that the M and N you defined in your question correspond to the m and n defined in the Theorem section.

This means that your question corresponds to: "What is the number of possible coefficient orderings when expanding a polynomial raised to an arbitrary power?", where N is the power, and M is the number of variables in the polynomial.

In other words:
What you are looking for is to sum over the multinomial coefficients of a polynomial of M variables expanded when raised to the power on N.

The exact equations are a bit long, but they are explained very clearly in wikipedia.

Why is this true:
The multinomial coefficient gives you the number of ways to order identical balls between baskets when grouped into a specific grouping (for example, 4 balls grouped into 3, 1, and 1 - in this case M=4 and N=3). When summing over all grouping options you get all possible combinations.

I hope this helped you out.

大姐,你呐 2024-08-20 11:06:11

这些注释一般解释了如何解决“盒子里的球”问题:球是否是否贴有标签、盒子是否贴有标签、每个盒子中是否必须至少有一个球等。

These notes explain how to solve the "balls in boxes" problem in general: whether the balls are labeled or not, whether the boxes are labeled or not, whether you have to have at least one ball in each box, etc.

木槿暧夏七纪年 2024-08-20 11:06:11

这是一个基本的组合问题(将相同的对象分配到不同的槽中)

状态数为[(N+M-1)选择(M-1)]

this is a basic combinatorial question (distribution of identical objects into non identical slots)

the number of states is [(N+M-1) choose (M-1)]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文