¹q³õ¹q³q¶q


▶¹q³õ¹q³q¶q¸Ñ»¡¼v¤ù

¹q³q¶q

¹q²üªº©P³ò¥R¥¸µÛ¹q³õ¡C­Y¥H¹Ï§Îªí¥Ü¡A¸Ó¹q³õ¥i¥H³Qªí¥Ü¬°±q¤@­ÓÂI¡]¹q²ü¡^´²¶}ªº¿ç®g½u¡AºÙ¬°¹q³õ½u©Î¹q¤O½u¡C¦Ó³o¨Ç½uªº±K«×»P¹q³õ±j«×§e¥¿¬ÛÃö¡AºÙ¬°¹q³q¶q±K«×¡A¤]´N¬O¨C³æ¦ì­±¿nªº¹q¤O½u¼Æ¥Ø¡C¦]¦¹¡A¹q³q¶q»P¬ï¹Lªí­±ªº¹q³õ½uªºÁ`¼Æ¦¨¥¿¤ñ¡C¬°¤F²¤Æ­pºâ¡A³q±`¦b­pºâ¤W·|¿ï¨ú««ª½©ó¹q¤O½uªºªí­±¡C¦pªG¹q³õ¬°¤@§¡¤Ã¹q³õ¡A«h³q¹L©Ò¿ï­±¿n \( \mathbf {S} \) ªºªí­±ªº³q¶q¬° \[ \Phi_{E}=\mathbf{E} \cdot \mathbf{S} =ES \cos \theta \] ¨ä¤¤\( \mathbf{E} \)¬°¹q³õ¡]³æ¦ì¬° V/m ¡^¡B\(E\)¬°¹q³õ±j«×¡B \(S\) ¬°ªí­±­±¿n¡B \( \theta\) ¬°¹q³õ½u»P \(S\) ªºªk½u¤§¶¡ªº§¨¨¤¡C
  1. ¹q³q¶qªº¤j¤p»P¹q³õªº±j«×¦¨¥¿¤ñ
  2. ¹q³q¶qªº¤j¤p»Pªí­±¿nªº¤j¤p¦¨¥¿¤ñ
  3. ¹q³q¶qªº¤j¤p»P¹q³õ©M­±ªºªk½u§¨¨¤¦³Ãö
¦pªG¹q³õ¬°¤@«D§¡¤Ã¹q³õ¡A«h³q±`·|±N¦¹¤@¸û¤j­±¿nªº¹q³q¶q¤À³Î¡A§ï¨ú¤@¤p¶ô­±¿n \( d\mathbf{S}\) ¤Wªº¹q³q¶q \(d\Phi_{E}\) \[ d\Phi_{E}=\mathbf{E} \cdot d\mathbf{S}\] ¡]¹q³õ \(\mathbf {E}\)­¼¥H««ª½©ó©Ò¿ï­±¿nªí­±ªº¤À¶q¡^¡C¦]¦¹¡Aªí­± \(S\) ¤Wªº¹q³q¶q¥i¥Ñªí­±¿n¤À±o¨ì¡G
\(\Phi_{E}=\iint_{S} \mathbf{E} \cdot d\mathbf{S}\)
¨ä¤¤ \(\mathbf{E}\)¬O¹q³õ¡A\(d\mathbf{S}\)¬O³¬¦Xªí­±\(S\)¤Wªº·L¤p­±¿n¡A¨ä¤è¦V©w¸q¬°ªí­±ªk½u´Â¥~¡C
®Ú¾Ú°ª´µ©w«ß¡A³q¹L¥ô¤@«Ê³¬¦±­±¡]°ª´µ­±¡^ªº²b¹q³q¶q(\(\Phi_{E}\))¡A¥²»P¸Ó«Ê³¬¦±­±¤º©Ò³ò¤§²b¹q²ü¶q(\( Q_{\rm{enc}}\))¦¨¥¿¤ñ¡C ¦Ó¦b¯uªÅ¤¤¡A¦¹¤ñ¨Ò±`¼Æ¬°¤@©w­È\( 1/\varepsilon_{0}\)¡C¨ä¼Æ¾Ç¦¡¬° :
\(\Phi_{E}=\oint_{\scriptstyle{S}} \mathbf{E} \cdot d\mathbf{S} =\frac{Q_{\rm{enc}}}{\varepsilon_{0}} \)
¨ä¤¤ \(\mathbf{E}\)¬O¹q³õ¡B \(S\) ¬O¥ô¤@«Ê³¬¦±­±¡B \( Q_{\rm {enc}}\) ¬O¦±­± \(S\) ¤ºªºÁ`²b¹q²ü¡C\(\varepsilon_{0}\)¬O¤¶¹q±`¼Æ¡]¬°¤@³q¥Î±`¼Æ¡A¤]ºÙ¬°¯uªÅ¤¤¹q®e²v©Î¯uªÅ¤¶¹q±`¼Æ ¡^¡C\( \varepsilon _{0}\approx 8.854187817...\times 10^{-12}\) (F/m) ¦¹¤@Ãö«Y¦¡¥H¨ä¿n¤À§Î¦¡³QºÙ¬°¹q³õ°ª´µ©w«ß¡A¬O¥|­Ó°¨§J¤h«Â¤èµ{¦¡¤§¤@¡C¹q³q¶qªº³æ¦ì¬°¥ñ¯S¦Ì¡]V¡Pm¡^¡C





