In [1]:
from sympy import symbols, pi
In [2]:
rA, rB, rP = symbols('r_A, r_B, r_P')
display(rA, rB, rP)
In [3]:
epsilon0 = symbols('epsilon_0')
epsilon0
Out[3]:
In [4]:
k = 1/(4*pi*epsilon0)
k
Out[4]:
In [5]:
qA, qB, qC = symbols('q_A, q_B, q_C')
display(qA, qB, qC)
In [6]:
xA, yA, xB, yB, xP, yP = symbols('x_A, y_A, x_B, y_B, x_P, y_P')
display(xA, yA, xB, yB, xP, yP)
In [7]:
from sympy.vector import CoordSys3D, Vector
In [8]:
N = CoordSys3D('N')
N
Out[8]:
In [9]:
rA = xA * N.i + yA * N.j
rA
Out[9]:
In [10]:
rB = xB * N.i + yB * N.j
rB
Out[10]:
In [11]:
rP = xP * N.i + yP * N.j
rP
Out[11]:
In [12]:
rAP = rP - rA
rAP
Out[12]:
In [13]:
EA = k * (qA/rAP.magnitude()**3 )*rAP
EA
Out[13]:
In [14]:
rBP = rP - rB
rBP
Out[14]:
In [15]:
EB = k * (qB/rBP.magnitude()**3 )*rBP
EB
Out[15]:
In [16]:
E = EA + EB
E
Out[16]:
In [ ]: