[pstricks] Re : Elektrostatic Field
Juergen Gilg
gilg at acrotex.net
Mon Jan 18 00:08:30 CET 2010
Hello Thomas,
with Manuel's approach and some other idea -- here a possible new way to
get the field lines you presented. The equation for the lines is:
E_x dy = E_y dx
using the differential equation features of pstricks-add.
However this for sure needs some more cosmetics and refinements -- maybe
some typing error or whatever.
Try it out:
\documentclass{article}
\usepackage{pstricks-add}
\begin{document}
\begin{pspicture*}(-5,-5)(5,6)
\pstVerb{%
/q1 1 def
/q2 -0.5 q1 mul def
/xA 1.8 def
}
\multido{\rx=-250+10.2}{50}{%
\psplotDiffEqn[%
linewidth=0.25pt,%
linecolor=red,%
varsteptol=.001,%
method=rk4,%
algebraic,
plotpoints=200%
]{-20}{20}{\rx}{%
(q1*(y[0])/(sqrt((x+xA)^2+(y[0])^2))^3+q2*(y[0])/(sqrt((x-xA)^2+(y[0])^2))^3)%
/%
(q1*(x+xA)/(sqrt((x+xA)^2+(y[0])^2))^3+q2*(x-xA)/(sqrt((x-xA)^2+(y[0])^2))^3)%
}%
}
\pscircle*(!xA 0){0.25}\pscircle*(!xA neg 0){0.25}
\end{pspicture*}
\end{document}
Regards,
Juergen
Thomas Söll wrote:
> 
> Hallo Manuel,
>
> thank you for your solution.
>
> Now I have to understand your way to find the lines of the field.
>
> With best regards,
>
> Thomas Söll
>
> ----- Original Message -----
> *From:* mluque5130 at aol.com <mailto:mluque5130 at aol.com>
> *To:* pstricks at tug.org <mailto:pstricks at tug.org>
> *Sent:* Sunday, January 17, 2010 10:31 AM
> *Subject:* [pstricks] Re : Elektrostatic Field
>
> This example draws only the vectors at selected points.
> If nobody gives a complete solution to trace the lines of electric
> field, I think I can do it in 2 or 3 weeks...
>
> %%%%%%%%%%%%%%%%%%%%%%
>
> \documentclass{article}
> \usepackage{pstricks,multido}
> \SpecialCoor
> \def\fieldlines{%
> /xP \nx\space def
> /yP \ny\space def
> /r1 xP xA sub dup mul yP dup mul add sqrt def
> /r2 xP xA add dup mul yP dup mul add sqrt def
> % /V q1 r1 div
> % q2 r2 div
> % add def
> % Ex=-dV/dx
> /Ex q1 xP xA sub mul r1 3 exp div
> q2 xP xA add mul r2 3 exp div
> add def
> % Ey=-dV/dy
> /Ey yP
> q1 r1 3 exp div
> q2 r2 3 exp div
> add mul def
> /NormeE Ex dup mul Ey dup mul add sqrt def
> /uEx Ex NormeE div K mul def
> /uEy Ey NormeE div K mul def
> }
> \begin{document}
>
> \begin{pspicture}(-5,-5)(5,6)
> \multido{\nx=-5+0.5}{22}{%
> \multido{\ny=-5+0.5}{22}{%
> \pstVerb{/q1 1 def
> /q2 -0.5 q1 mul def
> /K 1 def
> /xA 1.8 def
> \fieldlines}
> \rput(\nx,\ny){\psline{->}(0,0)(!uEx uEy)\psdot(0,0)}
> }}
> \pscircle*(!xA 0){0.25}\pscircle*(!xA neg 0){0.25}
> \end{pspicture}
>
> \begin{pspicture}(-5,-5)(5,6)
> \multido{\nx=-5+0.5}{22}{%
> \multido{\ny=-5+0.5}{22}{%
> \pstVerb{/q1 -1 def
> /q2 2 q1 mul def
> /K 1 def
> /xA 2.2 def
> \fieldlines}
> \rput(\nx,\ny){\psline{->}(0,0)(!uEx uEy)\psdot(0,0)}
> }}
> \pscircle*(!xA 0){0.25}\pscircle*(!xA neg 0){0.25}
> \end{pspicture}
> \end{document}
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> Yours sincerely
>
> Manuel
>
> -----E-mail d'origine-----
> De : Thomas Söll 1und1 <Thomas.Soell at onlinehome.de>
> A : pstricks at tug.org
> Envoyé le : Samedi, 16 Janvier 2010 15:02
> Sujet : [pstricks] Elektrostatic Field
>
> Hallo,
>
> is it possible to draw the the lines of an E-Field from
> the superposition of two radialsymmetric Charges, as in the
> picture drawn.
> There is one +Q1, the other -0,5*Q1.
>
> Has anyone an idea?
>
> Thanks for helping.
>
> Thomas Söll
>
> _______________________________________________
>
> PSTricks mailing list
>
> PSTricks at tug.org <mailto:PSTricks at tug.org>
>
> http://tug.org/mailman/listinfo/pstricks
>
> archive: http://www.tug.org/pipermail/pstricks/
>
> ------------------------------------------------------------------------
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
> archive: http://www.tug.org/pipermail/pstricks/
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
> archive: http://www.tug.org/pipermail/pstricks/
--
Jürgen Gilg
Austr. 59
70376 Stuttgart
-------------------------------------
Tel 0711.59 27 88
e-Mail gilg at acrotex.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20100118/ae9c2041/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 215877 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20100118/ae9c2041/attachment-0001.jpe>
More information about the PSTricks
mailing list