Strange behavior related to value / reference
Peter Otten
__peter__ at web.de
Wed Oct 28 06:20:34 EDT 2009
Lambda wrote:
> I defined a function to raise a 2x2 matrix to nth power:
> BTW, numpy has such a function, but it doesn't support really large
> number.
> Does numpy has some functions that support arbitrarily large number?
You can tell it to use Python instead of C integers:
>>> import numpy
>>> m = numpy.matrix([[1,2],[3,4]], dtype=object)
>>> m**100
matrix([[2477769229755647135316619942790719764614291718779321308132883358976984999,
3611168042210422417525189130504685706095268999850398812464239094782237250],
[5416752063315633626287783695757028559142903499775598218696358642173355875,
7894521293071280761604403638547748323757195218554919526829242001150340874]],
dtype=object)
Peter
More information about the Python-list
mailing list