使用mathematica 4.0生成排列
您好,我正在使用 Mathematica 4.0。我试图找到所有排列,例如,假设有两个数字 0 和 0。 1. 我试图在 3 个(比如说)位置重复使用这两个数字来生成所有排列,例如 {1,1,1},{1,1,0},{1,0,1},{1, 0,0}...我还尝试将每个排列放入一个数组中。 Mathematica 4.0 中是否有任何代码或命令可以让我完成所有这些事情。请帮助我完成这项任务...
Hi I am using Mathematica 4.0. I am trying to find all the permutations, for example, say there are two numbers 0 & 1. I am trying to generate all permutations using these two numbers in 3(say) places with repetition i.e. like {1,1,1},{1,1,0},{1,0,1},{1,0,0}... Also I am trying to put each of the permutation in an array. Is there any code or command in Mathematica 4.0 by which I can do all these things. Please help me in this task...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 Mathematica 5.1 及更高版本中,有一个函数
Tuples
可以完成您想要的操作。你可以尝试例如:
但我不知道这是否适用于M4.0。我想应该是这样,但我无法检查。一般来说,使用4.0这样的过时版本,你会遇到各种各样的困难,包括缺乏功能、性能和界面(前端)较差、某些在后续版本中修复的错误、与后续编写的代码不兼容等。版本,并获取帮助。对于 Mathematica 来说尤其如此,因为自 4.0 以来,Mathematica 在各个方面都取得了巨大的进步。因此,如果您打算定期使用它,我强烈建议升级。
In Mathematica 5.1 and higher, there is a function
Tuples
which does what you want. You may tryFor example:
But I don't know if this works in M4.0. It should, I guess, but I can not check. Generally, you will face tons of difficulties of various kinds working with such an obsolete version as 4.0, including lacking the functionality, inferior performance and interface (front-end), certain bugs that were fixed in later versions, incompatibility with code written in later versions, and getting help. This is especially true for Mathematica given huge advances in all sorts of directions introduced since 4.0. So, if you plan to use it regularly, I'd strongly suggest to upgrade.
一种考古问题:D。版本 4 已经很老了!
Kind of archeological question :D. Version 4 is pretty old!
顺便说一句 - 请注意,所有先前版本的 Mathematica 文档都可以在 http://reference.wolfram 上免费在线获取。 com/legacy - 专门针对版本 4,请参阅 http://reference.wolfram.com/legacy /v4。
您可以通过 google 搜索 v4 文档:
permutations site:reference.wolfram.com/legacy/v4
,它会显示 v4 函数 Permutations http://reference.wolfram.com/legacy/v4/RefGuide/Permutations.html 其中包含示例和旧 Mathematica 书籍其他部分的一些链接。
Just an aside - please note that documentation for all previous versions of Mathematica is freely available online at http://reference.wolfram.com/legacy - specifically for version 4, see http://reference.wolfram.com/legacy/v4.
You can search the v4 docs via google:
permutations site:reference.wolfram.com/legacy/v4
which turns up the v4 function Permutations http://reference.wolfram.com/legacy/v4/RefGuide/Permutations.html which has examples and a few links to other parts of the old Mathematica Book.