16.12.2012 Views

Computer Algebra Recipes

Computer Algebra Recipes

Computer Algebra Recipes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

222 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

The horizontal curves are the equipotentials (constant v) and the vertical curves<br />

are the electric ¯eld lines (constant u). The two sets of curves intersect at<br />

right angles, as would be expected. The electric ¯eld lines also intersect the<br />

cylindrical surface perpendicularly, because the conducting surface is also an<br />

equipotential.<br />

Instead of showing the electric ¯eld lines, one can plot the electric ¯eld<br />

vectors. The electric ¯eld ~ E = ¡rv can be calculated in Cartesian coordinates<br />

using the Gradient command.<br />

> E:=-Gradient(v,'cartesian'[x,y]);<br />

E := ¡<br />

2 yx<br />

(x 2 + y 2 ) 2 ex +<br />

μ<br />

¡1+<br />

1<br />

x2 ¡<br />

+ y2 2 y 2<br />

(x 2 + y 2 ) 2<br />

Since we are interested only in the electric ¯eld outside the cylinder, two piecewise<br />

functions are formed to calculate the x and y components of the electric<br />

¯eld in the region x 2 + y 2 ¸ 1.<br />

> Ex:=piecewise(x^2+y^2=1,E[1]):<br />

> Ey:=piecewise(x^2+y^2=1,E[2]):<br />

The fieldplot command is used to plot the electric ¯eld vectors as thick red<br />

arrows, the grid being 12 £ 12. The arrows will point in the direction of ~ E,<br />

their size being a measure of the magnitude, j ~ Ej.<br />

> FP:=fieldplot([Ex,Ey],x=-2..2,y=-2..2,arrows=THICK,<br />

grid=[12,12],color=red):<br />

The equipotentials and electric ¯eld vectors are superimposed in the same picture,<br />

a black-and-white rendition being shown in Figure 5.5.<br />

> display(fCP(pw2,blue),FPg,labels=["x","y"],tickmarks=[2,2]);<br />

y<br />

2<br />

–2 0 x 2<br />

–2<br />

Figure 5.5: Equipotentials and electric ¯eld vectors outside the cylinder.<br />

<br />

ey

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!