1.µe¥X¥­­±ªº¤è¶ô¬°¹q³q¶qªº­pºâ°µ·Ç³Æ

\(-R \le x \le R; \,\,\, -R \le z \le R; L=2R; R=1; ­±¿nA=L^2=4\)

GlowScript 3.2 VPython
scene=canvas(width=800, height=600, center=vector(0.1,0.3,0), forward=vec(0,-0.2,-1))
X=arrow(pos=vec(0,0,0),axis=vec(1.2,0,0),shaftwidth=0.02,headwidth=0.04,color=vec(1,0,0))
Y=arrow(pos=vec(0,0,0),axis=vec(0,0.5,0),shaftwidth=0.02,headwidth=0.04,color=vec(0,1,0))
Z=arrow(pos=vec(0,0,0),axis=vec(0,0,1.2),shaftwidth=0.02,headwidth=0.04,color=vec(0,0,1))
R=1; N=3; dx=R/N; dz=dx
A=0; E=vec(1,1,0); FLUX=0; n=vec(0,1,0)
for i in range(-N,N):
    x=dx*(i+0.5)
    for j in range(-N,N):
        z=dz*(j+0.5)
        print(i,j,vec(x,0,z))
        box(pos=vec(x,0,z),size=vec(dx*0.9,0.01,dz*0.9),color=vec(1,0.5,0.5))
        A+=dx*dz        
        FLUX+=dot(E,n)
        arrow(pos=vec(x,0,z),axis=E*0.1,shaftwidth=0.01,headwidth=0.02,color=vec(1,1,0))
        arrow(pos=vec(x,0,z),axis=n*0.1,shaftwidth=0.01,headwidth=0.02,color=vec(0,1,1))
print(N,'A=',A,'  FLUX=',FLUX)
glowscript:µe¥X¥­­±ªº¤è¶ô¬°¹q³q¶qªº­pºâ°µ·Ç³Æ(PS-EFlux-01.py)





2.­pºâ§¡¤Ã¹q³õªº¹q³q¶q

\(-R \le x \le R; \,\,\, -R \le z \le R; L=2R; R=1; A=L^2=4\)
\(§¡¤Ã¹q³õ\vec{E_0}=(1,0,1), \,\, xz-¥­­±ªºªk½u\hat{n}=(0,1,0)\)
\(¹q³q¶q=\vec{E_0} \cdot \hat{n} A\)

