# -*- coding: utf-8 -*- """ Created on Wed Dec 03 14:18:21 2014 @author: grivet Exercice 1-9 : tracé d'équipotentielles pour deux charges éléctriques positives. Syntaxe simple. """ from pylab import * def V(x,y,r): return ((x-r[0])**2+(y-r[1])**2)**(-1) a = 1.5 points = [[-a,0],[a,0]] def potentiel(x,y): return V(x,y,points[0])+V(x,y,points[1]) n = 256 x = linspace(-5,5,n) y = linspace(-5,5,n) X,Y = meshgrid(x,y) niv = [0.1,0.5,0.86,2.0,5.0,10.0,20.0] cs = contour(X,Y,potentiel(X,Y),niv) clabel(cs) show()