Introduction to NumPy arrays - GitHub

Introduction to NumPy arrays

Gert-Ludwig Ingold



Python comes with batteries included

? extensive Python standard library

What about batteries for scientists (and others as well)?

? scienti c Python ecosystem

+ SciKits and many other packages

from:

Python comes with batteries included

? extensive Python standard library

What about batteries for scientists (and others as well)?

? scienti c Python ecosystem

+ SciKits and many other packages

from:

Python comes with batteries included

? extensive Python standard library

What about batteries for scientists (and others as well)?

? scienti c Python ecosystem

+ SciKits and many other packages

from:

scipy-

docs.doc/numpy/

SciKits Numpy Matplotlib

SciPy

Python

2017

EDITION

Cython

IP[y]:

IPython

Scipy

Lecture Notes

scipy-

Edited by Ga?l Varoquaux Emmanuelle Gouillart Olaf Vahtras

Ga?l Varoquaux ? Emmanuelle Gouillart ? Olav Vahtras Christopher Burns ? Adrian Chauve ? Robert Cimrman ? Christophe Combelles Pierre de Buyl ? Ralf Gommers ? Andr? Espaze ? Zbigniew Jdrzejewski-Szmek

Valentin Haenel ? Gert-Ludwig Ingold ? Fabian Pedregosa ? Didrik Pinte Nicolas P. Rougier ? Pauli Virtanen

and many others...

A wish list

we want to work with vectors and matrices

a11 a12 ? ? ? a1n a21 a22 ? ? ? a2n ... ... . . . ...

an1 an2 ? ? ? ann

we want our code to run fast we want support for linear algebra ...

colour image as N ? M ? 3-array

List indexing

0

1

2

-N -N+1 -N+2

N-3 N-2 N-1 -3 -2 -1

indexing starts at 0 negative indices count from the end of the list to the beginning

List slicing

basic syntax: [start:stop:step]

a[0:5]

a[5:8]

01234567

012345678

if step=1 slice contains the elements start to stop-1 slice contains stop-start elements

start, stop, and also step can be negative

default values:

start 0, i.e. starting from the rst element

stop

N, i.e up to and including the last element

step

1

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download