#!/usr/bin/env python
# encoding: utf-8
"""
homework_01.py
Created by Takuma on 2010-04-10.
"""
from matplotlib import rc
from numpy import arange, pi
from matplotlib.pyplot import *
rc('text', usetex=True)
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
k=1/(4*pi*8.85e-12)
e=1.60e-19
a=0.528e-10
def E(R):
return k*e*a*a/(R*R)
maxAxis_x=.0007
maxAxis_y=5.0e-21
R=arange(0,maxAxis_x,1e-6)
ER=E(R)
plot(R,ER)
axis([0,maxAxis_x,0,maxAxis_y])
grid(True)
title(r"Electric field : $E=\frac{e}{4\pi\varepsilon_0 r^2}=\frac{e a^2}{4\pi\varepsilon_0 R^2}$")
xlabel("$R$")
ylabel("$E(r)$")
savefig("homework_01_1.eps")
show()
続きを読む...