Table des matières
Ceci est une ancienne révision du document !
Les bases de NumPy
NumPy est une extension du langage de programmation Python, destinée à manipuler des matrices ou tableaux multidimensionnels ainsi que des fonctions mathématiques opérant sur ces tableaux.
Permet la manipulations des vecteurs, matrices et polynômes.
Directive d'importation
- standard :
import numpy as np
Tableaux numériques
On convertit facilement des listes Python en tableau numpy. Essayez ceci : <sxh python;> import numpy as np a=np.array(1,2],[3,4) print a print type(a) </sxh> Sortie :
[[1 2] [3 4]] <type 'numpy.ndarray'>
Algèbre linéaire
<sxh python; title : simple_linear_system.py> #! /usr/bin/env python # -*- coding: utf-8 -*- “”“ Solve a system of simultaneous equation in two variables of the form
2*x + 7*y=17. 3*x - 5*y=-21.
reference : http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.solve.html ”“” #
import numpy as np a = np.array(2.,7.],[3.,-5.) # coefs matrice b = np.array(17.],[-21.) # independent coef vector print np.linalg.solve(a,b) # solution </sxh>
Transformées de Fourier
À compléter …
Nombres aléatoires
À compléter …