GlowScript 3.2 VPython
scene=canvas(width=800, height=600, center=vector(0.1,0.3,0), forward=vec(0,-0.2,-1))
X=arrow(pos=vec(0,0,0),axis=vec(1.2,0,0),shaftwidth=0.02,headwidth=0.04,color=vec(1,0,0))
Y=arrow(pos=vec(0,0,0),axis=vec(0,0.5,0),shaftwidth=0.02,headwidth=0.04,color=vec(0,1,0))
Z=arrow(pos=vec(0,0,0),axis=vec(0,0,1.2),shaftwidth=0.02,headwidth=0.04,color=vec(0,0,1))
R=1; N=3; dx=R/N; dz=dx
A=0; E=vec(1,1,0); FLUX=0; n=vec(0,1,0)
for i in range(-N,N):
    x=dx*(i+0.5)
    for j in range(-N,N):
        z=dz*(j+0.5)
        #print(i,j,vec(x,0,z))
        box(pos=vec(x,0,z),size=vec(dx*0.9,0.01,dz*0.9),color=vec(1,0.5,0.5))
        A+=dx*dz        
        FLUX+=dot(E,n)*dx*dz
        arrow(pos=vec(x,0,z),axis=E*0.1,shaftwidth=0.01,headwidth=0.02,color=vec(1,1,0))
        arrow(pos=vec(x,0,z),axis=n*0.1,shaftwidth=0.01,headwidth=0.02,color=vec(0,1,1))
print('R=',R,'  L=2R=',2*R,'  N=',N,'  A=',A,'  n=',n,'  E=',E,'  FLUX=(E dot n) A=',FLUX)
glowscript:­pºâ§¡¤Ã¹q³õªº¹q³q¶q(PS-EFlux-02.py)





3.­pºâ¤£§¡¤Ã¹q³õªº¹q³q¶q

\(-R \le x \le R; \,\,\, -R \le z \le R; L=2R; R=1; A=L^2=4\)
\(¤£§¡¤Ã¹q³õ\vec{E}=(1,2x^2,0), \,\, xz-¥­­±ªºªk½u\hat{n}=(0,1,0)\)
\(¹q³q¶q=\int_{-R}^{R} \int_{-R}^{R} \vec{E} \cdot \hat{n} \,dx dz=\dfrac{8}{3}\simeq 2.6667\)

GlowScript 3.2 VPython
scene=canvas(width=600, height=400, center=vector(0.1,0.3,0), forward=vec(0,-0.2,-1))
X=arrow(pos=vec(0,0,0),axis=vec(1.2,0,0),shaftwidth=0.02,headwidth=0.04,color=vec(1,0,0))
Y=arrow(pos=vec(0,0,0),axis=vec(0,0.5,0),shaftwidth=0.02,headwidth=0.04,color=vec(0,1,0))
Z=arrow(pos=vec(0,0,0),axis=vec(0,0,1.2),shaftwidth=0.02,headwidth=0.04,color=vec(0,0,1))
R=1; N=4; dx=R/N; dz=dx
A=0; E=vec(1,1,0); FLUX=0; n=vec(0,1,0)
for i in range(-N,N):
    x=dx*(i+0.5)
    for j in range(-N,N):
        z=dz*(j+0.5)
        r=vec(x,0,z)
        box(pos=r,size=vec(dx*0.9,0.01,dz*0.9),color=vec(1,0.5,0.5))
        A+=dx*dz 
        E=vec(1,2*x**2,0)
        #if(j==-N): print(i,j,r,E)
        FLUX+=dot(E,n)*dx*dz
        arrow(pos=vec(x,0,z),axis=E*0.1,shaftwidth=0.01,headwidth=0.02,color=vec(1,1,0))
        arrow(pos=vec(x,0,z),axis=n*0.1,shaftwidth=0.01,headwidth=0.02,color=vec(0,1,1))
print(N,'A=',A,'  FLUX=',FLUX,8/3)
glowscript:­pºâ¤£§¡¤Ã¹q³õªº¹q³q¶q(PS-EFlux-03.py)





4.¥Î¨ç¼Æ­pºâ¹q³q¶q

