Pankaj(ADS)

Featured post

Python Codes for Electric Potential

Python Codes for Electric Potential Code:- import numpy as np import math import matplotlib.pyplot as plot ''' Calculating Elect...

Sunday 25 July 2021

Python Codes for Electric Potential

2 comments

Python Codes for Electric Potential

Code:-

import numpy as np

import math

import matplotlib.pyplot as plot

'''

Calculating Electric Potential


'''

K=9e9

Q1=6e-9

Q2=2e-9


X1=0.00

X2=0.01


x=0.02


dx=0.001


xminus=x-dx

xplus=x+dx

Vminus=K*Q1/(xminus-X1)+K*Q2/(xminus-X2)

Vplus=K*Q1/(xplus-X1)+K*Q2/(xplus-X2)

E=-(Vplus - Vminus)/(2*dx)

print("Ex = ",E,"N/C")


E1=K*Q1/(x-X1)**2

E2=K*Q2/(x-X2)**2

print("Ex1 = ",E1+E2,"N/C")

  

plot.plot(E,'ro--')

plot.plot(E1+E2,'o')

plot.show()

Output:-

>>> 

=========== RESTART: D:/Desktop/Python(TUT)/Electric Potential.py ===========

Ex =  317156.52768284373 N/C

Ex1 =  315000.0 N/C

>>>

Plot:-





2 comments:

  1. ICON Legal Services - Our lawyer’s assist you do the right thing and provide you guidance to report fraud against banks, financial institutions. Consult today!

    Financial disputes legal support in Chennai

    ReplyDelete