# Large-signal characteristics of the bipolar differential pair (qualitative scale):
#   u = (V_in1 - V_in2)/(2 V_T),  x = u/2.5  (so x = +-1 is well into saturation, his "+-1 V")
#   I_C1/I_EE = 1/(1 + exp(-2u)) = (1 + tanh u)/2,   I_C2/I_EE = (1 - tanh u)/2
#   (V_X - V_Y)/(R_C I_EE) = -tanh u
#   V_X = V_CC - R_C I_C1, V_Y = V_CC - R_C I_C2 with V_CC = 1.6, R_C I_EE = 1 (plot units)
import numpy as np
x = np.linspace(-1.5, 1.5, 301)
u = 2.5*x
ic1 = 1/(1 + np.exp(-2*u))
ic2 = 1/(1 + np.exp(2*u))
vxvy = -np.tanh(u)
vcc = 1.6
vx = vcc - ic1
vy = vcc - ic2
t = 2*x  # tanh plot: t from -3 to 3
th = np.tanh(t)
np.savetxt("char.dat", np.column_stack([x, ic1, ic2, vxvy, vx, vy, t, th]),
           header="x ic1 ic2 vxvy vx vy t th", comments="", fmt="%.5f")
