From: W. Trevor King Date: Wed, 11 Apr 2012 22:25:03 +0000 (-0400) Subject: Update MetaPost to Asymptote in Serway and Jewett v4's problem 19.16. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c337e0e66f067784857a2216488e8f685c10b47e;p=course.git Update MetaPost to Asymptote in Serway and Jewett v4's problem 19.16. --- diff --git a/latex/problems/Serway_and_Jewett_4/problem19.16.tex b/latex/problems/Serway_and_Jewett_4/problem19.16.tex index 9e8e9d3..5552424 100644 --- a/latex/problems/Serway_and_Jewett_4/problem19.16.tex +++ b/latex/problems/Serway_and_Jewett_4/problem19.16.tex @@ -4,46 +4,44 @@ electric field at a distant point on the $+x$ axis is $E_x \approx 4k_eqa/x^3$. \end{problem*} % problem 19.16 -\empaddtoprelude{ - pair A, B; - numeric a; - a := 1cm; - A := (-a,0); - B := (a, 0); - C := (6a, 0); - def drawC = - drawarrow (A-(a,0))--(C+(a,0)) withpen pencircle scaled 0pt; - draw_ncharge(A, 6pt); - draw_pcharge(B, 6pt); - label.top("0", draw_ltic(origin, 90, 0, 3pt, 0pt, black)); - dotlabel.bot("x", C); - label.bot("a", draw_length(A, origin, 10pt)); - label.bot("a", draw_length(origin, B, 10pt)); - labeloffset := 8pt; - label.top("-q", A); - label.top("q", B); - enddef; -} - \begin{nosolution} \begin{center} -\begin{empfile}[3p] -\begin{emp}(0cm, 0cm) - drawC; -\end{emp} -\end{empfile} +\begin{asy} +import ElectroMag; + +real u = 0.5cm; +Vector ihat = ihat(); +ihat.mag = 4u; +ihat.label = Label("$x$", position=EndPoint, align=RightSide); +ihat.draw(); +Charge a = nCharge((-u, 0), Label("$-q$", align=S)); a.draw(); +Charge b = pCharge((u, 0), Label("$+q$", align=S)); b.draw(); +Distance da = Distance(a.center(), (0,0), "$a$", offset=-12pt); da.draw(); +Distance db = Distance((0,0), b.center(), "$a$", offset=-12pt); db.draw(); +\end{asy} \end{center} \end{nosolution} \begin{solution} \begin{center} -\begin{empfile}[3] -\begin{emp}(0cm, 0cm) - label.top(btex $E_{q}$ etex, draw_Efield(B, C, 18pt)); - label.top(btex $E_{-q}$ etex, draw_Efield(A, C, -16pt)); - drawC; -\end{emp} -\end{empfile} +\begin{asy} +import ElectroMag; + +real u = 0.5cm; +Vector ihat = ihat(); +ihat.mag = 9u; +ihat.label = Label("$x$", position=EndPoint, align=RightSide); +ihat.draw(); +Charge a = nCharge((-u, 0), Label("$-q$", align=S)); a.draw(); +Charge b = pCharge((u, 0), Label("$+q$", align=S)); b.draw(); +Distance da = Distance(a.center(), (0,0), "$a$", offset=-12pt); da.draw(); +Distance db = Distance((0,0), b.center(), "$a$", offset=-12pt); db.draw(); +Charge cs[] = {a, b}; +string subscripts[] = {"-", "+"}; +pair c = (6u, 0); +CoulombEFields(c, cs, subscripts, scale=c.x, unit=u); +dot(c); +\end{asy} \end{center} Let us assume the point in question has a positive $x$ value (just reverse the sign if $x < 0$).