aUCBLogo Demos and Tests / electricfieldgradient
be electricfieldgradient
singleshot=Name? "framenr
ang=10^ -10
elementarladung=1.60217733e-19
epsilon0=float 8.854187817e-12
ga=5.69*ang
gb=ga
gc_=7.48*ang
hT
perspective
; axes
PU
pr Eges (list 0 0 0)
eps=ang/10000
xx=Vxx
yy=Vyy
zz=Vzz
pr xx
pr yy
pr zz
m=(list xx yy zz)
m=hauptachsentrafo m
pr m
; vnn=reverse mergesort abs (list (m.1).1 (m.2).2 (m.3).3)
vnn=abs (list (m.1).1 (m.2).2 (m.3).3)
pr vnn
pr (vnn.1-vnn.2)/vnn.3
rotatescene2
be xRb i j k
output (list ga 0 0)*i+(list ga/2 ga*(sqrt 3)/2 0)*j+(list 0 0 gc_)*k
end
be xFe i j k
output (xRb i j k)+(list 0 0 gc_/2)
end
be xMo1 i j k
output (xRb i j k)+(list ga/2 ga*(sqrt 3)/6 gc_/4)
end
be xMo2 i j k
output (xRb i j k)+(list ga/2 ga*(sqrt 3)/6 gc_*3/4)
end
be xMo3 i j k
output (xRb i j k)+(list ga ga*(sqrt 3)/3 gc_/4)
end
be xMo4 i j k
output (xRb i j k)+(list ga ga*(sqrt 3)/3 gc_*3/4)
end
be E r r0 Q
setPenColor abs Q
setPosXYZ r0*10/ang
Sphere 5
if (Norm r0)==0 [output 0]
output (r-r0)/(Norm (r-r0))^3*elementarladung*Q/(4*pi*epsilon0)
end
be Eges r
feld=(list 0 0 0)
imax=1
jmax=imax
kmax=imax
for [i -imax imax]
[ for [j -jmax jmax]
[ for [k -kmax kmax]
[
ifelse k==kmax
[
feld=feld
+(E r xRb i j k 1)
][
ifelse i==imax or2 j==jmax
[
feld=feld
+(E r xRb i j k 1)
+(E r xFe i j k 3)
][
feld=feld
+(E r xRb i j k 1)
+(E r xFe i j k 3)
+(E r xMo1 i j k -2)
+(E r xMo2 i j k -2)
+(E r xMo3 i j k -2)
+(E r xMo4 i j k -2)
]
]
]
]
]
output feld
end
be Vxx
output ((Eges (list eps 0 0))-Eges (list -eps 0 0))/(2*eps)
end
be Vyy
output ((Eges (list 0 eps 0))-Eges (list 0 -eps 0))/(2*eps)
end
be Vzz
output ((Eges (list 0 0 eps))-Eges (list 0 0 -eps))/(2*eps)
end
end