\(-R \le x \le R; \,\,\, -R \le z \le R; L=2R; R=1; A=L^2=4\)
\(¤£§¡¤Ã¹q³õ\vec{E}=(2x,2x^2,0), \,\, xz-¥­­±ªºªk½u\hat{n}=(0,1,0)\)
\(¹q³q¶q=\int_{-R}^{R} \int_{-R}^{R} \vec{E} \cdot \hat{n} \,dx dz=\dfrac{8}{3}\simeq 2.6667\)
±N¹q³q¶qªº­pºâ¼g¦¨¤@­Ó¨ç¼Æ´N¥i¥H¤ÏÂЪº©I¥s³o­Ó¨ç¼Æ¡A¤ñ¸û¤£¦Pªº¤Á³Î¼Æ¶q\(N\)©Ò±o¨ìªº¹q³q¶q­È¡A´N¥i¥H¦ô­p¹q³q¶qªººë½T­È¡C
ÁöµM¹q³õªºx¤À¶qÀHµÛ¦ì¸m§ïÅÜ\(E_x=2x\)¡A¦ý¬Oªk½u¤è¦V¤´µM¦b+y¤è¦V\(\hat{n}=(0,1,0)\)¡A©Ò¥H¹q³õªºx¤è¦V¤À¶q¹ï¹q³q¶q¨Ã¨S¦³°^Äm¡A¦]¦¹¹q³q¶qªºµ²ªG¤´µM»P¤W¤@­ÓÃD¥Ø©Ò±oªº¹q°Ê¶q¬Ûµ¥³£¬O\(8/3\)¡C

GlowScript 3.2 VPython
scene=canvas(width=600, height=400, center=vector(0.1,0.3,0), forward=vec(0,-0.2,-1))
X=arrow(pos=vec(0,0,0),axis=vec(1.2,0,0),shaftwidth=0.02,headwidth=0.04,color=vec(1,0,0))
Y=arrow(pos=vec(0,0,0),axis=vec(0,0.5,0),shaftwidth=0.02,headwidth=0.04,color=vec(0,1,0))
Z=arrow(pos=vec(0,0,0),axis=vec(0,0,1.2),shaftwidth=0.02,headwidth=0.04,color=vec(0,0,1))
R=1; N=4; dx=R/N; dz=dx
A=0; E=vec(1,1,0); FLUX=0; n=vec(0,1,0)
for i in range(-N,N):
    x=dx*(i+0.5)
    for j in range(-N,N):
        z=dz*(j+0.5)
        r=vec(x,0,z)
        box(pos=r,size=vec(dx*0.9,0.01,dz*0.9),color=vec(1,0.5,0.5))
        A+=dx*dz 
        E=vec(2*x,2*x**2,0)
        FLUX+=dot(E,n)*dx*dz
        arrow(pos=vec(x,0,z),axis=E*0.1,shaftwidth=0.01,headwidth=0.02,color=vec(1,1,0))
        arrow(pos=vec(x,0,z),axis=n*0.1,shaftwidth=0.01,headwidth=0.02,color=vec(0,1,1))
print(N,'A=',A,'  FLUX=',FLUX,8/3)

def FLUXSQ(N):
    R=1; dx=R/N; dz=dx
    A=0; E=vec(1,1,0); FLUX=0; n=vec(0,1,0)
    for i in range(-N,N):
        x=dx*(i+0.5)
        for j in range(-N,N):
            z=dz*(j+0.5)
            r=vec(x,0,z)
            A+=dx*dz 
            E=vec(2*x,2*x**2,0)
            FLUX+=dot(E,n)*dx*dz
    return A,FLUX

for j in range(8):
    N=10+10*j
    A,F=FLUXSQ(N)
    print(N,A,F,8/3)
glowscript:¥Î¨ç¼Æ­pºâ¹q³q¶q(PS-EFlux-04.py)





5.­pºâÂI¹q²üªº¹q³q¶q

