fonction pas(){ return ((Math.random()*2-1)/2); } fonction affinerU(){ var arriveeX=0; var arriveeY=0; var indiceX; var indiceY; teta=0; teta+=pas()*b; d=10+pas()*a; pour var k allant de 1 à nbTours { arriveeY+=d*Math.cos(teta); arriveeX+=d*Math.sin(teta); teta+=pas()*b; d=10+pas()*a; arriveeY+=-d*Math.sin(teta); arriveeX+=d*Math.cos(teta); teta+=pas()*b; d=10+pas()*a; arriveeY+=-d*Math.cos(teta); arriveeX+=-d*Math.sin(teta); teta+=pas()*b; d=10+pas()*a; arriveeY+=d*Math.sin(teta); arriveeX+=-d*Math.cos(teta); teta+=pas()*b; d=10+pas()*a; } indiceX=Math.round(arriveeX*10+100); indiceY=Math.round(arriveeY*10+100); si (indiceX<201&&indiceY<201&&indiceX>-1&&indiceY>-1) { U[indiceX][indiceY]=U[indiceX][indiceY]+1/nPoints; } } fonction afficherU(){ pour i allant de 1 à 200 { pour j allant de 1 à 200 { si (U[i][j]>0.000001) { Point3D((i-100)/10,(j-100)/10,"d*"+U[i][j]); } //Afficherligne(V[i][j]); si (Math.exp(-(((i-100)/10)*((i-100)/10)+((j-100)/10)*((j-100)/10)))>0.000000001) { SetColor(Point3D((i-100)/10,(j-100)/10,V[i][j]),"red"); } } } } // -------------------------- nPoints=10000000; a=GetExpressionValue("deltaD"); b=GetExpressionValue("deltaA"); //deltaAngle nbTours=GetExpressionValue("nbT"); U=[]; V=[]; SetExpressionValue("c",nbTours/6*(a*a+100*b*b)); pour i allant de 0 à 200 { U[i]=[];V[i]=[]; pour j allant de 0 à 200 { U[i][j]=0; V[i][j]="exp(-(("+((i-100)/10)+")^2+("+((j-100)/10)+")^2)/(2*c))/(2*pi*c)*d*0.01"; } } pour r allant de 0 à nPoints { affinerU(); } afficherU();