In [1]:

```
from __future__ import division
import math
#initializing the variables:
Vi2 = 2.45;# in Volts
Vi1 = 2.35;# in Volts
A0 = 120;# open-loop voltage gain
#calculation:
Vo = A0*(Vi2 - Vi1)
#Results
print "\n\n Result \n\n"
print "\n the output voltage is ",round(Vo,2)," V"
```

In [2]:

```
from __future__ import division
import math
#initializing the variables:
Vg = 150E3;# differential voltage gain
CMRR = 90;# in dB
#calculation:
CMG = Vg/(10**(CMRR/20))
#Results
print "\n\n Result \n\n"
print "\n common-mode gain is ",round(CMG,2)
```

In [1]:

```
from __future__ import division
import math
#initializing the variables:
Vg = 120;# differential voltage gain
Vi = 3;# in Volts
Vo = 0.024;# in Volts
#calculation:
CMG = Vo/Vi
CMRR = 20*(1/2.303)*math.log(Vg/CMG)
#Results
print "\n\n Result \n\n"
print "\n common-mode gain is ",round(CMG,3)," and CMRR is ",round(CMRR,2)," dB"
```

In [1]:

```
from __future__ import division
import math
#initializing the variables:
Rf = 2000;# in ohms
Ri = 1000;# in ohms
Vi1 = 0.4;# in Volts
Vi2 = -1.2;# in Volts
#calculation:
Vo1 = -1*Rf*Vi1/Ri
Vo2 = -1*Rf*Vi2/Ri
#Results
print "\n\n Result \n\n"
print "\n output voltage when the input voltage is 0.4V is ",round(Vo1,2)," V "
print " and when the input voltage is -1.2V is ",round(Vo2,2)," V"
```

In [2]:

```
from __future__ import division
import math
#initializing the variables:
Ii = 100E-9;# in Amperes
T = 20;# in °C
Rf = 1E6;# in ohms
Ri = 10000;# in ohms
#calculation:
A = -1*Rf/Ri
Vos = Ii*Ri*Rf/(Ri+Rf)
#Results
print "\n\n Result \n\n"
print "\n (a)the voltage gain is ",round(A,2),""
print "\n (b)output offset voltage is ",round(Vos*1000,2)," mV"
print "\n (c)The effect of input bias current can be minimised by ensuring "
print "that both inputs have the same driving resistance."
print "This means that a resistance of value of 9.9 kohm (from part (b)) "
print "should be placed between the non-inverting (+) terminal and earth."
```

In [6]:

```
from __future__ import division
import math
#initializing the variables:
Vg = 40;# in dB
bf = 5000;# in Hz
Ri = 10000;# in ohms
#calculation:
A = 10**(Vg/20)
Rf = A*Ri
f = A*bf
#Results
print "\n\n Result \n\n"
print "\n the voltage gain is ",round(A,2),", Rf = ",round(Rf/1000,2),"kohm and frequency = ",round(f/1000,2)," kHz"
```

In [7]:

```
from __future__ import division
import math
#initializing the variables:
Vi = -0.4;# in Volts
R1 = 4700;# in ohms
R2 = 10000;# in ohms
#calculation:
A = 1 + (R2/R1)
Vo = A*Vi
#Results
print "\n\n Result \n\n"
print "\n(a) the voltage gain is ",round(A,2),""
print "\n(b) output voltageis ",round(Vo,2)," V"
```

In [8]:

```
from __future__ import division
import math
#initializing the variables:
V1 = 0.5;# in Volts
V2 = 0.8;# in Volts
V3 = 1.2;# in Volts
R1 = 10000;# in ohms
R2 = 20000;# in ohms
R3 = 30000;# in ohms
Rf = 50000;# in ohms
#calculation:
Vo = -1*Rf*(V1/R1 + V2/R2 + V3/R3)
#Results
print "\n\n Result \n\n"
print "\n output voltageis ",round(Vo,2)," V"
```

In [2]:

```
from __future__ import division
import math
from scipy import integrate
#initializing the variables:
Vs = -0.75;# in Volts
R = 200000;# in ohms
C = 2.5E-6;# in Farads
t = 0.1;# in secs
#calculation:
f = lambda x,a : a*1
y, err = integrate.quad(f, 0, 0.1, args=(-0.75,))
Vo = (-1/(C*R))*y
#Results
print "\n\n Result \n\n"
print "\n output voltage is ",Vo," V"
```

In [10]:

```
from __future__ import division
import math
#initializing the variables:
V1a = 0.005;# in Volts
V2a = 0;# in Volts
V1b = 0;# in Volts
V2b = 0.005;# in Volts
V1c = 0.05;# in Volts
V2c = 0.025;# in Volts
V1d = 0.025;# in Volts
V2d = 0.05;# in Volts
R1 = 10000;# in ohms
R2 = 10000;# in ohms
R3 = 100000;# in ohms
Rf = 100000;# in ohms
#calculation:
Vo1 = -1*Rf*V1a/R1
Vo2 = (R3/(R2+R3))*(1 + (Rf/R1))*V2b
Vo3 = -1*Rf*(V1c-V2c)/R1
Vo4 = (R3/(R2+R3))*(1 + (Rf/R1))*(V2d-V1d)
#Results
print "\n\n Result \n\n"
print "\n (a)output voltage is ",round(Vo1,2)," V"
print "\n (b)output voltage is ",round(Vo2,2)," V"
print "\n (c)output voltage is ",round(Vo3,2)," V"
print "\n (d)output voltage is ",round(Vo4,2)," V"
```