toggle all code blocks

...
"""Parallel connection of two resistors.""" from pylab import figure, title, ylim from pacal import *
.
Using compiled interpolation routine
Compiled sparse grid routine not available
...
def plot_parallel_resistors(R1, R2): N = R1 * R2 D = R1 + R2 R = N / D M = TwoVarsModel(PiCopula([R1, R2]), R) r = M.eval() r.plot() ylim(ymin = 0) r.summary() R1 = UniformDistr(0.5, 1.5) R2 = UniformDistr(1.5, 2.5) plot_parallel_resistors(R1, R2)
.
Warning: arguments treated as independent
============= summary =============
  PDISTR(0.375,0.9375)
                mean  =  0.65105616726491267
                 var  =  0.018144483126076694
            skewness  =  -0.089119274996120254
            kurtosis  =  1.9997947815509909
             entropy  =  -0.66696923597640589
              median  =  0.6593253504842118
                mode  =  0.749999984984695
            medianad  =  0.1076546283770014
      iqrange(0.025)  =  0.470564312062421
            ci(0.05)  =  (0.4132759186979861, 0.8838402307604071)
               range  =  (0.375, 0.9375)
             tailexp  =  (None, None)
             int_err  =  3.3306690738754696e-16
...
title("R1~U(0.5, 1.5), R2~U(1.5, 2.5), R= (R1*R2) / (R1 + R2)") show()
.
resistors_pyreport_0.png
...
figure() R = 1/(1/R1+1/R2) R.plot() R.summary()
.
============= summary =============
  (1/((1/U(0.5,1.5))+(1/U(1.5,2.5))))
                mean  =  0.65105616726491244
                 var  =  0.018144483126076694
            skewness  =  -0.089119274996114842
            kurtosis  =  1.9997947815509904
             entropy  =  -0.66696923597640589
              median  =  0.6593253504842117
                mode  =  0.749999984984695
            medianad  =  0.10765462837700136
      iqrange(0.025)  =  0.47056431206242094
            ci(0.05)  =  (0.41327591869798613, 0.8838402307604071)
               range  =  (0.375, 0.9375)
             tailexp  =  (None, None)
             int_err  =  2.2204460492503131e-16
...
ylim(ymin = 0) title("1/(1/R1 + 1/R2)") show()
.
resistors_pyreport_1.png