# paste this code at the end of VectorFieldPlot 1.0
doc = FieldplotDocument('VFPt_capacitor', width=300, height=600, commons=True)
w = 1.5; h = 3.0
field = Field({'charged_planes':
[[-w/2, -h/2, -w/2, h/2, 1], [w/2, -h/2, w/2, h/2, -1]]})
n = 15
for i in range(n):
a = (0.5 + i) / n
a = pi * (-1.5 + 3. * a)
a = op.fsolve(lambda y1: ig.quad(lambda y:
atan((h/2-y)*2/w) + atan((h/2+y)*2/w), 0, y1)[0] - a, 0)
line = FieldLine(field, [0.,a], directions='both')
doc.draw_line(line, arrows_style={'dist': 1.5, 'min_arrows':1})
D = 0.045
doc.draw_object('rect', {'x':-.75-D,'y':-1.495,'width':2*D,'height':3.01,
'style':'fill:#ff0000; stroke:#000000; stroke-width:.01'})
plus = ' h 0.04 m -0.02,-0.02 v 0.04'
doc.draw_object('path', {'transform':'translate(-0.75)',
'd':('M -0.02,-1.4' + plus) + 14 * (' m -0.02,0.18' + plus),
'style':'fill:none; stroke:#000000; stroke-width:.02; ' +
'stroke-linecap:square'})
doc.draw_object('rect', {'x':.75-D,'y':-1.495,'width':2*D,'height':3.01,
'style':'fill:#0000ff; stroke:#000000; stroke-width:.01'})
minus = ' h 0.04'
doc.draw_object('path', {'transform':'translate(0.75)',
'd':('M -0.02,-1.4' + minus) + 14 * (' m -0.04,0.2' + minus),
'style':'fill:none; stroke:#000000; stroke-width:.02; ' +
'stroke-linecap:square'})
doc.write()