\(-R \le x \le R; \,\,\, -R \le z \le R; L=2R; R=1; A=L^2=4\)
\(ÂI¹q²üªº¹q³õ\vec{E}=k q_1 / |\vec{r}-\vec{r_q}|^3 (\vec{r}-\vec{r_q}), \,\, xz-¥­­±ªºªk½u\hat{n}=(0,1,0)\)
\(¹q³q¶q=\int_{-R}^{R} \int_{-R}^{R} \vec{E} \cdot \hat{n} \,dx dz=\dfrac{4 \pi}{6}\simeq 2.0944\)


GlowScript 3.2 VPython
scene=canvas(width=600, height=400, center=vector(0.1,0.1,0), forward=vec(0,0.2,-1))
X=arrow(pos=vec(0,0,0),axis=vec(1.2,0,0),shaftwidth=0.02,headwidth=0.04,color=vec(1,0,0))
Y=arrow(pos=vec(0,0,0),axis=vec(0,1.2,0),shaftwidth=0.02,headwidth=0.04,color=vec(0,1,0))
Z=arrow(pos=vec(0,0,0),axis=vec(0,0,1.2),shaftwidth=0.02,headwidth=0.04,color=vec(0,0,1))
R=1; N=4; dx=R/N; dz=dx
q1=1.; rq1=vec(0,R,0.); k=1
Q1=sphere(pos=rq1,radius=0.1,color=vec(1,0,0))
A=0; FLUX=0; n=vec(0,-1,0)
for i in range(-N,N):
    x=dx*(i+0.5)
    for j in range(-N,N):
        z=dz*(j+0.5)
        r=vec(x,0,z)
        box(pos=r,size=vec(dx*0.9,0.01,dz*0.9),color=vec(1,0.5,0.5))
        A+=dx*dz 
        E=k*q1/mag(r-rq1)**3*(r-rq1)
        FLUX+=dot(E,n)*dx*dz
        arrow(pos=vec(x,0,z),axis=E*0.3,shaftwidth=0.01,headwidth=0.02,color=vec(1,1,0))
        arrow(pos=vec(x,0,z),axis=n*0.1,shaftwidth=0.01,headwidth=0.02,color=vec(0,1,1))
print(N,'A=',A,'  FLUX=',FLUX,4*pi/6)

def FLUXSQ(N):
    R=1; dx=R/N; dz=dx
    A=0; E=vec(1,1,0); FLUX=0; n=vec(0,1,0)
    for i in range(-N,N):
        x=dx*(i+0.5)
        for j in range(-N,N):
            z=dz*(j+0.5)
            r=vec(x,0,z)
            A+=dx*dz 
            E=k*q1/mag(r-rq1)**3*(r-rq1)
            FLUX+=dot(E,n)*dx*dz
    return A,FLUX

for j in range(8):
    N=10+10*j
    A,F=FLUXSQ(N)
    print(N,A,F,4*pi/6)
glowscript:­pºâÂI¹q²üªº¹q³q¶q(PS-EFlux-05.py)





6.¤@­ÓÂI¹q²ü¹ï¨â­Ó¥­­±ªº¹q³q¶q

\(-R \le x \le R; \,\,\, -R \le z \le R; L=2R; R=1; A=L^2=4\)
\(ÂI¹q²üªº¹q³õ\vec{E}=k q_1 / |\vec{r}-\vec{r_q}|^3 (\vec{r}-\vec{r_q}), \,\, xz-¥­­±ªºªk½u\hat{n}=(0,1,0)\)
\(¹q³q¶q=\int_{-R}^{R} \int_{-R}^{R} \vec{E} \cdot \hat{n} \,dx dz=\dfrac{4 \pi}{6}\simeq 2.0944\)


GlowScript 3.2 VPython

def EF_point(q,rq,r):
    ke=1.; rrq=r-rq
    E=ke*q*rrq/mag(rrq)**3
    return E

