On Fri, Jul 25, 2008 at 1:24 PM, Gideon Simpson <[EMAIL PROTECTED]> wrote:
> How does python (or numpy/scipy) do exponentiation? If I do x**p,
> where p is some positive integer, will it compute x*x*...*x (p times),
> or will it use logarithms?
Here are some examples:
>> np.array([[1,2], [3,4]])**2
array([[ 1, 4],
[ 9, 16]])
>> np.matrix([[1,2], [3,4]])**2
matrix([[ 7, 10],
[15, 22]])
>> np.power(np.matrix([[1,2], [3,4]]), 2)
matrix([[ 1, 4],
[ 9, 16]])
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion