Suggestions for Python workshop
Yaroslav
yaroslavvb at gmail.com
Wed Oct 6 16:23:45 EDT 2004
Hi, I'm preparing a 2 hour workshop titled "Python for Scientific
Computing", the goal of which is to introduce people to using Python
for their Scientific Computing needs. If you have good examples that
illustrate Python's power for scientific computing, please post them
here.
Here's one example I had in mind -- Power Method for finding dominant
eigenvector:
# Define our matrix
A = array([[2., 1.],
[1., 2.]])
# Define our starting vector
x = array([1.,0.])
x_old = 0.5*x
# Iterate while not converged
while max(x-x_old) > 0.00000001:
x_old = x
x = matrixmultiply(A, x)
x/=max(x)
# Print result
print x
# => [ 1. 1.]
More information about the Python-list
mailing list