L=4; NL=5; dx=L/NL; dz=L/NL; da=dx*dz
q1=1.; rq1=vec(0,L/2,0.)
scene=canvas(width=800, height=600, center=vec(0.5,L/4,0))
X=arrow(pos=vec(0,0,0),axis=vec(3,0,0),shaftwidth=0.02,headwidth=0.04,color=vec(1,0,0))
Y=arrow(pos=vec(0,0,0),axis=vec(0,3,0),shaftwidth=0.02,headwidth=0.04,color=vec(0,1,0))
Z=arrow(pos=vec(0,0,0),axis=vec(0,0,3),shaftwidth=0.02,headwidth=0.04,color=vec(0,0,1))
plane=box(pos=vec(0,0,0),size=vec(L,0.01,L),color=vec(1,0.5,0),opacity=0.2)
Q1=sphere(pos=rq1,radius=0.1,color=vec(1,0,0))

eflux=0
for i in range(NL):
    x=-L/2+dx*(i+0.5)
    for j in range(NL):
        z=-L/2+dz*(j+0.5)
        r=vec(x,0,z)
        E=EF_point(q1,rq1,r)
        n=vec(0,-1,0)
        sphere(pos=r,radius=0.02,color=vec(1,1,0))
        arrow(pos=r,axis=E,shaftwidth=0.02,headwidth=0.04,color=color.cyan)
        Eda=dot(E,n)*da
        eflux+=Eda
print('L=',L,'  NL=',NL,'  FLUX=',eflux,4*pi/6,'(Exact Gauss Law)')

plane=box(pos=vec(L/2,L/2,0),size=vec(0.01,L,L),color=vec(1,0.5,0),opacity=0.2)
for i in range(NL):
    y=0+dx*(i+0.5)
    for j in range(NL):
        z=-L/2+dz*(j+0.5)
        r=vec(L/2,y,z)
        E=EF_point(q1,rq1,r)
        n=vec(1,0,0)
        sphere(pos=r,radius=0.02,color=vec(1,1,0))
        arrow(pos=r,axis=E,shaftwidth=0.02,headwidth=0.04,color=color.cyan)
        Eda=dot(E,n)*da
        eflux+=Eda
print('L=',L,'  NL=',NL,'  FLUX=',eflux,4*pi/6,'(Exact Gauss Law)')

glowscript:¤@­ÓÂI¹q²ü¹ï¨â­Ó¥­­±ªº¹q³q¶q(PS-EFlux-06.py)





7.²y®y¼Ð

\(x=R \cos \phi \sin \theta; \,\, y=R \cos \theta; \,\, z=R \cos \theta \)


GlowScript 3.2 VPython
scene=canvas(width=600, height=400, center=vector(0.1,0.1,0), forward=vec(0,0.2,-1))
X=arrow(pos=vec(0,0,0),axis=vec(1.2,0,0),shaftwidth=0.02,headwidth=0.04,color=vec(1,0,0))
Y=arrow(pos=vec(0,0,0),axis=vec(0,1.2,0),shaftwidth=0.02,headwidth=0.04,color=vec(0,1,0))
Z=arrow(pos=vec(0,0,0),axis=vec(0,0,1.2),shaftwidth=0.02,headwidth=0.04,color=vec(0,0,1))
R=1; N=6; dt=pi/N; df=2*pi/N; w=0.1
sphere(pos=vec(0,0,0),radius=R,color=vec(1,1,0),opacity=0.2)
for i in range(N):
    t=dt*(i+0.5)
    for j in range(1):
        f=df*(j+0.5)
        r=vec(R*cos(f)*sin(t),R*cos(t),R*sin(f)*sin(t))
        n=hat(r)
        r1=vec(R*cos(f)*sin(t+0.01),R*cos(t+0.01),R*sin(f)*sin(t+0.01))
        tr=hat(r1-r)
        print(i,j,t,f,r,n,tr)
        box(pos=r,axis=tr,up=n,length=0.5*R*dt,width=0.5*R*sin(t)*df,height=0.01, color=vec(1,1,0))
        arrow(pos=r,axis=r*0.4,shaftwidth=0.02,headwidth=0.05,color=vec(1,0,1))
        arrow(pos=r,axis=tr*0.4,shaftwidth=0.02,headwidth=0.05,color=vec(0,0.5,1))
glowscript:²y®y¼Ð(PS-EFlux-07.py)





