[pstricks] Re : Re : Elektrostatic Field
mluque5130 at aol.com
mluque5130 at aol.com
Mon Jan 18 09:51:30 CET 2010
@Juergen Gilg : The idea is excellent, however it is again necessary to improve it.
Here is another method, than it is necessary to improve also!
\documentclass{article}
\usepackage{pstricks,pst-plot}
\SpecialCoor
\def\FieldLines{%
/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
/dX Ex NormeE div pasX mul def
/dY Ey NormeE div pasX mul def
}
\begin{document}
\begin{center}
\begin{pspicture*}(-6,-8)(10,8)
% les limites
\pstVerb{/xmin -5 def /xmax 5 def /ymin -5 def /ymax 5 def}%
% le pas d'itération
\pstVerb{/pasX xmax xmin sub 200 div def}%
\pstVerb{/q1 1 def % les charges
/q2 -0.5 q1 mul def
/xA -2.5 def}%
% 15 degrés entre chaque ligne (24*15=360)
\multido{\iA=0+15}{24}{% 24 lignes de champ
\pstVerb{/xStart xA def
/pasX q1 q1 abs div pasX mul def
/xP xStart pasX \iA\space cos mul add def
/yP 0 pasX \iA\space sin mul add def}%
\parametricplot[plotpoints=2000]{xmin}{xmax}{%
\FieldLines
/xP xP dX add def
/yP yP dY add def
xP yP
}
\pstVerb{/xStart xA neg def
/pasX q2 q2 abs div pasX mul def
/xP xStart pasX \iA\space cos mul add def
/yP 0 pasX \iA\space sin mul add def}%
\parametricplot[plotpoints=2000]{xmin}{xmax}{%
\FieldLines
/xP xP dX add def
/yP yP dY add def
xP yP
}}
\pscircle[fillstyle=solid](!xA 0){0.2}\pscircle[fillstyle=solid](!xA neg 0){0.2}
\end{pspicture*}
\end{center}
\begin{center}
\begin{pspicture*}(-5,-8)(10,8)
% les limites
\pstVerb{/xmin -5 def /xmax 5 def /ymin -5 def /ymax 5 def}%
% le pas d'itération
\pstVerb{/pasX xmax xmin sub 200 div def}%
\pstVerb{/q1 1 def % les charges
/q2 0.5 q1 mul def
/xA -2.5 def}%
\multido{\iA=0+15}{24}{% 24 lignes de champ
\pstVerb{/xStart xA def
/pasX q1 q1 abs div pasX mul def
/xP xStart pasX \iA\space cos mul add def
/yP 0 pasX \iA\space sin mul add def}%
\parametricplot[plotpoints=2000]{xmin}{xmax}{%
\FieldLines
/xP xP dX add def
/yP yP dY add def
xP yP
}
\pstVerb{/xStart xA neg def
/pasX q2 q2 abs div pasX mul def
/xP xStart pasX \iA\space cos mul add def
/yP 0 pasX \iA\space sin mul add def}%
\parametricplot[plotpoints=2000]{xmin}{xmax}{%
\FieldLines
/xP xP dX add def
/yP yP dY add def
xP yP
}}
\pscircle[fillstyle=solid](!xA 0){0.2}\pscircle[fillstyle=solid](!xA neg 0){0.2}
\end{pspicture*}
\end{center}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Regards,
M.L.
-----E-mail d'origine-----
De : Juergen Gilg <gilg at acrotex.net>
A : Graphics with PSTricks <pstricks at tug.org>
Envoyé le : Lundi, 18 Janvier 2010 0:08
Sujet : Re: [pstricks] Re : Elektrostatic Field
Hello Thomas,
with Manuel's approach and some other idea -- here a possible new wayto 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 tofind the lines of the field.
With best regards,
Thomas Söll
-----Original Message -----
From: mluque5130 at aol.com
To: pstricks at tug.org
Sent:Sunday, January 17, 2010 10:31 AM
Subject:[pstricks] Re : Elektrostatic Field
Thisexample draws only the vectors at selected points.
If nobody gives a complete solution to trace the lines of electricfield, 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-maild'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 thethe lines of an E-Field from the superposition of two radialsymmetricCharges, 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
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
_______________________________________________
PSTricks mailing list
PSTricks at tug.org
http://tug.org/mailman/listinfo/pstricks
archive: http://www.tug.org/pipermail/pstricks/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20100118/7c87a99a/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/7c87a99a/attachment-0001.jpe>
More information about the PSTricks
mailing list