%pylab inline import seaborn style.use('seaborn-poster') import sympy sympy.init_printing() rcParams['lines.linewidth'] = 1 V = array([3.3, 5, 12, 120, 240])[:, None] R = array([4.7e6, 4.7e3, 4700, 470]) I = V/R P = V*I P V = 12 Ri = 2.3 # internal Rl = array([0.01, 0.1, 1, 10, 100]) R = Ri + Rl I = V/R Vl = I * Rl Pl = Vl * I Pl V = 12 Ri = 2.3 # internal Rl = linspace(0.001, 20, 1000) # load R = Ri + Rl I = V/R Vl = I * Rl Pl = Vl * I opt = Rl[Pl.argmax()] subplot(211); tick_params(labelbottom=False); plot(Rl, Pl); ylabel("$P_L$"); axvline(opt); axhline(Pl.max()) subplot(212, sharex=gca()); plot(Rl, I, 'r'); ylabel("$I$"); axhline(I.max()); xlabel("$R_L$") gca().twinx(); plot(Rl, Vl); ylabel("$V_L$"); legend(['$V_L$'], loc=3) opt V, Rl, Ri = sympy.symbols('V R_L R_I') R = Ri + Rl I = V/R Vl = I * Rl Pl = Vl * I Pl Pl_concrete = Pl.subs({V: 12, Ri: 2.3}) # P_L at the concrete values we used above #sympy.plotting.plot(Pl_concrete, (Rl, 0, 20)) R, I, Vl, Pl, Pl_concrete Plp = Pl.diff(Rl) # P_L' Plp, Plp.simplify(), Pl_concrete.diff().simplify() c = sympy.Eq((Vl.diff(Rl)/Vl), -(I.diff(Rl)/I)) c c.simplify() sympy.Eq(c.lhs * R, c.rhs * R).simplify() Vl, Vl.diff(Rl).simplify() I, I.diff(Rl).simplify() V, Ri, m = sympy.symbols('V R_I m') Rl = m*Ri / (1 - m) (Rl / (Ri + Rl)).simplify() R = Rl + Ri I = V / R Vl = I * Rl Pl = Vl * I Pl.simplify()