8.²y­±ªº­±¿n»P²yªºÅé¿n

\(A=4\pi R^2\)


GlowScript 3.2 VPython
scene=canvas(width=800, height=600, center=vector(0.0,0.0,0), forward=vec(-0.1,-0.1,-1))
X=arrow(pos=vec(0,0,0),axis=vec(1.5,0,0),shaftwidth=0.02,headwidth=0.04,color=vec(1,0,0))
Y=arrow(pos=vec(0,0,0),axis=vec(0,1.5,0),shaftwidth=0.02,headwidth=0.04,color=vec(0,1,0))
Z=arrow(pos=vec(0,0,0),axis=vec(0,0,1.5),shaftwidth=0.02,headwidth=0.04,color=vec(0,0,1))
#------------------------for the surface of a sphere----------------
R=1; N=8; dt=pi/N; df=2*pi/N
A=0; 
for i in range(N):
    t=dt*(i+0.5)
    for j in range(N):
        f=df*(j+0.5)
        x=R*sin(t)*cos(f); z=R*sin(t)*sin(f); y=R*cos(t)
        r=vec(x,y,z)
        n=hat(r)
        r1=vec(R*sin(t+0.01)*cos(f),R*cos(t+0.01),R*sin(t+0.01)*sin(f))
        tv=hat(r1-r)
        b=box(pos=r,size=vec(R*dt,0.01,R*sin(t)*df),axis=tv,up=r,color=vec(1,0.5,0.5),opacity=0.7)
        arrow(pos=r,axis=b.axis*0.5,shaftwidth=0.01,headwidth=0.02,color=vec(1,1,0))
        arrow(pos=r,axis=n*0.2,shaftwidth=0.01,headwidth=0.02,color=vec(0,1,1))
        A+=R**2*sin(t)*dt*df
print('A=',A,4*pi*R**2)
#-----------------------for the volume of a sphere-------------
R1=1; N=100; dt=pi/N; df=2*pi/N; dR=R1/N; V=0
for k in range(N):
    R=dR*(k+0.5)
    for i in range(N):
        t=dt*(i+0.5)
        for j in range(N):
            f=df*(j+0.5)
            x=R*sin(t)*cos(f); z=R*sin(t)*sin(f); y=R*cos(t)
            r=vec(x,y,z)
            V+=R**2*sin(t)*dt*df*dR
print('V=',V,4/3*pi*R1**3)
glowscript:²y­±ªº­±¿n»P²yªºÅé¿n(PS-EFlux-08.py)





9.¤@­ÓÂI¹q²ü¹ï¥b²y­±ªº¹q³q¶q


