# find diagnostic ratio
import math
#Variable declaration
t1=0.1*10**-6 #time span for voltage
t2=1*10**-6 #time span for current
#voltage switching
V1=0.5 #level-1
V2=5.0 #level-2
#current switching
I1=0 #level-1
I2=10*10**-3 #level-2
#Calculations
DR=(((V2-V1)/t1)/((I2-I1)/t2))
#Result
print("dissipation ratio:")
print("DR = %.f ohm\n"%DR)
print("DR is quite large indicating noise interference by capacitive coupling.")
# find diagnostic ratio
import math
#variable declaration
t1=1*10**-6 #time span for voltage
t2=1*10**-6 #time span for current
#voltage switching
V1=0.5 #level-1
V2=1.0 #level-2
#current switching
I1=1*10**-3 #level-1
I2=10*10**-3 #level-2
#Calculations
DR=(((V2-V1)/t1)/((I2-I1)/t2))
#Result
print("pseudoimpedance:")
print("DR = %.f ohm\n"%(math.floor(DR)))
print("DR is not quite large indicating noise interference by inductive coupling.")
# find ground loop current
import math
#Variable declaration
Vi=12.0 #input DC voltage
Vo=3.182 #output voltage
Rg=130*10**3 #grounding resistance
R2=1*10**3 #output resistance
R1=6.8*10**3 #divider chain
#Calculations
Ig=(Vo-((2*R2*Vi)/(R1+R2)))/Rg
#Result
print("grounding loop current:")
print("Ig = %.1f micro-A"%(Ig*10**6))