from math import sqrt, pi
from __future__ import division
# to determine the output voltage of inverting amplifier (V2)
Vin = 18 # # V
V1 = -6 # # V
# in the op-amp due to the infinite i/p resiostance the input current is = 0
# i1+i2 = 0
# it gives relation
Vo = -Vin #
# the output of multiplier is defined as
#Vo = K*V1*V2
K = 1 # # we assume
V2 = (Vo/(K*V1))#
print 'the output voltage of inverting amplifier (V2) is = %0.2f'%(V2),'V'
from __future__ import division
# to determine the output voltage of multiplier
Vin = 15 # # V
# the output of multiplier is defined as
#Vo = K*V1*V2
# because of i/p terminal the circuit performs mathematical operation squaring
# i.e V1 = V2 = Vin
K = 1 # # we assume
Vo = K*(Vin)**2#
print 'the output voltage of multiplier is = %0.2f'%(Vo),'V'
from math import sqrt, pi
from __future__ import division
# to determine the output voltage of multiplier and inverting amplifier
Vin = 16 #
# the output of the inverting amplifier
K =1 # # we assume
Vos = sqrt(abs(Vin)/K) #
print 'the output voltage of inverting amplifier is = %0.2f'%(Vos),' V '
# the output of the multiplier
Vo = K*Vos**2 #
print 'the output voltage of multiplier is = %0.2f'%(Vo),' V '
from __future__ import division
# output voltage of of RMS detector
Vin = 10 #
T = 1 # # we assume that the charging and discharging period of capacitor
# the output voltage of RMS detector
# Vo =sqrt(1/T*)integrate(Vin**2*(t),t,0,1 [,atol [,rtol]]) #
Vo = 10 #
print 'output voltage of RMS detector is = %0.2f'%(Vo),'V '