| 1 | initial version |
The issue is that within the notebook or the command-line, Sage preparse 2 to Integer(2), and the numpy code thicks that since it isn't an int, that it should be a tuple. The following are work-arounds:
sage: np.random.multinomial(20, [1/6.]*6, size=2r)
array([[3, 1, 1, 2, 5, 8],
[2, 5, 3, 6, 4, 0]])
sage: np.random.multinomial(20, [1/6.]*6, size=int(2))
array([[4, 4, 5, 3, 1, 3],
[3, 4, 3, 4, 1, 5]])
| 2 | No.2 Revision |
The issue is that within the notebook or the command-line, Sage preparse 2 to Integer(2), and the numpy code thicks thinks that since it isn't an int, that it should be a tuple. The following are work-arounds:
sage: np.random.multinomial(20, [1/6.]*6, size=2r)
array([[3, 1, 1, 2, 5, 8],
[2, 5, 3, 6, 4, 0]])
sage: np.random.multinomial(20, [1/6.]*6, size=int(2))
array([[4, 4, 5, 3, 1, 3],
[3, 4, 3, 4, 1, 5]])
| 3 | No.3 Revision |
The issue is that within the notebook or the command-line, Sage preparse preparses 2 to Integer(2), and the numpy code thinks that since it isn't an int, that it should be a tuple. The following are work-arounds:
sage: np.random.multinomial(20, [1/6.]*6, size=2r)
array([[3, 1, 1, 2, 5, 8],
[2, 5, 3, 6, 4, 0]])
sage: np.random.multinomial(20, [1/6.]*6, size=int(2))
array([[4, 4, 5, 3, 1, 3],
[3, 4, 3, 4, 1, 5]])
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.