¦b³o­Ó­pºâ·í¤¤§Ú­Ì¿ï¨úªº°ª´µ­±¬O¤@­Ó¥b®|¬°Rªº²y­±¡A®y¼Ðªº­ìÂI´N³]¦b²y¤ß¤W¡C¦]¬°§Ú­Ì§â­ìÂI³]¦b²yªº²y¤ß¡A¦]¦¹¨C¤@­Ó²y­±¤WªºÂIªºªk¦V¶q´N¬O¦ì¸m¦V¶q¡C§Ú­Ì¥u­n§Q¥Î¨ç¼Æ°Æµ{¦¡(EF_points)­pºâ¥X³o­ÓÂIªº¹q³õ¡G ÂI¹q²üqªº®y¼Ð\(\vec{r'}\), ±ý­pºâªº¹q³õ¦ì¸m\(\vec{r}\), ¹q³õ(\(\vec{E}\))¦b¸m\(\vec{r}\)ªº¦V¶q¡G \[ \vec{E}(\vec{r})=\frac{kq}{r^3}\vec{r} \] ¦A±N\(\vec{E}\)»P¦ì¸m¦V¶q\(\vec{r}\)¨ú¤º¿n¡A«Ü§Ö¥i¥H§â­±¿n¤Àºâ¥X¨Ó¡C¤TºûªÅ¶¡ùØ¡AÁÙ¦³¨ä¥Lªº®y¼Ð¨t¡A¨Ò¦p¶ê¬W®y¼Ð«Y´N¬O¨ä¤¤¤@ºØ·í¡C§Ú­Ì¦Ò¼{§Ú­Ìªº¹q²ü§e½u©Ê¤À§G®É¡A¶ê¬W®y¼Ð«Y´N¬O¤@­Ó¤ñ¸û¦nªº¿ï¾Ü¡A¦]¬°³o­Ó®É­Ôªº°ª´µ­±À³¸Ó·|¬O¶ê¬WÅ骺ªí­±¤ñ¸û¯à°÷²Å¦X¹q³õ°ÝÃDªº¹ïºÙ©Ê¡Cµ{¦¡¤¤ dA=R*dt*R*sin(T)*df´N¬O²y®y¼Ð¨tªº­±¿n·L¶q¤¸¯À¡G\(dA=R^2 \sin(\theta) d \theta d \phi\)¡C


GlowScript 3.2 VPython
scene=canvas(width=800, height=600, center=vector(0.1,0.1,0), forward=vec(0,0.3,-1))
X=arrow(pos=vec(0,0,0),axis=vec(1.2,0,0),shaftwidth=0.02,headwidth=0.04,color=vec(1,0,0))
Y=arrow(pos=vec(0,0,0),axis=vec(0,1.2,0),shaftwidth=0.02,headwidth=0.04,color=vec(0,1,0))
Z=arrow(pos=vec(0,0,0),axis=vec(0,0,1.2),shaftwidth=0.02,headwidth=0.04,color=vec(0,0,1))
R=1; N=16; dt=pi/N; df=2*pi/N
q1=1.2; rq1=vec(0.,0.0,0.); ke=1
Q1=sphere(pos=rq1,radius=0.05,color=vec(1,0,0))
A=0; FLUX=0
for i in range(N/2):
    t=dt*(i+0.5)
    for j in range(N):
        f=df*(j+0.5)
        x=R*sin(t)*cos(f); z=R*sin(t)*sin(f); y=R*cos(t)
        r=vec(x,y,z)
        n=hat(r)
        r1=vec(R*sin(t+0.01)*cos(f),R*cos(t+0.01),R*sin(t+0.01)*sin(f))
        tv=hat(r1-r)
        b=box(pos=r,size=vec(R*dt,0.01,R*sin(t)*df),axis=tv,up=r,color=vec(1,0.5,0.5),opacity=0.7)
        E=ke*q1/mag2(r-rq1)*hat(r-rq1)
        #arrow(pos=r,axis=b.axis,shaftwidth=0.01,headwidth=0.02,color=vec(1,1,0))
        arrow(pos=r,axis=b.up*0.2,shaftwidth=0.01,headwidth=0.02,color=vec(0,1,1))
        arrow(pos=r,axis=E*0.2,shaftwidth=0.01,headwidth=0.02,color=vec(0.2,1,0.2))
        A+=R**2*sin(t)*dt*df
        FLUX+=dot(E,n)*R**2*sin(t)*dt*df
print('q1=',q1,' rq1=',rq1,' R=',R)
print('N=',N,' A=',A,' (',2*pi*R**2,') // FLUX=',FLUX,' (',2*pi*q1,')')
q1= 1.2  rq1= < 0, 0, 0 >  R= 1
N= 8  A= 6.32374  ( 6.28319 ) // FLUX= 7.58849  ( 7.53982 )
N= 16  A= 6.29329  ( 6.28319 ) // FLUX= 7.55195  ( 7.53982 )
N= 32  A= 6.28571  ( 6.28319 ) // FLUX= 7.54285  ( 7.53982 )
N= 64  A= 6.28382  ( 6.28319 ) // FLUX= 7.54058  ( 7.53982 )
N= 128  A= 6.28334  ( 6.28319 ) // FLUX= 7.54001  ( 7.53982 )
glowscript:¤@­ÓÂI¹q²ü¹ï¥b²y­±ªº¹q³q¶q(PS-EFlux-09.py)