# Suggestions for Python workshop

Discussion in 'Python' started by Yaroslav, Oct 6, 2004.

1. ### YaroslavGuest

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.]

Yaroslav, Oct 6, 2004

2. ### Fernando PerezGuest

Yaroslav wrote:

> 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.

These aren't code snippets but full talks, but we're definitely using python
for 'real' research:

Here you'll also find other talks from the recent scipy'04:

http://www.scipy.org/wikis/scipy04/ConferenceSchedule

As far as code examples, I imagine all of scipy's code could be used

best,

f

ps. Where are you teaching this? Just curious...

Fernando Perez, Oct 6, 2004

3. ### Cameron LairdGuest

In article <ck1lhc\$qi9\$>,
Fernando Perez <> wrote:
>Yaroslav wrote:
>
>> 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.

>
>These aren't code snippets but full talks, but we're definitely using python
>for 'real' research:
>
>
>Here you'll also find other talks from the recent scipy'04:
>
>http://www.scipy.org/wikis/scipy04/ConferenceSchedule
>
>As far as code examples, I imagine all of scipy's code could be used

.
.
.
I have strong feelings on this subject, only a fraction of which
I'll be able to articulate this week.

First, follow everything Fernando says; he's doing great work.

Second, I see a variety of approaches to Python-for-scientists,
and I hope you're able to end up with a Pythonic one. There's
low-level how-to-ing: "this is an implementation of a
Rayleigh-Ritz algorithm for PDE solution; you can use this in
hydrodynamics to ..." What *really* gets interesting, though,
are comparing Python to other vehicles--Matlab, C++, Fortran--
and, if you're really good, opening the audience's eyes to the
potential of a language which facilitates comprehension, collabor-
ation, and experimentation. Most scientific listeners won't
understand abstraction as it applies to software. Python-for-
scientists represents a great opportunity.

Cameron Laird, Oct 7, 2004
4. ### Fernando PerezGuest

Cameron Laird wrote:

> I have strong feelings on this subject, only a fraction of which
> I'll be able to articulate this week.
>
> First, follow everything Fernando says; he's doing great work.

Thanks (blushes)

> Second, I see a variety of approaches to Python-for-scientists,
> and I hope you're able to end up with a Pythonic one. There's
> low-level how-to-ing: "this is an implementation of a
> Rayleigh-Ritz algorithm for PDE solution; you can use this in
> hydrodynamics to ..." What *really* gets interesting, though,
> are comparing Python to other vehicles--Matlab, C++, Fortran--
> and, if you're really good, opening the audience's eyes to the
> potential of a language which facilitates comprehension, collabor-
> ation, and experimentation. Most scientific listeners won't
> understand abstraction as it applies to software. Python-for-
> scientists represents a great opportunity.

Well, that's exactly the credo I've been trying to preach to all who are willing
to listen over the last couple of years. I think I've made progress, at least
by converting some people around me to these tools. But I'm quite interested
in your opinion on the matter.

If anyone from the Colorado Front Range area is interested on this subject, I'm
scheduled to give the colloquium at the Mathematics and computer science
department of the Colorado School of Mines in Golden, on Friday Nov. 19th (3pm)
on this very topic. I hope to do justice to python's qualities for scientific
work, but ideas from the c.l.py community are very welcome (I haven't written
the talk yet, so there's time to put it in).

Cheers,

f

Fernando Perez, Oct 7, 2004