File size: 220,313 Bytes
87a11e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
<!doctype html><html><head><meta charset="utf-8"><title>electronics-engineering — user guide (Rust build)</title>
<script>window.MathJax={tex:{inlineMath:[['$','$']],displayMath:[['\\[','\\]']]},svg:{fontCache:'global'}};</script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-svg.js"></script>
<style>
@page{size:A4;margin:16mm 15mm}
body{font-family:"Segoe UI",Arial,sans-serif;font-size:10.5pt;line-height:1.45;color:#1b1f24;max-width:880px;margin:auto}
h1{font-size:22pt;border-bottom:2px solid #2b5c8a;padding-bottom:4px;margin-top:28px;page-break-before:always}
h1:first-of-type{page-break-before:avoid}
h2{font-size:15pt;color:#2b5c8a;margin-top:22px;page-break-after:avoid}
h3{font-size:12pt;margin-top:16px;page-break-after:avoid}
pre{background:#f4f6f8;border:1px solid #dde3e8;border-radius:4px;padding:8px 10px;font-size:8.8pt;white-space:pre-wrap;page-break-inside:avoid}
code{font-family:Consolas,monospace;font-size:9pt;background:#f4f6f8;padding:0 2px}
pre code{background:none;padding:0}
table{border-collapse:collapse;margin:8px 0;font-size:9pt;width:100%;page-break-inside:auto}
th,td{border:1px solid #cfd6dd;padding:3px 6px;vertical-align:top;text-align:left}
th{background:#eaf0f5}
.math{margin:6px 0;overflow-x:auto}
.badge{display:inline-block;color:#fff;border-radius:3px;padding:0 5px;font-size:8.5pt;white-space:nowrap}
figure{margin:10px 0;text-align:center;page-break-inside:avoid}figure img{max-width:88%}.svgfig svg{max-width:88%;height:auto}
figcaption{font-size:9pt;color:#555}
.pb{page-break-after:always}
</style></head><body>
<h1>electronics-engineering: the Electronics Engineering program — user guide</h1>
<p><strong>electronics-engineering-ai999x 1.0.0</strong>, Rust build: command line, desktop app and browser. <strong>Creator / engineer:</strong> Ibnul Jaif Farabi · <strong>Company:</strong> AI999X · support@ai999x.com</p>
<p>Electronics Engineering covers semiconductors and pn junctions, diode circuits and rectifiers, BJT and MOSFET biasing and amplifiers, op-amp circuits, active filters, oscillators and 555 timers, ADCs and DACs, digital timing and power supplies. This guide is about <code>electronics-engineering</code>, the model as a self-contained program for Windows and Linux: 92 capabilities in 11 topics, answered on your own computer with no network, no Python and nothing else to install. The same compiled model runs in the AI999X desktop app and in the browser on the model&#x27;s page (https://www.ai999x.com/models/electronics-engineering-ai999x/); the Python package (<code>pip install electronics-engineering-ai999x</code>) has its own guide. Every command output printed here is what the program printed.</p>
<h2>Contents</h2>
<ul><li>1. Get it: desktop app, command line, browser, Python</li><li>2. Quick start</li><li>3. Writing inputs</li><li>4. Outcomes and exit codes</li><li>5. Scripts and agents: batch and JSON</li><li>6. Figures</li><li>7. In a web page or Node.js: WebAssembly</li><li>8. Every capability</li></ul>
<h2>1. Get it</h2>
<p>Version 1.2.0 of the AI999X desktop app and of the command-line bundle. Checksums for every file: https://www.ai999x.com/downloads/desktop/1.2.0/SHA256SUMS; the newest version is always under https://www.ai999x.com/downloads/desktop/latest/. Full instructions: https://www.ai999x.com/desktop-cli/</p>
<table><thead><tr><th>what</th><th>system</th><th>download</th></tr></thead><tbody><tr><td>Desktop app: Electronics Engineering</td><td>Windows x86-64</td><td>https://www.ai999x.com/downloads/desktop/1.2.0/ai999x-electronics-engineering-1.2.0-windows-x86_64.zip</td></tr><tr><td>Desktop app: Electronics Engineering</td><td>Linux x86-64</td><td>https://www.ai999x.com/downloads/desktop/1.2.0/ai999x-electronics-engineering-1.2.0-linux-x86_64.tar.gz</td></tr><tr><td>Desktop app: all models</td><td>Windows x86-64</td><td>https://www.ai999x.com/downloads/desktop/1.2.0/ai999x-1.2.0-windows-x86_64.zip</td></tr><tr><td>Desktop app: all models</td><td>Linux x86-64</td><td>https://www.ai999x.com/downloads/desktop/1.2.0/ai999x-1.2.0-linux-x86_64.tar.gz</td></tr><tr><td>Command line</td><td>Windows x86-64</td><td>https://www.ai999x.com/downloads/desktop/1.2.0/ai999x-cli-1.2.0-windows-x86_64.zip</td></tr><tr><td>Command line</td><td>Linux x86-64</td><td>https://www.ai999x.com/downloads/desktop/1.2.0/ai999x-cli-1.2.0-linux-x86_64.tar.gz</td></tr></tbody></table>
<h3>Desktop app</h3>
<p>Electronics Engineering in its own app: search, questions in words, input forms, live figures and explanations. Windows: Download ai999x-electronics-engineering-1.2.0-windows-x86_64.zip, right-click it → Extract All, then open the folder and start ai999x-electronics-engineering.exe. If Windows SmartScreen asks, choose More info → Run anyway. Linux:</p>
<pre><code class="shell">curl -LO https://www.ai999x.com/downloads/desktop/1.2.0/ai999x-electronics-engineering-1.2.0-linux-x86_64.tar.gz
curl -LO https://www.ai999x.com/downloads/desktop/1.2.0/SHA256SUMS
sha256sum -c --ignore-missing SHA256SUMS
tar xzf ai999x-electronics-engineering-1.2.0-linux-x86_64.tar.gz
./ai999x-electronics-engineering-1.2.0-linux-x86_64/ai999x-electronics-engineering</code></pre>
<p>It opens on this model: type a question or pick a capability, fill in the form and press Compute. The AI999X desktop app with every model works the same way (choose the model first). Windows: Download ai999x-1.2.0-windows-x86_64.zip, right-click it → Extract All, then open the folder and start ai999x.exe. If Windows SmartScreen asks, choose More info → Run anyway. Linux:</p>
<pre><code class="shell">curl -LO https://www.ai999x.com/downloads/desktop/1.2.0/ai999x-1.2.0-linux-x86_64.tar.gz
curl -LO https://www.ai999x.com/downloads/desktop/1.2.0/SHA256SUMS
sha256sum -c --ignore-missing SHA256SUMS
tar xzf ai999x-1.2.0-linux-x86_64.tar.gz
./ai999x-1.2.0-linux-x86_64/ai999x</code></pre>
<h3>Command line — Linux</h3>
<p>The bundle holds one program per model; <code>electronics-engineering</code> is this one. The checksum line should print OK.</p>
<pre><code class="shell">curl -LO https://www.ai999x.com/downloads/desktop/1.2.0/ai999x-cli-1.2.0-linux-x86_64.tar.gz
curl -LO https://www.ai999x.com/downloads/desktop/1.2.0/SHA256SUMS
sha256sum -c --ignore-missing SHA256SUMS
mkdir -p ~/.local/share &amp;&amp; tar xzf ai999x-cli-1.2.0-linux-x86_64.tar.gz -C ~/.local/share
echo &#x27;export PATH=&quot;$HOME/.local/share/ai999x-cli-1.2.0-linux-x86_64:$PATH&quot;&#x27; &gt;&gt; ~/.bashrc &amp;&amp; source ~/.bashrc
electronics-engineering --version</code></pre>
<h3>Command line — Windows (PowerShell)</h3>
<p>The fourth line should print True.</p>
<pre><code class="powershell">$F = &quot;ai999x-cli-1.2.0-windows-x86_64.zip&quot;
Invoke-WebRequest &quot;https://www.ai999x.com/downloads/desktop/1.2.0/$F&quot; -OutFile $F
Invoke-WebRequest &quot;https://www.ai999x.com/downloads/desktop/1.2.0/SHA256SUMS&quot; -OutFile SHA256SUMS
(Get-FileHash $F -Algorithm SHA256).Hash.ToLower() -eq ((Select-String -SimpleMatch $F SHA256SUMS).Line -split &#x27; &#x27;)[0]
Expand-Archive $F -DestinationPath &quot;$env:LOCALAPPDATA\AI999X&quot; -Force
$D = &quot;$env:LOCALAPPDATA\AI999X\ai999x-cli-1.2.0-windows-x86_64&quot;; $env:Path += &quot;;$D&quot;
[Environment]::SetEnvironmentVariable(&quot;Path&quot;, [Environment]::GetEnvironmentVariable(&quot;Path&quot;, &quot;User&quot;) + &quot;;$D&quot;, &quot;User&quot;)
electronics-engineering --version</code></pre>
<h3>In your browser</h3>
<p>Open https://www.ai999x.com/models/electronics-engineering-ai999x/, choose a capability and press Compute in your browser: the same program runs on your device as WebAssembly; nothing is sent anywhere.</p>
<h3>Python</h3>
<pre><code class="shell">pip install electronics-engineering-ai999x</code></pre>
<h2>2. Quick start</h2>
<h3>2.1 Check the install</h3>
<p>Prints the model, its version and that this is the Rust build.</p>
<pre><code class="shell">$ electronics-engineering --version
electronics-engineering-ai999x 1.0.0 (Rust build, ax-engine 0.1.0)</code></pre>
<h3>2.2 Find a capability</h3>
<p>Search the capabilities by what you want to know; the first column is the id to pass to info and solve.</p>
<pre><code class="shell">$ electronics-engineering search &quot;bjt voltage-divider bias: exact q-point&quot;
elx_bjt_voltage_divider_bias         BJT voltage-divider bias: exact Q-point  (BJT / DC bias)
elx_mosfet_divider_bias              MOSFET voltage-divider bias with source resistor: Q-point  (MOSFET / DC bias)
elx_bjt_collector_feedback_bias      BJT collector-feedback bias: Q-point  (BJT / DC bias)
elx_bjt_fixed_bias                   BJT fixed (base-resistor) bias: Q-point  (BJT / DC bias)
elx_bjt_emitter_bias                 BJT dual-supply emitter bias: Q-point  (BJT / DC bias)
elx_diode_operating_point            Operating point of a diode in series with a resistor (exact)  (diodes / operating point)
elx_bjt_cascode                      BJT cascode: output resistance, transconductance and gain  (BJT / amplifiers)
elx_differential_pair                BJT differential pair: differential and common-mode gain, CMRR  (BJT / differential amplifiers)
… 12 more</code></pre>
<h3>2.3 List the capabilities</h3>
<p>Every capability the program answers: its id (what you pass to solve) and its name.</p>
<pre><code class="shell">$ electronics-engineering list
elx_555_astable                          555 timer astable: frequency and duty cycle
elx_555_monostable                       555 timer monostable pulse width
elx_adc_code                             ADC output code, LSB and quantisation error
elx_adc_enob                             Effective number of bits (ENOB) from SINAD
elx_adc_quantization_snr                 ADC quantisation SNR with oversampling
elx_adjustable_regulator_output          Adjustable three-terminal regulator output voltage
elx_aperture_jitter_snr                  SNR limit from sampling-clock (aperture) jitter
elx_bjt_cascode                          BJT cascode: output resistance, transconductance and gain
… 84 more</code></pre>
<h3>2.4 What a capability needs</h3>
<p>The equation or method, every input and output with its SI unit. Read this before solve: it tells you the input names.</p>
<pre><code class="shell">$ electronics-engineering info elx_bjt_voltage_divider_bias
BJT voltage-divider bias: exact Q-point
  VTH = VCC R2/(R1 + R2); RTH = R1 || R2; IB = (VTH - VBE)/(RTH + (beta + 1) RE); VCE = VCC - IC RC - IE RE
  in   VCC      supply voltage [V]
  in   R1       upper divider resistor (supply to base) [ohm]
  in   R2       lower divider resistor (base to ground) [ohm]
  in   RC       collector resistor [ohm]
  in   RE       emitter resistor [ohm]
  in   beta     current gain [1]
  in   VBE      base-emitter voltage [V]
  out  VTH      Thevenin voltage of the divider [V]
  out  RTH      Thevenin resistance of the divider [ohm]
  out  IB       base current [A]
  out  IC       collector current [A]
  out  IE       emitter current [A]
  out  VB       base voltage [V]
  out  VE       emitter voltage [V]
  out  VC       collector voltage [V]
  out  VCE      collector-emitter voltage [V]</code></pre>
<h3>2.5 Solve</h3>
<p>Inputs as name=value, each with any unit of the right kind. The answer lists every output, the method used, each input converted to SI, and the conditions the answer assumes.</p>
<pre><code class="shell">$ electronics-engineering solve elx_bjt_voltage_divider_bias &quot;VCC=12 V&quot; &quot;R1=47 kohm&quot; &quot;R2=10 kohm&quot; &quot;RC=2.2 kohm&quot; &quot;RE=470 ohm&quot; beta=150.0 &quot;VBE=0.7 V&quot;
VTH = 2.105263158 V
RTH = 8245.614035 ohm
IB = 1.773972436e-05 A
IC = 0.002660958654 A
IE = 0.002678698378 A
VB = 1.958988238 V
VE = 1.258988238 V
VC = 6.145890962 V
VCE = 4.886902724 V
  by: BJT voltage-divider bias: exact Q-point  (VTH = VCC R2/(R1 + R2); RTH = R1 || R2; IB = (VTH - VBE)/(RTH + (beta + 1) RE); VCE = VCC - IC RC - IE RE)
  VCC = 12 V
  R1 = 47000 ohm
  R2 = 10000 ohm
  RC = 2200 ohm
  RE = 470 ohm
  beta = 150
  VBE = 0.7 V
  assumes: VTH &gt; VBE; active region: VCE &gt;= 0.2 V</code></pre>
<h3>2.6 Machine-readable answer</h3>
<p>--json prints the same answer as one line of JSON (values in SI): for scripts and other programs.</p>
<pre><code class="shell">$ electronics-engineering solve elx_bjt_voltage_divider_bias &quot;VCC=12 V&quot; &quot;R1=47 kohm&quot; &quot;R2=10 kohm&quot; &quot;RC=2.2 kohm&quot; &quot;RE=470 ohm&quot; beta=150.0 &quot;VBE=0.7 V&quot; --json
{&quot;outcome&quot;:&quot;SOLVED&quot;,&quot;message&quot;:&quot;&quot;,&quot;value&quot;:0.00266095865382,&quot;unit&quot;:&quot;A&quot;,&quot;solved_for&quot;:&quot;IC&quot;,&quot;si&quot;:[[&quot;VCC&quot;,12.0],[&quot;R1&quot;,47000.0],[&quot;R2&quot;,10000.0],[&quot;RC&quot;,2200.0],[&quot;RE&quot;,470.0],[&quot;beta&quot;,150.0],[&quot;VBE&quot;,0.7]],&quot;values&quot;:[[&quot;VTH&quot;,2.10526315789,&quot;V&quot;],[&quot;RTH&quot;,8245.61403509,&quot;ohm&quot;],[&quot;IB&quot;,0.0000177397243588,&quot;A&quot;],[&quot;IC&quot;,0.00266095865382,&quot;A&quot;],[&quot;IE&quot;,0.00267869837818,&quot;A&quot;],[&quot;VB&quot;,1.95898823774,&quot;V&quot;],[&quot;VE&quot;,1.25898823774,&quot;V&quot;],[&quot;VC&quot;,6.1458909616,&quot;V&quot;],[&quot;VCE&quot;,4.88690272386,&quot;V&quot;]],&quot;target&quot;:&quot;IC&quot;,&quot;phrase&quot;:&quot;Thevenin voltage of the divider&quot;,&quot;assumptions&quot;:[&quot;VTH &gt; VBE&quot;,&quot;active region: VCE &gt;= 0.2 V&quot;],&quot;name&quot;:&quot;BJT voltage-divider bias: exact Q-point&quot;,&quot;equation&quot;:&quot;VTH = VCC R2/(R1 + R2); RTH = R1 || R2; IB = (VTH - VBE)/(RTH + (beta + 1) RE); VCE = VCC - IC RC - IE RE&quot;}</code></pre>
<h3>2.7 When an input is missing</h3>
<p>No number is guessed: the answer names what is missing, shows a complete call, and the program exits with status 1.</p>
<pre><code class="shell">$ electronics-engineering solve elx_bjt_voltage_divider_bias &quot;VCC=12 V&quot; &quot;R1=47 kohm&quot; &quot;R2=10 kohm&quot; &quot;RC=2.2 kohm&quot; &quot;RE=470 ohm&quot; beta=150.0
NEEDS_INPUT: elx_bjt_voltage_divider_bias needs VBE (base-emitter voltage). Example: solve(&#x27;elx_bjt_voltage_divider_bias&#x27;, VCC=&#x27;12 V&#x27;, R1=&#x27;47000 ohm&#x27;, R2=&#x27;10000 ohm&#x27;, RC=&#x27;2200 ohm&#x27;, RE=&#x27;470 ohm&#x27;, beta=150, VBE=&#x27;0.7 V&#x27;).</code></pre>
<h3>2.8 Many questions at once</h3>
<p>One JSON request per line in, one JSON answer per line out, in order: for scripts, notebooks and agents (the program starts once). In PowerShell: Get-Content cases.jsonl | electronics-engineering batch</p>
<p><code>cases.jsonl</code>:</p>
<pre><code class="json">{&quot;key&quot;: &quot;elx_bjt_voltage_divider_bias&quot;, &quot;inputs&quot;: {&quot;VCC&quot;: &quot;12 V&quot;, &quot;R1&quot;: &quot;47 kohm&quot;, &quot;R2&quot;: &quot;10 kohm&quot;, &quot;RC&quot;: &quot;2.2 kohm&quot;, &quot;RE&quot;: &quot;470 ohm&quot;, &quot;beta&quot;: 150.0, &quot;VBE&quot;: &quot;0.7 V&quot;}}
{&quot;key&quot;: &quot;elx_sallen_key_lowpass&quot;, &quot;inputs&quot;: {&quot;R1&quot;: &quot;10 kohm&quot;, &quot;R2&quot;: &quot;10 kohm&quot;, &quot;C1&quot;: &quot;20 nF&quot;, &quot;C2&quot;: &quot;10 nF&quot;, &quot;K&quot;: 1.0}}</code></pre>
<pre><code class="shell">$ electronics-engineering batch &lt; cases.jsonl
{&quot;outcome&quot;:&quot;SOLVED&quot;,&quot;message&quot;:&quot;&quot;,&quot;value&quot;:0.00266095865382,&quot;unit&quot;:&quot;A&quot;,&quot;solved_for&quot;:&quot;IC&quot;,&quot;si&quot;:[[&quot;VCC&quot;,12.0],[&quot;R1&quot;,47000.0],[&quot;R2&quot;,10000.0],[&quot;RC&quot;,2200.0],[&quot;RE&quot;,470.0],[&quot;beta&quot;,150.0],[&quot;VBE&quot;,0.7]],&quot;values&quot;:[[&quot;VTH&quot;,2.10526315789,&quot;V&quot;],[&quot;RTH&quot;,8245.61403509,&quot;ohm&quot;],[&quot;IB&quot;,0.0000177397243588,&quot;A&quot;],[&quot;IC&quot;,0.00266095865382,&quot;A&quot;],[&quot;IE&quot;,0.00267869837818,&quot;A&quot;],[&quot;VB&quot;,1.95898823774,&quot;V&quot;],[&quot;VE&quot;,1.25898823774,&quot;V&quot;],[&quot;VC&quot;,6.1458909616,&quot;V&quot;],[&quot;VCE&quot;,4.88690272386,&quot;V&quot;]],&quot;target&quot;:&quot;IC&quot;,&quot;phrase&quot;:&quot;Thevenin voltage of the divider&quot;,&quot;assumptions&quot;:[&quot;VTH &gt; VBE&quot;,&quot;active region: VCE &gt;= 0.2 V&quot;],&quot;name&quot;:&quot;BJT voltage-divider bias: exact Q-point&quot;,&quot;equation&quot;:&quot;VTH = VCC R2/(R1 + R2); RTH = R1 || R2; IB = (VTH - VBE)/(RTH + (beta + 1) RE); VCE = VCC - IC RC - IE RE&quot;}
{&quot;outcome&quot;:&quot;SOLVED&quot;,&quot;message&quot;:&quot;&quot;,&quot;value&quot;:0.707106781187,&quot;unit&quot;:&quot;&quot;,&quot;solved_for&quot;:&quot;Q&quot;,&quot;si&quot;:[[&quot;R1&quot;,10000.0],[&quot;R2&quot;,10000.0],[&quot;C1&quot;,2e-8],[&quot;C2&quot;,1e-8],[&quot;K&quot;,1.0]],&quot;values&quot;:[[&quot;f0&quot;,1125.3953952,&quot;Hz&quot;],[&quot;Q&quot;,0.707106781187,&quot;&quot;],[&quot;H0&quot;,1.0,&quot;&quot;],[&quot;peak_gain&quot;,0.707106781187,&quot;&quot;]],&quot;target&quot;:&quot;Q&quot;,&quot;phrase&quot;:&quot;natural frequency&quot;,&quot;assumptions&quot;:[&quot;stable: R1 C2 + R2 C2 + R1 C1 (1 - K) &gt; 0&quot;,&quot;ideal amplifier&quot;],&quot;name&quot;:&quot;Sallen-Key low-pass filter: f0, Q and gain&quot;,&quot;equation&quot;:&quot;w0 = 1/sqrt(R1 R2 C1 C2); Q = sqrt(R1 R2 C1 C2)/(R1 C2 + R2 C2 + R1 C1 (1 - K))&quot;}</code></pre>
<h2>3. Writing inputs</h2>
<p>Inputs are written <code>name=value</code>, one per argument; <code>electronics-engineering info &lt;capability&gt;</code> lists the names. Quote an argument that holds a space or brackets (bash, zsh and PowerShell all accept double quotes). The answer always states each input as it was read, converted to SI, so a misread unit is visible at once.</p>
<table><thead><tr><th>kind</th><th>example</th><th>how it is read</th></tr></thead><tbody><tr><td>a number with a unit</td><td><code>&quot;R=0.128 nm&quot;</code></td><td>any unit of the same kind; converted to SI</td></tr><tr><td>a number in SI</td><td><code>R=1.28e-10</code></td><td>no unit means the SI unit shown by info</td></tr><tr><td>a choice</td><td><code>structure=FCC</code></td><td>one of the values info lists</td></tr><tr><td>a list or vector</td><td><code>&quot;v=[1, 2, 3]&quot; or &quot;v=1, 2, 3&quot;</code></td><td>brackets keep it a list</td></tr><tr><td>a matrix</td><td><code>&quot;A=[[1, 2], [3, 4]]&quot;</code></td><td>one list per row</td></tr><tr><td>true / false</td><td><code>inclusive=true</code></td><td>for yes/no options</td></tr></tbody></table>
<p>An equation can be solved for any of its quantities: give the others and add <code>--target &lt;symbol&gt;</code>. Without <code>--target</code>, the program solves for the quantity the capability is named after.</p>
<h2>4. Outcomes and exit codes</h2>
<p>The program never guesses a number: when it cannot answer, it says why and exits with status 1, so a script can tell an answer from a refusal without reading the text.</p>
<table><thead><tr><th>outcome</th><th>meaning</th><th>exit status</th></tr></thead><tbody><tr><td>SOLVED</td><td>the answer: every output with its unit, the method, the inputs in SI, the conditions assumed</td><td>0</td></tr><tr><td>NEEDS_INPUT</td><td>an input is missing; the message names it and shows a complete call</td><td>1</td></tr><tr><td>INVALID_INPUT</td><td>a value or unit of the wrong kind, an unknown input name, or a value outside the conditions</td><td>1</td></tr><tr><td>AMBIGUOUS</td><td>the inputs allow two different answers; say which one is meant</td><td>1</td></tr><tr><td>OUT_OF_SCOPE</td><td>the model has no capability for this, or the result would not be meaningful</td><td>1</td></tr><tr><td>(usage)</td><td>a command the program does not know: it prints its usage</td><td>2</td></tr></tbody></table>
<h2>5. Scripts and agents: batch and JSON</h2>
<p><code>electronics-engineering solve ... --json</code> prints one answer as one line of JSON. <code>electronics-engineering batch</code> reads one request per line on standard input and writes one JSON answer per line, in order, starting the program once for any number of requests. A request is <code>{&quot;key&quot;: &quot;&lt;capability&gt;&quot;, &quot;inputs&quot;: {&quot;name&quot;: &quot;value&quot;, ...}, &quot;target&quot;: null}</code>. In PowerShell, pipe the file in: <code>Get-Content cases.jsonl | electronics-engineering batch</code>. <code>electronics-engineering catalog</code> prints every capability with its inputs as JSON, to build forms or tool definitions.</p>
<table><thead><tr><th>answer field</th><th>meaning</th></tr></thead><tbody><tr><td>outcome</td><td>one of the outcomes above</td></tr><tr><td>message</td><td>why there is no answer (empty when SOLVED)</td></tr><tr><td>value, unit</td><td>the main result in SI units</td></tr><tr><td>values</td><td>every output: [symbol, value, unit] (procedures)</td></tr><tr><td>target</td><td>the quantity solved for</td></tr><tr><td>si</td><td>each numeric input converted to SI: [symbol, value]</td></tr><tr><td>assumptions</td><td>the conditions the answer relies on</td></tr><tr><td>name, equation</td><td>the capability and its equation or method</td></tr></tbody></table>
<pre><code class="python">import json, subprocess

reqs = [{&quot;key&quot;: &quot;&lt;capability&gt;&quot;, &quot;inputs&quot;: {&quot;name&quot;: &quot;value&quot;}}]
out = subprocess.run([&quot;electronics-engineering&quot;, &quot;batch&quot;], input=&quot;\n&quot;.join(map(json.dumps, reqs)),
                     capture_output=True, text=True, check=True).stdout
answers = [json.loads(line) for line in out.splitlines()]</code></pre>
<h2>6. Figures</h2>
<p><code>electronics-engineering figures &lt;capability&gt; name=value ... --out DIR</code> draws the live figures for those inputs and writes each as an SVG file into DIR (an existing folder); without <code>--out</code> the SVG text comes back as JSON. The desktop app and the model page draw the same figures as soon as you press Compute.</p>
<h2>7. In a web page or Node.js: WebAssembly</h2>
<p>The same model is a WebAssembly module, <code>electronics_engineering_ai999x.wasm</code> (https://www.ai999x.com/compute/rust/electronics_engineering_ai999x.wasm), with a small loader, <code>ax-wasm.js</code> (https://www.ai999x.com/compute/rust/ax-wasm.js). It runs in a browser, a Web Worker or Node.js, with no server.</p>
<pre><code class="html">&lt;script src=&quot;ax-wasm.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
  AXWasm.load(&quot;electronics_engineering_ai999x.wasm&quot;).then(function (m) {
    var a = m.solve({key: &quot;&lt;capability&gt;&quot;, inputs: {name: &quot;value&quot;}});
    console.log(a.outcome, a.values || a.value);
    console.log(m.catalog().capabilities.length + &quot; capabilities&quot;);
  });
&lt;/script&gt;</code></pre>
<h2>8. Every capability</h2>
<p>By topic. For each: what it does, what it needs and gives, when it applies, and a command with what the program printed for it. <code>electronics-engineering info &lt;id&gt;</code> shows the same inputs and outputs in the terminal.</p>
<h3>Active filters (9)</h3>
<h4 id="elx_butterworth_section_q">Butterworth filter: Q of each second-order section — <code>elx_butterworth_section_q</code></h4>
<p>The quality factors of the cascaded second-order sections of an n-th order Butterworth filter (all at the cutoff frequency), and whether a first-order section is needed.</p>
<div class="math">\[Q_k = \frac{1}{2\sin\left(\frac{(2k-1)\pi}{2n}\right)}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>n</code></td><td>in</td><td>filter order</td><td>—</td></tr><tr><td><code>Q_max</code></td><td>out</td><td>largest section Q</td><td>—</td></tr><tr><td><code>Q</code></td><td>out</td><td>section Q values, ascending</td><td>—</td></tr><tr><td><code>sections</code></td><td>out</td><td>number of second-order sections</td><td>—</td></tr><tr><td><code>first_order</code></td><td>out</td><td>1 if a first-order section is needed</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> 2 &lt;= n &lt;= 20.</p>
<pre><code class="shell">$ electronics-engineering solve elx_butterworth_section_q n=4
Q_max = 1.306562965
Q = [0.541196100146,1.30656296488]
sections = 2
first_order = 0
  by: Butterworth filter: Q of each second-order section  (Q_k = 1/(2 sin((2k - 1) pi/(2n))), k = 1 .. floor(n/2))
  assumes: 2 &lt;= n &lt;= 20</code></pre>
<p>In the worked example, n = 4 go through the equation above and give Q_max = 1.306562965, Q = [0.5411961001, 1.306562965], sections = 2, first_order = 0. It applies only when 2 &lt;= n &lt;= 20: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_filter_order">Butterworth or Chebyshev low-pass filter order — <code>elx_filter_order</code></h4>
<p>The minimum order of a Butterworth or Chebyshev type I low-pass filter meeting a passband edge with at most Ap dB attenuation and a stopband edge with at least As dB.</p>
<div class="math">\[n \ge \frac{\log_{10}D}{2\log_{10}(f_s/f_p)},\quad n \ge \frac{\cosh^{-1}\sqrt{D}}{\cosh^{-1}(f_s/f_p)}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>ftype</code></td><td>in</td><td>butterworth or chebyshev (type I)</td><td>—</td></tr><tr><td><code>fp</code></td><td>in</td><td>passband edge</td><td>Hz</td></tr><tr><td><code>fs</code></td><td>in</td><td>stopband edge</td><td>Hz</td></tr><tr><td><code>Ap</code></td><td>in</td><td>maximum passband attenuation (ripple) in dB</td><td>—</td></tr><tr><td><code>As</code></td><td>in</td><td>minimum stopband attenuation in dB</td><td>—</td></tr><tr><td><code>n</code></td><td>out</td><td>minimum filter order</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> fs &gt; fp; As &gt; Ap &gt; 0.</p>
<pre><code class="shell">$ electronics-engineering solve elx_filter_order ftype=Butterworth &quot;fp=1000 Hz&quot; &quot;fs=2500 Hz&quot; Ap=1 As=40
n = 6
  by: Butterworth or Chebyshev low-pass filter order  (Butterworth: n &gt;= log10(D)/(2 log10(fs/fp)); Chebyshev: n &gt;= acosh(sqrt D)/acosh(fs/fp), D = (10^(As/10) - 1)/(10^(Ap/10) - 1))
  fp = 1000 Hz
  fs = 2500 Hz
  Ap = 1
  As = 40
  ftype = Butterworth
  assumes: fs &gt; fp; As &gt; Ap &gt; 0</code></pre>
<p>In the worked example, ftype = Butterworth, fp = 1000 Hz, fs = 2500 Hz, Ap = 1, As = 40 go through the equation above and give n = 6. It applies only when fs &gt; fp; As &gt; Ap &gt; 0: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_chebyshev_sections">Chebyshev type I filter: section Q and frequencies — <code>elx_chebyshev_sections</code></h4>
<p>The quality factors and natural frequencies (relative to the passband edge) of the second-order sections of an n-th order Chebyshev type I low-pass filter with a given passband ripple, and the real pole of an odd order.</p>
<div class="math">\[p_k = -\sinh a\sin\theta_k + j\cosh a\cos\theta_k,\ a = \frac{1}{n}\sinh^{-1}\frac{1}{\varepsilon},\ Q_k = \frac{|p_k|}{2|\Re p_k|}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>n</code></td><td>in</td><td>filter order</td><td>—</td></tr><tr><td><code>ripple</code></td><td>in</td><td>passband ripple in dB</td><td>—</td></tr><tr><td><code>Q_max</code></td><td>out</td><td>largest section Q</td><td>—</td></tr><tr><td><code>Q</code></td><td>out</td><td>section Q values, ascending</td><td>—</td></tr><tr><td><code>f0_ratio</code></td><td>out</td><td>section natural frequencies / passband edge, in the same order</td><td>—</td></tr><tr><td><code>sections</code></td><td>out</td><td>number of second-order sections</td><td>—</td></tr><tr><td><code>real_pole</code></td><td>out</td><td>real pole / passband edge (0 for even n)</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> 2 &lt;= n &lt;= 16; 0.001 dB &lt;= ripple &lt;= 6 dB.</p>
<pre><code class="shell">$ electronics-engineering solve elx_chebyshev_sections n=4 ripple=0.5
Q_max = 2.940554174
Q = [0.705110236803,2.94055417439]
f0_ratio = [0.59700239512,1.03127040148]
sections = 2
real_pole = 0
  by: Chebyshev type I filter: section Q and frequencies  (eps = sqrt(10^(r/10) - 1); a = asinh(1/eps)/n; poles -sinh a sin th_k + j cosh a cos th_k; Q = |p|/(2 |Re p|))
  ripple = 0.5
  assumes: 2 &lt;= n &lt;= 16; 0.001 dB &lt;= ripple &lt;= 6 dB</code></pre>
<p>In the worked example, n = 4, ripple = 0.5 go through the equation above and give Q_max = 2.940554174, Q = [0.7051102368, 2.940554174], f0_ratio = [0.5970023951, 1.031270401], sections = 2. It applies only when 2 &lt;= n &lt;= 16; 0.001 dB &lt;= ripple &lt;= 6 dB: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_sallen_key_equal_component_design">Equal-component Sallen-Key low-pass design — <code>elx_sallen_key_equal_component_design</code></h4>
<p>The resistor value and amplifier gain of an equal-component (R1 = R2 = R, C1 = C2 = C) Sallen-Key low-pass filter for a cutoff frequency and Q, with the non-inverting gain ratio Rf/Rg = K - 1.</p>
<div class="math">\[R = \frac{1}{2\pi f_cC},\quad K = 3 - \frac{1}{Q}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>fc</code></td><td>in</td><td>natural (cutoff) frequency</td><td>Hz</td></tr><tr><td><code>Q</code></td><td>in</td><td>quality factor (0.7071 for Butterworth)</td><td>—</td></tr><tr><td><code>C</code></td><td>in</td><td>chosen capacitor value</td><td>F</td></tr><tr><td><code>R</code></td><td>out</td><td>resistor value</td><td>ohm</td></tr><tr><td><code>K</code></td><td>out</td><td>amplifier gain</td><td>—</td></tr><tr><td><code>Rf_over_Rg</code></td><td>out</td><td>gain resistor ratio Rf/Rg</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> 0.5 &lt;= Q &lt;= 20.</p>
<pre><code class="shell">$ electronics-engineering solve elx_sallen_key_equal_component_design &quot;fc=1000 Hz&quot; Q=0.7071 &quot;C=10 nF&quot;
R = 15915.49431 ohm
K = 1.585772875
Rf_over_Rg = 0.5857728751
  by: Equal-component Sallen-Key low-pass design  (R = 1/(2 pi fc C); K = 3 - 1/Q; Rf/Rg = K - 1)
  fc = 1000 Hz
  Q = 0.7071
  C = 1e-08 F
  assumes: 0.5 &lt;= Q &lt;= 20</code></pre>
<p>In the worked example, fc = 1000 Hz, Q = 0.7071, C = 10 nF go through the equation above and give R = 15915.49431 ohm, K = 1.585772875, Rf_over_Rg = 0.5857728751. It applies only when 0.5 &lt;= Q &lt;= 20: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_first_order_active_lowpass">First-order active low-pass filter (inverting) — <code>elx_first_order_active_lowpass</code></h4>
<p>The passband gain -Rf/R1, the cutoff frequency 1/(2 pi Rf C) and the gain at a frequency of an inverting op-amp low-pass filter with C across the feedback resistor.</p>
<div class="math">\[H(j\omega) = -\frac{R_f/R_1}{1 + j\omega R_fC},\quad f_c = \frac{1}{2\pi R_fC}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R1</code></td><td>in</td><td>input resistor</td><td>ohm</td></tr><tr><td><code>Rf</code></td><td>in</td><td>feedback resistor</td><td>ohm</td></tr><tr><td><code>C</code></td><td>in</td><td>capacitor across Rf</td><td>F</td></tr><tr><td><code>f</code></td><td>in</td><td>frequency of interest</td><td>Hz</td></tr><tr><td><code>H0</code></td><td>out</td><td>passband gain</td><td>—</td></tr><tr><td><code>fc</code></td><td>out</td><td>cutoff frequency</td><td>Hz</td></tr><tr><td><code>gain_f</code></td><td>out</td><td>gain magnitude at f</td><td>—</td></tr><tr><td><code>gain_dB</code></td><td>out</td><td>gain at f in dB</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> ideal op-amp.</p>
<pre><code class="shell">$ electronics-engineering solve elx_first_order_active_lowpass &quot;R1=10000 ohm&quot; &quot;Rf=100000 ohm&quot; &quot;C=1.59 nF&quot; &quot;f=1000 Hz&quot;
H0 = -10
fc = 1000.974485 Hz
gain_f = 7.074510619
gain_dB = 16.99392806
  by: First-order active low-pass filter (inverting)  (H(s) = -(Rf/R1)/(1 + s Rf C); fc = 1/(2 pi Rf C))
  R1 = 10000 ohm
  Rf = 100000 ohm
  C = 1.59e-09 F
  f = 1000 Hz
  assumes: ideal op-amp</code></pre>
<p>In the worked example, R1 = 10000 ohm, Rf = 100000 ohm, C = 1.59 nF, f = 1000 Hz go through the equation above and give H0 = -10, fc = 1000.974485 Hz, gain_f = 7.074510619, gain_dB = 16.99392806. It applies only when ideal op-amp: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_mfb_bandpass">Multiple-feedback (MFB) band-pass filter — <code>elx_mfb_bandpass</code></h4>
<p>The centre frequency, quality factor, -3 dB bandwidth and peak (inverting) gain of a multiple-feedback band-pass filter.</p>
<div class="math">\[\omega_0 = \sqrt{\frac{R_1+R_2}{R_1R_2R_3C_1C_2}},\quad Q = \frac{\omega_0C_1C_2R_3}{C_1+C_2}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R1</code></td><td>in</td><td>input resistor</td><td>ohm</td></tr><tr><td><code>R2</code></td><td>in</td><td>resistor from the middle node to ground</td><td>ohm</td></tr><tr><td><code>R3</code></td><td>in</td><td>feedback resistor (inverting input to output)</td><td>ohm</td></tr><tr><td><code>C1</code></td><td>in</td><td>capacitor from the middle node to the inverting input</td><td>F</td></tr><tr><td><code>C2</code></td><td>in</td><td>capacitor from the middle node to the output</td><td>F</td></tr><tr><td><code>f0</code></td><td>out</td><td>centre frequency</td><td>Hz</td></tr><tr><td><code>Q</code></td><td>out</td><td>quality factor</td><td>—</td></tr><tr><td><code>BW</code></td><td>out</td><td>-3 dB bandwidth</td><td>Hz</td></tr><tr><td><code>H_peak</code></td><td>out</td><td>gain at the centre frequency</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> ideal op-amp.</p>
<pre><code class="shell">$ electronics-engineering solve elx_mfb_bandpass &quot;R1=15900 ohm&quot; &quot;R2=1330 ohm&quot; &quot;R3=31800 ohm&quot; &quot;C1=10 nF&quot; &quot;C2=10 nF&quot;
f0 = 2547.562384 Hz
Q = 2.54508224
BW = 1000.974485 Hz
H_peak = -1
  by: Multiple-feedback (MFB) band-pass filter  (w0 = sqrt((R1 + R2)/(R1 R2 R3 C1 C2)); Q = w0 C1 C2 R3/(C1 + C2); H = -C1 R3/(R1 (C1 + C2)))
  R1 = 15900 ohm
  R2 = 1330 ohm
  R3 = 31800 ohm
  C1 = 1e-08 F
  C2 = 1e-08 F
  assumes: ideal op-amp</code></pre>
<p>In the worked example, R1 = 15900 ohm, R2 = 1330 ohm, R3 = 31800 ohm, C1 = 10 nF, C2 = 10 nF go through the equation above and give f0 = 2547.562384 Hz, Q = 2.54508224, BW = 1000.974485 Hz, H_peak = -1. It applies only when ideal op-amp: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_mfb_lowpass">Multiple-feedback (MFB) low-pass filter — <code>elx_mfb_lowpass</code></h4>
<p>The natural frequency, quality factor and inverting passband gain -R2/R1 of a second-order multiple-feedback low-pass filter.</p>
<div class="math">\[Q = \frac{\sqrt{R_2R_3C_1C_2}}{C_2\left(R_2 + R_3 + R_2R_3/R_1\right)},\quad H_0 = -\frac{R_2}{R_1}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R1</code></td><td>in</td><td>input resistor</td><td>ohm</td></tr><tr><td><code>R2</code></td><td>in</td><td>feedback resistor (middle node to output)</td><td>ohm</td></tr><tr><td><code>R3</code></td><td>in</td><td>resistor from the middle node to the inverting input</td><td>ohm</td></tr><tr><td><code>C1</code></td><td>in</td><td>capacitor from the middle node to ground</td><td>F</td></tr><tr><td><code>C2</code></td><td>in</td><td>capacitor from the inverting input to the output</td><td>F</td></tr><tr><td><code>f0</code></td><td>out</td><td>natural frequency</td><td>Hz</td></tr><tr><td><code>Q</code></td><td>out</td><td>quality factor</td><td>—</td></tr><tr><td><code>H0</code></td><td>out</td><td>passband gain</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> ideal op-amp.</p>
<pre><code class="shell">$ electronics-engineering solve elx_mfb_lowpass &quot;R1=10000 ohm&quot; &quot;R2=10000 ohm&quot; &quot;R3=5000 ohm&quot; &quot;C1=47 nF&quot; &quot;C2=4.7 nF&quot;
f0 = 1514.38839 Hz
Q = 1.118033989
H0 = -1
  by: Multiple-feedback (MFB) low-pass filter  (w0 = 1/sqrt(R2 R3 C1 C2); Q = sqrt(R2 R3 C1 C2)/(C2 (R2 + R3 + R2 R3/R1)); H0 = -R2/R1)
  R1 = 10000 ohm
  R2 = 10000 ohm
  R3 = 5000 ohm
  C1 = 4.7e-08 F
  C2 = 4.7e-09 F
  assumes: ideal op-amp</code></pre>
<p>In the worked example, R1 = 10000 ohm, R2 = 10000 ohm, R3 = 5000 ohm, C1 = 47 nF, C2 = 4.7 nF go through the equation above and give f0 = 1514.38839 Hz, Q = 1.118033989, H0 = -1. It applies only when ideal op-amp: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_sallen_key_highpass">Sallen-Key high-pass filter: f0, Q and gain — <code>elx_sallen_key_highpass</code></h4>
<p>The natural frequency, quality factor and high-frequency gain of a second-order Sallen-Key high-pass filter with any components and amplifier gain K.</p>
<div class="math">\[Q = \frac{\sqrt{R_1R_2C_1C_2}}{R_1(C_1+C_2) + R_2C_2(1-K)}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>C1</code></td><td>in</td><td>first series capacitor</td><td>F</td></tr><tr><td><code>C2</code></td><td>in</td><td>second series capacitor</td><td>F</td></tr><tr><td><code>R1</code></td><td>in</td><td>resistor from the middle node to the output (feedback)</td><td>ohm</td></tr><tr><td><code>R2</code></td><td>in</td><td>resistor from the amplifier input to ground</td><td>ohm</td></tr><tr><td><code>K</code></td><td>in</td><td>amplifier gain</td><td>—</td></tr><tr><td><code>f0</code></td><td>out</td><td>natural frequency</td><td>Hz</td></tr><tr><td><code>Q</code></td><td>out</td><td>quality factor</td><td>—</td></tr><tr><td><code>H_inf</code></td><td>out</td><td>high-frequency gain</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> stable: R1 (C1 + C2) + R2 C2 (1 - K) &gt; 0.</p>
<pre><code class="shell">$ electronics-engineering solve elx_sallen_key_highpass &quot;C1=10 nF&quot; &quot;C2=10 nF&quot; &quot;R1=11250 ohm&quot; &quot;R2=22500 ohm&quot; K=1
f0 = 1000.351462 Hz
Q = 0.7071067812
H_inf = 1
  by: Sallen-Key high-pass filter: f0, Q and gain  (w0 = 1/sqrt(R1 R2 C1 C2); Q = sqrt(R1 R2 C1 C2)/(R1 (C1 + C2) + R2 C2 (1 - K)))
  C1 = 1e-08 F
  C2 = 1e-08 F
  R1 = 11250 ohm
  R2 = 22500 ohm
  K = 1
  assumes: stable: R1 (C1 + C2) + R2 C2 (1 - K) &gt; 0</code></pre>
<p>In the worked example, C1 = 10 nF, C2 = 10 nF, R1 = 11250 ohm, R2 = 22500 ohm, K = 1 go through the equation above and give f0 = 1000.351462 Hz, Q = 0.7071067812, H_inf = 1. It applies only when stable: R1 (C1 + C2) + R2 C2 (1 - K) &gt; 0: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_sallen_key_lowpass">Sallen-Key low-pass filter: f0, Q and gain — <code>elx_sallen_key_lowpass</code></h4>
<p>The natural frequency, quality factor, passband gain and the gain at f0 (K Q) of a second-order Sallen-Key low-pass filter with any components and amplifier gain K.</p>
<div class="math">\[\omega_0 = \frac{1}{\sqrt{R_1R_2C_1C_2}},\quad Q = \frac{\sqrt{R_1R_2C_1C_2}}{R_1C_2 + R_2C_2 + R_1C_1(1-K)}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R1</code></td><td>in</td><td>first series resistor</td><td>ohm</td></tr><tr><td><code>R2</code></td><td>in</td><td>second series resistor</td><td>ohm</td></tr><tr><td><code>C1</code></td><td>in</td><td>capacitor from the middle node to the output (feedback)</td><td>F</td></tr><tr><td><code>C2</code></td><td>in</td><td>capacitor from the amplifier input to ground</td><td>F</td></tr><tr><td><code>K</code></td><td>in</td><td>amplifier gain (1 for a unity-gain buffer)</td><td>—</td></tr><tr><td><code>f0</code></td><td>out</td><td>natural frequency</td><td>Hz</td></tr><tr><td><code>Q</code></td><td>out</td><td>quality factor</td><td>—</td></tr><tr><td><code>H0</code></td><td>out</td><td>passband gain</td><td>—</td></tr><tr><td><code>peak_gain</code></td><td>out</td><td>gain at f0, K Q</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> stable: R1 C2 + R2 C2 + R1 C1 (1 - K) &gt; 0; ideal amplifier.</p>
<pre><code class="shell">$ electronics-engineering solve elx_sallen_key_lowpass &quot;R1=10000 ohm&quot; &quot;R2=10000 ohm&quot; &quot;C1=20 nF&quot; &quot;C2=10 nF&quot; K=1
f0 = 1125.395395 Hz
Q = 0.7071067812
H0 = 1
peak_gain = 0.7071067812
  by: Sallen-Key low-pass filter: f0, Q and gain  (w0 = 1/sqrt(R1 R2 C1 C2); Q = sqrt(R1 R2 C1 C2)/(R1 C2 + R2 C2 + R1 C1 (1 - K)))
  R1 = 10000 ohm
  R2 = 10000 ohm
  C1 = 2e-08 F
  C2 = 1e-08 F
  K = 1
  assumes: stable: R1 C2 + R2 C2 + R1 C1 (1 - K) &gt; 0; ideal amplifier</code></pre>
<p>In the worked example, R1 = 10000 ohm, R2 = 10000 ohm, C1 = 20 nF, C2 = 10 nF, K = 1 go through the equation above and give f0 = 1125.395395 Hz, Q = 0.7071067812, H0 = 1, peak_gain = 0.7071067812. It applies only when stable: R1 C2 + R2 C2 + R1 C1 (1 - K) &gt; 0; ideal amplifier: outside that it says what is wrong instead of returning a number.</p>
<h3>BJT (16)</h3>
<h4 id="elx_transition_frequency">BJT beta cutoff and transition frequency fT — <code>elx_transition_frequency</code></h4>
<p>The beta cutoff frequency f_beta and the unity-current-gain (transition) frequency fT = gm/(2 pi (Cpi + Cmu)) of a bipolar transistor from its hybrid-pi capacitances.</p>
<div class="math">\[f_T = \frac{g_m}{2\pi(C_\pi + C_\mu)},\quad f_\beta = \frac{f_T}{\beta}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>gm</code></td><td>in</td><td>transconductance</td><td>S</td></tr><tr><td><code>beta</code></td><td>in</td><td>low-frequency current gain</td><td>—</td></tr><tr><td><code>Cpi</code></td><td>in</td><td>base-emitter capacitance</td><td>F</td></tr><tr><td><code>Cmu</code></td><td>in</td><td>base-collector capacitance</td><td>F</td></tr><tr><td><code>r_pi</code></td><td>out</td><td>r_pi = beta/gm</td><td>ohm</td></tr><tr><td><code>f_beta</code></td><td>out</td><td>beta cutoff frequency</td><td>Hz</td></tr><tr><td><code>f_T</code></td><td>out</td><td>transition frequency</td><td>Hz</td></tr></tbody></table>
<p><strong>Applies when:</strong> single-pole h_fe (the feed-forward zero through Cmu neglected).</p>
<pre><code class="shell">$ electronics-engineering solve elx_transition_frequency &quot;gm=40 mS&quot; beta=100 &quot;Cpi=10 pF&quot; &quot;Cmu=2 pF&quot;
r_pi = 2500 ohm
f_beta = 5305164.77 Hz
f_T = 530516477 Hz
  by: BJT beta cutoff and transition frequency fT  (f_beta = 1/(2 pi r_pi (Cpi + Cmu)); fT = beta f_beta = gm/(2 pi (Cpi + Cmu)))
  gm = 0.04 S
  beta = 100
  Cpi = 1e-11 F
  Cmu = 2e-12 F
  assumes: single-pole h_fe (the feed-forward zero through Cmu neglected)</code></pre>
<p>In the worked example, gm = 40 mS, beta = 100, Cpi = 10 pF, Cmu = 2 pF go through the equation above and give r_pi = 2500 ohm, f_beta = 5305164.77 Hz, f_T = 530516477 Hz. It applies only when single-pole h_fe (the feed-forward zero through Cmu neglected): outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_bjt_cascode">BJT cascode: output resistance, transconductance and gain — <code>elx_bjt_cascode</code></h4>
<p>The output resistance, the short-circuit transconductance and the voltage gain into a load of a cascode (common emitter driving common base) of two identical transistors at the same bias current.</p>
<div class="math">\[R_{out} = r_o + (1 + g_mr_o)(r_o\parallel r_\pi),\quad A_v = -G_m(R_{out}\parallel R_L)\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>IC</code></td><td>in</td><td>bias current of both transistors</td><td>A</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain</td><td>—</td></tr><tr><td><code>VT</code></td><td>in</td><td>thermal voltage</td><td>V</td></tr><tr><td><code>VA</code></td><td>in</td><td>Early voltage</td><td>V</td></tr><tr><td><code>RL</code></td><td>in</td><td>load resistance</td><td>ohm</td></tr><tr><td><code>gm</code></td><td>out</td><td>transconductance of each transistor</td><td>S</td></tr><tr><td><code>r_o</code></td><td>out</td><td>output resistance of each</td><td>ohm</td></tr><tr><td><code>Rout</code></td><td>out</td><td>output resistance of the cascode</td><td>ohm</td></tr><tr><td><code>Gm</code></td><td>out</td><td>short-circuit transconductance</td><td>S</td></tr><tr><td><code>Av</code></td><td>out</td><td>voltage gain into RL</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> identical transistors, base of the upper one at signal ground.</p>
<pre><code class="shell">$ electronics-engineering solve elx_bjt_cascode &quot;IC=1 mA&quot; beta=100 &quot;VT=25 mV&quot; &quot;VA=100 V&quot; &quot;RL=1000000 ohm&quot;
gm = 0.04 S
r_o = 100000 ohm
Rout = 9858536.585 ohm
Gm = 0.03959426027 S
Av = -35947.88859
  by: BJT cascode: output resistance, transconductance and gain  (Rout = r_o + (1 + gm r_o)(r_o || r_pi); Gm = gm (gm + 1/r_o)/(gm + 2/r_o + 1/r_pi); Av = -Gm (Rout || RL))
  IC = 0.001 A
  beta = 100
  VT = 0.025 V
  VA = 100 V
  RL = 1000000 ohm
  assumes: identical transistors, base of the upper one at signal ground</code></pre>
<p>In the worked example, IC = 1 mA, beta = 100, VT = 25 mV, VA = 100 V, RL = 1000000 ohm go through the equation above and give gm = 0.04 S, r_o = 100000 ohm, Rout = 9858536.585 ohm, Gm = 0.03959426027 S. It applies only when identical transistors, base of the upper one at signal ground: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_bjt_collector_feedback_bias">BJT collector-feedback bias: Q-point — <code>elx_bjt_collector_feedback_bias</code></h4>
<p>The Q-point of a transistor biased by a resistor from collector to base (collector feedback), with an optional emitter resistor.</p>
<div class="math">\[I_B = \frac{V_{CC} - V_{BE}}{R_F + (\beta+1)(R_C + R_E)}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>VCC</code></td><td>in</td><td>supply voltage</td><td>V</td></tr><tr><td><code>RC</code></td><td>in</td><td>collector resistor (carries IC + IB)</td><td>ohm</td></tr><tr><td><code>RF</code></td><td>in</td><td>feedback resistor, collector to base</td><td>ohm</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain</td><td>—</td></tr><tr><td><code>VBE</code></td><td>in</td><td>base-emitter voltage</td><td>V</td></tr><tr><td><code>RE</code></td><td>in</td><td>emitter resistor (default 0) (optional)</td><td>ohm</td></tr><tr><td><code>IB</code></td><td>out</td><td>base current</td><td>A</td></tr><tr><td><code>IC</code></td><td>out</td><td>collector current</td><td>A</td></tr><tr><td><code>IE</code></td><td>out</td><td>emitter current</td><td>A</td></tr><tr><td><code>VC</code></td><td>out</td><td>collector voltage</td><td>V</td></tr><tr><td><code>VCE</code></td><td>out</td><td>collector-emitter voltage</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> active region: VCE &gt;= 0.2 V.</p>
<pre><code class="shell">$ electronics-engineering solve elx_bjt_collector_feedback_bias &quot;VCC=10 V&quot; &quot;RC=4700 ohm&quot; &quot;RF=250000 ohm&quot; beta=90 &quot;VBE=0.7 V&quot;
IB = 1.372288623e-05 A
IC = 0.001235059761 A
IE = 0.001248782647 A
VC = 4.130721558 V
VCE = 4.130721558 V
  by: BJT collector-feedback bias: Q-point  (IB = (VCC - VBE)/(RF + (beta + 1)(RC + RE)); VC = VCC - IE RC)
  VCC = 10 V
  RC = 4700 ohm
  RF = 250000 ohm
  beta = 90
  VBE = 0.7 V
  assumes: active region: VCE &gt;= 0.2 V</code></pre>
<p>In the worked example, VCC = 10 V, RC = 4700 ohm, RF = 250000 ohm, beta = 90, VBE = 0.7 V go through the equation above and give IB = 1.372288623e-05 A, IC = 0.001235059761 A, IE = 0.001248782647 A, VC = 4.130721558 V. It applies only when active region: VCE &gt;= 0.2 V: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_current_mirror">BJT current mirror with finite beta — <code>elx_current_mirror</code></h4>
<p>The reference current and the output current of a basic two-transistor current mirror with a resistor to the supply, including the base-current error Iout = Iref beta/(beta + 2).</p>
<div class="math">\[I_{out} = \frac{\beta}{\beta+2}I_{ref}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>VCC</code></td><td>in</td><td>supply voltage</td><td>V</td></tr><tr><td><code>R</code></td><td>in</td><td>reference resistor</td><td>ohm</td></tr><tr><td><code>VBE</code></td><td>in</td><td>base-emitter voltage</td><td>V</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain of each (matched) transistor</td><td>—</td></tr><tr><td><code>Iref</code></td><td>out</td><td>current in the reference resistor</td><td>A</td></tr><tr><td><code>Iout</code></td><td>out</td><td>output (mirrored) current</td><td>A</td></tr><tr><td><code>ratio</code></td><td>out</td><td>Iout/Iref</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> matched transistors, Early effect neglected.</p>
<pre><code class="shell">$ electronics-engineering solve elx_current_mirror &quot;VCC=10 V&quot; &quot;R=9300 ohm&quot; &quot;VBE=0.7 V&quot; beta=100
Iref = 0.001 A
Iout = 0.0009803921569 A
ratio = 0.9803921569
  by: BJT current mirror with finite beta  (Iref = (VCC - VBE)/R; Iout = Iref beta/(beta + 2))
  VCC = 10 V
  R = 9300 ohm
  VBE = 0.7 V
  beta = 100
  assumes: matched transistors, Early effect neglected</code></pre>
<p>In the worked example, VCC = 10 V, R = 9300 ohm, VBE = 0.7 V, beta = 100 go through the equation above and give Iref = 0.001 A, Iout = 0.0009803921569 A, ratio = 0.9803921569. It applies only when matched transistors, Early effect neglected: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_differential_pair">BJT differential pair: differential and common-mode gain, CMRR — <code>elx_differential_pair</code></h4>
<p>The differential gain (differential and single-ended output), the common-mode gain and the common-mode rejection ratio of a resistively loaded BJT differential pair with a tail current source of finite resistance.</p>
<div class="math">\[A_{cm} = -\frac{g_mR_C}{1 + 2R_{EE}(\beta+1)/r_\pi},\quad \text{CMRR} = \frac{1 + 2R_{EE}(\beta+1)/r_\pi}{2}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>I_tail</code></td><td>in</td><td>tail (bias) current</td><td>A</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain</td><td>—</td></tr><tr><td><code>VT</code></td><td>in</td><td>thermal voltage</td><td>V</td></tr><tr><td><code>RC</code></td><td>in</td><td>collector resistor of each side</td><td>ohm</td></tr><tr><td><code>REE</code></td><td>in</td><td>output resistance of the tail current source</td><td>ohm</td></tr><tr><td><code>IC</code></td><td>out</td><td>collector current of each transistor</td><td>A</td></tr><tr><td><code>gm</code></td><td>out</td><td>transconductance of each</td><td>S</td></tr><tr><td><code>Ad_diff</code></td><td>out</td><td>differential gain, differential output</td><td>—</td></tr><tr><td><code>Ad_se</code></td><td>out</td><td>differential gain, single-ended output</td><td>—</td></tr><tr><td><code>Acm</code></td><td>out</td><td>common-mode gain, single-ended output</td><td>—</td></tr><tr><td><code>CMRR</code></td><td>out</td><td>|Ad_se/Acm|</td><td>—</td></tr><tr><td><code>CMRR_dB</code></td><td>out</td><td>CMRR in dB</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> matched transistors, r_o neglected.</p>
<pre><code class="shell">$ electronics-engineering solve elx_differential_pair &quot;I_tail=1 mA&quot; beta=100 &quot;VT=25 mV&quot; &quot;RC=10000 ohm&quot; &quot;REE=100000 ohm&quot;
IC = 0.000495049505 A
gm = 0.0198019802 S
Ad_diff = -198.019802
Ad_se = -99.00990099
Acm = -0.04949257735
CMRR = 2000.5
CMRR_dB = 66.02277111
  by: BJT differential pair: differential and common-mode gain, CMRR  (IC = alpha I/2; gm = IC/VT; Ad = -gm RC (/2 single-ended); Acm = -gm RC/(1 + 2 REE (beta + 1)/r_pi); CMRR = |Ad,se/Acm|)
  I_tail = 0.001 A
  beta = 100
  VT = 0.025 V
  RC = 10000 ohm
  REE = 100000 ohm
  assumes: matched transistors, r_o neglected</code></pre>
<p>In the worked example, I_tail = 1 mA, beta = 100, VT = 25 mV, RC = 10000 ohm, REE = 100000 ohm go through the equation above and give IC = 0.000495049505 A, gm = 0.0198019802 S, Ad_diff = -198.019802, Ad_se = -99.00990099. It applies only when matched transistors, r_o neglected: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_bjt_emitter_bias">BJT dual-supply emitter bias: Q-point — <code>elx_bjt_emitter_bias</code></h4>
<p>The Q-point of a transistor with its base returned to ground through RB and its emitter returned to a negative supply -VEE through RE (emitter bias).</p>
<div class="math">\[I_E = \frac{V_{EE} - V_{BE}}{R_E + R_B/(\beta+1)}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>VCC</code></td><td>in</td><td>positive supply</td><td>V</td></tr><tr><td><code>VEE</code></td><td>in</td><td>magnitude of the negative supply</td><td>V</td></tr><tr><td><code>RB</code></td><td>in</td><td>base resistor to ground</td><td>ohm</td></tr><tr><td><code>RC</code></td><td>in</td><td>collector resistor</td><td>ohm</td></tr><tr><td><code>RE</code></td><td>in</td><td>emitter resistor to -VEE</td><td>ohm</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain</td><td>—</td></tr><tr><td><code>VBE</code></td><td>in</td><td>base-emitter voltage</td><td>V</td></tr><tr><td><code>IB</code></td><td>out</td><td>base current</td><td>A</td></tr><tr><td><code>IC</code></td><td>out</td><td>collector current</td><td>A</td></tr><tr><td><code>IE</code></td><td>out</td><td>emitter current</td><td>A</td></tr><tr><td><code>VB</code></td><td>out</td><td>base voltage</td><td>V</td></tr><tr><td><code>VE</code></td><td>out</td><td>emitter voltage</td><td>V</td></tr><tr><td><code>VC</code></td><td>out</td><td>collector voltage</td><td>V</td></tr><tr><td><code>VCE</code></td><td>out</td><td>collector-emitter voltage</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> VEE &gt; VBE; active region: VCE &gt;= 0.2 V.</p>
<pre><code class="shell">$ electronics-engineering solve elx_bjt_emitter_bias &quot;VCC=10 V&quot; &quot;VEE=10 V&quot; &quot;RB=10000 ohm&quot; &quot;RC=4700 ohm&quot; &quot;RE=10000 ohm&quot; beta=100 &quot;VBE=0.7 V&quot;
IB = 9.117647059e-06 A
IC = 0.0009117647059 A
IE = 0.0009208823529 A
VB = -0.09117647059 V
VE = -0.7911764706 V
VC = 5.714705882 V
VCE = 6.505882353 V
  by: BJT dual-supply emitter bias: Q-point  (IE = (VEE - VBE)/(RE + RB/(beta + 1)); VB = -IB RB; VE = VB - VBE; VC = VCC - IC RC)
  VCC = 10 V
  VEE = 10 V
  RB = 10000 ohm
  RC = 4700 ohm
  RE = 10000 ohm
  beta = 100
  VBE = 0.7 V
  assumes: VEE &gt; VBE; active region: VCE &gt;= 0.2 V</code></pre>
<p>In the worked example, VCC = 10 V, VEE = 10 V, RB = 10000 ohm, RC = 4700 ohm, RE = 10000 ohm, beta = 100, VBE = 0.7 V go through the equation above and give IB = 9.117647059e-06 A, IC = 0.0009117647059 A, IE = 0.0009208823529 A, VB = -0.09117647059 V. It applies only when VEE &gt; VBE; active region: VCE &gt;= 0.2 V: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_bjt_fixed_bias">BJT fixed (base-resistor) bias: Q-point — <code>elx_bjt_fixed_bias</code></h4>
<p>The quiescent base and collector currents and the collector-emitter voltage of a common-emitter stage biased by a single base resistor from the supply.</p>
<div class="math">\[I_B = \frac{V_{CC} - V_{BE}}{R_B},\quad V_{CE} = V_{CC} - \beta I_BR_C\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>VCC</code></td><td>in</td><td>supply voltage</td><td>V</td></tr><tr><td><code>RB</code></td><td>in</td><td>base resistor</td><td>ohm</td></tr><tr><td><code>RC</code></td><td>in</td><td>collector resistor</td><td>ohm</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain</td><td>—</td></tr><tr><td><code>VBE</code></td><td>in</td><td>base-emitter voltage (about 0.7 V)</td><td>V</td></tr><tr><td><code>IB</code></td><td>out</td><td>base current</td><td>A</td></tr><tr><td><code>IC</code></td><td>out</td><td>collector current</td><td>A</td></tr><tr><td><code>IE</code></td><td>out</td><td>emitter current</td><td>A</td></tr><tr><td><code>VCE</code></td><td>out</td><td>collector-emitter voltage</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> active region: VCE &gt;= 0.2 V (otherwise refused as saturated).</p>
<pre><code class="shell">$ electronics-engineering solve elx_bjt_fixed_bias &quot;VCC=12 V&quot; &quot;RB=470000 ohm&quot; &quot;RC=2200 ohm&quot; beta=100 &quot;VBE=0.7 V&quot;
IB = 2.404255319e-05 A
IC = 0.002404255319 A
IE = 0.002428297872 A
VCE = 6.710638298 V
  by: BJT fixed (base-resistor) bias: Q-point  (IB = (VCC - VBE)/RB; IC = beta IB; VCE = VCC - IC RC)
  VCC = 12 V
  RB = 470000 ohm
  RC = 2200 ohm
  beta = 100
  VBE = 0.7 V
  assumes: active region: VCE &gt;= 0.2 V (otherwise refused as saturated)</code></pre>
<p>In the worked example, VCC = 12 V, RB = 470000 ohm, RC = 2200 ohm, beta = 100, VBE = 0.7 V go through the equation above and give IB = 2.404255319e-05 A, IC = 0.002404255319 A, IE = 0.002428297872 A, VCE = 6.710638298 V. It applies only when active region: VCE &gt;= 0.2 V (otherwise refused as saturated): outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_bjt_small_signal_parameters">BJT small-signal (hybrid-pi) parameters — <code>elx_bjt_small_signal_parameters</code></h4>
<p>The transconductance gm, the input resistance r_pi, the emitter resistance r_e, the output resistance r_o (Early voltage) and the intrinsic gain of a bipolar transistor at its bias current.</p>
<div class="math">\[g_m = \frac{I_C}{V_T},\quad r_\pi = \frac{\beta}{g_m},\quad r_e = \frac{\alpha}{g_m},\quad r_o = \frac{V_A}{I_C}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>IC</code></td><td>in</td><td>collector bias current</td><td>A</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain</td><td>—</td></tr><tr><td><code>VT</code></td><td>in</td><td>thermal voltage (25 or 26 mV)</td><td>V</td></tr><tr><td><code>VA</code></td><td>in</td><td>Early voltage</td><td>V</td></tr><tr><td><code>gm</code></td><td>out</td><td>transconductance</td><td>S</td></tr><tr><td><code>r_pi</code></td><td>out</td><td>base input resistance r_pi</td><td>ohm</td></tr><tr><td><code>r_e</code></td><td>out</td><td>emitter resistance r_e</td><td>ohm</td></tr><tr><td><code>r_o</code></td><td>out</td><td>output resistance</td><td>ohm</td></tr><tr><td><code>A0</code></td><td>out</td><td>intrinsic voltage gain gm r_o</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> IC, beta, VT, VA &gt; 0; active region.</p>
<pre><code class="shell">$ electronics-engineering solve elx_bjt_small_signal_parameters &quot;IC=1 mA&quot; beta=100 &quot;VT=25 mV&quot; &quot;VA=100 V&quot;
gm = 0.04 S
r_pi = 2500 ohm
r_e = 24.75247525 ohm
r_o = 100000 ohm
A0 = 4000
  by: BJT small-signal (hybrid-pi) parameters  (gm = IC/VT; r_pi = beta/gm; r_e = alpha/gm; r_o = VA/IC; A0 = VA/VT)
  IC = 0.001 A
  beta = 100
  VT = 0.025 V
  VA = 100 V
  assumes: IC, beta, VT, VA &gt; 0; active region</code></pre>
<p>In the worked example, IC = 1 mA, beta = 100, VT = 25 mV, VA = 100 V go through the equation above and give gm = 0.04 S, r_pi = 2500 ohm, r_e = 24.75247525 ohm, r_o = 100000 ohm. It applies only when IC, beta, VT, VA &gt; 0; active region: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_bjt_current_relations">BJT terminal currents from beta — <code>elx_bjt_current_relations</code></h4>
<p>The collector and emitter currents and the common-base current gain alpha of a bipolar transistor in the active region from its base current and beta.</p>
<div class="math">\[I_C = \beta I_B,\quad I_E = (\beta+1)I_B,\quad \alpha = \frac{\beta}{\beta+1}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>IB</code></td><td>in</td><td>base current</td><td>A</td></tr><tr><td><code>beta</code></td><td>in</td><td>common-emitter current gain (hFE)</td><td>—</td></tr><tr><td><code>IC</code></td><td>out</td><td>collector current</td><td>A</td></tr><tr><td><code>IE</code></td><td>out</td><td>emitter current</td><td>A</td></tr><tr><td><code>alpha</code></td><td>out</td><td>alpha = beta/(beta + 1)</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> IB &gt; 0, beta &gt; 0; active region.</p>
<pre><code class="shell">$ electronics-engineering solve elx_bjt_current_relations &quot;IB=20 uA&quot; beta=100
IC = 0.002 A
IE = 0.00202 A
alpha = 0.9900990099
  by: BJT terminal currents from beta  (IC = beta IB; IE = (beta + 1) IB; alpha = beta/(beta + 1))
  IB = 2e-05 A
  beta = 100
  assumes: IB &gt; 0, beta &gt; 0; active region</code></pre>
<p>In the worked example, IB = 20 uA, beta = 100 go through the equation above and give IC = 0.002 A, IE = 0.00202 A, alpha = 0.9900990099. It applies only when IB &gt; 0, beta &gt; 0; active region: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_bjt_voltage_divider_bias">BJT voltage-divider bias: exact Q-point — <code>elx_bjt_voltage_divider_bias</code></h4>
<p>The Q-point (base, collector and emitter currents, node voltages and VCE) of a common-emitter stage with a base voltage divider and an emitter resistor, by the exact Thevenin analysis (base current included).</p>
<div class="math">\[I_B = \frac{V_{TH} - V_{BE}}{R_{TH} + (\beta+1)R_E}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>VCC</code></td><td>in</td><td>supply voltage</td><td>V</td></tr><tr><td><code>R1</code></td><td>in</td><td>upper divider resistor (supply to base)</td><td>ohm</td></tr><tr><td><code>R2</code></td><td>in</td><td>lower divider resistor (base to ground)</td><td>ohm</td></tr><tr><td><code>RC</code></td><td>in</td><td>collector resistor</td><td>ohm</td></tr><tr><td><code>RE</code></td><td>in</td><td>emitter resistor</td><td>ohm</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain</td><td>—</td></tr><tr><td><code>VBE</code></td><td>in</td><td>base-emitter voltage</td><td>V</td></tr><tr><td><code>VTH</code></td><td>out</td><td>Thevenin voltage of the divider</td><td>V</td></tr><tr><td><code>RTH</code></td><td>out</td><td>Thevenin resistance of the divider</td><td>ohm</td></tr><tr><td><code>IB</code></td><td>out</td><td>base current</td><td>A</td></tr><tr><td><code>IC</code></td><td>out</td><td>collector current</td><td>A</td></tr><tr><td><code>IE</code></td><td>out</td><td>emitter current</td><td>A</td></tr><tr><td><code>VB</code></td><td>out</td><td>base voltage</td><td>V</td></tr><tr><td><code>VE</code></td><td>out</td><td>emitter voltage</td><td>V</td></tr><tr><td><code>VC</code></td><td>out</td><td>collector voltage</td><td>V</td></tr><tr><td><code>VCE</code></td><td>out</td><td>collector-emitter voltage</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> VTH &gt; VBE; active region: VCE &gt;= 0.2 V.</p>
<pre><code class="shell">$ electronics-engineering solve elx_bjt_voltage_divider_bias &quot;VCC=12 V&quot; &quot;R1=47000 ohm&quot; &quot;R2=10000 ohm&quot; &quot;RC=2200 ohm&quot; &quot;RE=470 ohm&quot; beta=150 &quot;VBE=0.7 V&quot;
VTH = 2.105263158 V
RTH = 8245.614035 ohm
IB = 1.773972436e-05 A
IC = 0.002660958654 A
IE = 0.002678698378 A
VB = 1.958988238 V
VE = 1.258988238 V
VC = 6.145890962 V
VCE = 4.886902724 V
  by: BJT voltage-divider bias: exact Q-point  (VTH = VCC R2/(R1 + R2); RTH = R1 || R2; IB = (VTH - VBE)/(RTH + (beta + 1) RE); VCE = VCC - IC RC - IE RE)
  VCC = 12 V
  R1 = 47000 ohm
  R2 = 10000 ohm
  RC = 2200 ohm
  RE = 470 ohm
  beta = 150
  VBE = 0.7 V
  assumes: VTH &gt; VBE; active region: VCE &gt;= 0.2 V</code></pre>
<p>In the worked example, VCC = 12 V, R1 = 47000 ohm, R2 = 10000 ohm, RC = 2200 ohm, RE = 470 ohm, beta = 150, VBE = 0.7 V go through the equation above and give VTH = 2.105263158 V, RTH = 8245.614035 ohm, IB = 1.773972436e-05 A, IC = 0.002660958654 A. It applies only when VTH &gt; VBE; active region: VCE &gt;= 0.2 V: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_common_base_amplifier">Common-base amplifier — <code>elx_common_base_amplifier</code></h4>
<p>The voltage gain (emitter to collector and source to load), the low input resistance and the output resistance of a common-base stage (hybrid-pi model, r_o neglected).</p>
<div class="math">\[A_v = g_m(R_C\parallel R_L),\quad R_{in} = R_E\parallel r_e\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>IC</code></td><td>in</td><td>collector bias current</td><td>A</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain</td><td>—</td></tr><tr><td><code>VT</code></td><td>in</td><td>thermal voltage</td><td>V</td></tr><tr><td><code>RC</code></td><td>in</td><td>collector resistor</td><td>ohm</td></tr><tr><td><code>RL</code></td><td>in</td><td>load resistor</td><td>ohm</td></tr><tr><td><code>RE</code></td><td>in</td><td>emitter bias resistor</td><td>ohm</td></tr><tr><td><code>Rsig</code></td><td>in</td><td>source resistance</td><td>ohm</td></tr><tr><td><code>Av</code></td><td>out</td><td>voltage gain emitter to output</td><td>—</td></tr><tr><td><code>Rin</code></td><td>out</td><td>input resistance (RE || r_e)</td><td>ohm</td></tr><tr><td><code>Rout</code></td><td>out</td><td>output resistance (RC)</td><td>ohm</td></tr><tr><td><code>Gv</code></td><td>out</td><td>overall gain from the source</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> r_o neglected; base at signal ground.</p>
<pre><code class="shell">$ electronics-engineering solve elx_common_base_amplifier &quot;IC=1 mA&quot; beta=100 &quot;VT=25 mV&quot; &quot;RC=5000 ohm&quot; &quot;RL=5000 ohm&quot; &quot;RE=10000 ohm&quot; &quot;Rsig=50 ohm&quot;
Av = 100
Rin = 24.69135802 ohm
Rout = 5000 ohm
Gv = 33.05785124
  by: Common-base amplifier  (Av = gm (RC || RL); Rin = RE || r_e with r_e = alpha/gm; Gv = Av Rin/(Rin + Rsig))
  IC = 0.001 A
  beta = 100
  VT = 0.025 V
  RC = 5000 ohm
  RL = 5000 ohm
  RE = 10000 ohm
  Rsig = 50 ohm
  assumes: r_o neglected; base at signal ground</code></pre>
<p>In the worked example, IC = 1 mA, beta = 100, VT = 25 mV, RC = 5000 ohm, RL = 5000 ohm, RE = 10000 ohm, Rsig = 50 ohm go through the equation above and give Av = 100, Rin = 24.69135802 ohm, Rout = 5000 ohm, Gv = 33.05785124. It applies only when r_o neglected; base at signal ground: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_common_collector_amplifier">Common-collector (emitter-follower) amplifier — <code>elx_common_collector_amplifier</code></h4>
<p>The voltage gain, input resistance and output resistance of an emitter follower, including the source resistance reflected into the emitter (hybrid-pi model, r_o neglected).</p>
<div class="math">\[A_v = \frac{(\beta+1)R_E&#x27;}{r_\pi + (\beta+1)R_E&#x27;},\quad R_{out} = R_E\parallel\frac{r_\pi + R_{sig}\parallel R_B}{\beta+1}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>IC</code></td><td>in</td><td>collector bias current</td><td>A</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain</td><td>—</td></tr><tr><td><code>VT</code></td><td>in</td><td>thermal voltage</td><td>V</td></tr><tr><td><code>RE</code></td><td>in</td><td>emitter resistor</td><td>ohm</td></tr><tr><td><code>RL</code></td><td>in</td><td>load resistor</td><td>ohm</td></tr><tr><td><code>RB</code></td><td>in</td><td>bias resistance at the base</td><td>ohm</td></tr><tr><td><code>Rsig</code></td><td>in</td><td>source resistance</td><td>ohm</td></tr><tr><td><code>Av</code></td><td>out</td><td>voltage gain base to output</td><td>—</td></tr><tr><td><code>Rin</code></td><td>out</td><td>input resistance</td><td>ohm</td></tr><tr><td><code>Rout</code></td><td>out</td><td>output resistance</td><td>ohm</td></tr><tr><td><code>Gv</code></td><td>out</td><td>overall gain from the source</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> r_o neglected.</p>
<pre><code class="shell">$ electronics-engineering solve elx_common_collector_amplifier &quot;IC=5 mA&quot; beta=100 &quot;VT=25 mV&quot; &quot;RE=1000 ohm&quot; &quot;RL=1000 ohm&quot; &quot;RB=100000 ohm&quot; &quot;Rsig=10000 ohm&quot;
Av = 0.9901960784
Rin = 33774.83444 ohm
Rout = 86.7242088 ohm
Gv = 0.7639939486
  by: Common-collector (emitter-follower) amplifier  (Av = (beta + 1)(RE || RL)/(r_pi + (beta + 1)(RE || RL)); Rout = RE || (r_pi + Rsig || RB)/(beta + 1))
  IC = 0.005 A
  beta = 100
  VT = 0.025 V
  RE = 1000 ohm
  RL = 1000 ohm
  RB = 100000 ohm
  Rsig = 10000 ohm
  assumes: r_o neglected</code></pre>
<p>In the worked example, IC = 5 mA, beta = 100, VT = 25 mV, RE = 1000 ohm, RL = 1000 ohm, RB = 100000 ohm, Rsig = 10000 ohm go through the equation above and give Av = 0.9901960784, Rin = 33774.83444 ohm, Rout = 86.7242088 ohm, Gv = 0.7639939486. It applies only when r_o neglected: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_common_emitter_amplifier">Common-emitter amplifier: gain, input and output resistance — <code>elx_common_emitter_amplifier</code></h4>
<p>The voltage gain (base to collector and source to load), the input and output resistances of a common-emitter stage with an optional unbypassed emitter resistance, from the bias current (hybrid-pi model, r_o neglected).</p>
<div class="math">\[A_v = -\frac{\beta\,(R_C\parallel R_L)}{r_\pi + (\beta+1)R_{E1}}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>IC</code></td><td>in</td><td>collector bias current</td><td>A</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain</td><td>—</td></tr><tr><td><code>VT</code></td><td>in</td><td>thermal voltage</td><td>V</td></tr><tr><td><code>RC</code></td><td>in</td><td>collector resistor</td><td>ohm</td></tr><tr><td><code>RL</code></td><td>in</td><td>load resistor</td><td>ohm</td></tr><tr><td><code>RE1</code></td><td>in</td><td>unbypassed emitter resistance (0 if fully bypassed)</td><td>ohm</td></tr><tr><td><code>RB</code></td><td>in</td><td>bias resistance seen at the base (R1 || R2)</td><td>ohm</td></tr><tr><td><code>Rsig</code></td><td>in</td><td>source resistance</td><td>ohm</td></tr><tr><td><code>gm</code></td><td>out</td><td>transconductance</td><td>S</td></tr><tr><td><code>r_pi</code></td><td>out</td><td>r_pi</td><td>ohm</td></tr><tr><td><code>Av</code></td><td>out</td><td>voltage gain base to output</td><td>—</td></tr><tr><td><code>Rin</code></td><td>out</td><td>input resistance (including RB)</td><td>ohm</td></tr><tr><td><code>Rout</code></td><td>out</td><td>output resistance (RC)</td><td>ohm</td></tr><tr><td><code>Gv</code></td><td>out</td><td>overall gain from the source voltage</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> r_o neglected; coupling and bypass capacitors short at signal frequency.</p>
<pre><code class="shell">$ electronics-engineering solve elx_common_emitter_amplifier &quot;IC=1 mA&quot; beta=100 &quot;VT=25 mV&quot; &quot;RC=5000 ohm&quot; &quot;RL=10000 ohm&quot; &quot;RE1=0 ohm&quot; &quot;RB=20000 ohm&quot; &quot;Rsig=1000 ohm&quot;
gm = 0.04 S
r_pi = 2500 ohm
Av = -133.3333333
Rin = 2222.222222 ohm
Rout = 5000 ohm
Gv = -91.95402299
  by: Common-emitter amplifier: gain, input and output resistance  (Av = -beta (RC || RL)/(r_pi + (beta + 1) RE1); Rin = RB || (r_pi + (beta + 1) RE1); Gv = Av Rin/(Rin + Rsig))
  IC = 0.001 A
  beta = 100
  VT = 0.025 V
  RC = 5000 ohm
  RL = 10000 ohm
  RE1 = 0 ohm
  RB = 20000 ohm
  Rsig = 1000 ohm
  assumes: r_o neglected; coupling and bypass capacitors short at signal frequency</code></pre>
<p>In the worked example, IC = 1 mA, beta = 100, VT = 25 mV, RC = 5000 ohm, RL = 10000 ohm, RE1 = 0 ohm, RB = 20000 ohm, Rsig = 1000 ohm go through the equation above and give gm = 0.04 S, r_pi = 2500 ohm, Av = -133.3333333, Rin = 2222.222222 ohm. It applies only when r_o neglected; coupling and bypass capacitors short at signal frequency: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_miller_high_cutoff">Common-emitter high-frequency cutoff: Miller effect and open-circuit time constants — <code>elx_miller_high_cutoff</code></h4>
<p>The Miller capacitance, the upper -3 dB frequency of a common-emitter (or common-source) stage by the Miller approximation, and the open-circuit time-constant estimate that also counts the output side of Cmu.</p>
<div class="math">\[C_M = C_\mu(1 + g_mR_L&#x27;),\quad \tau_{oc} = C_\pi R_\pi&#x27; + C_\mu\left(R_\pi&#x27; + R_L&#x27; + g_mR_\pi&#x27;R_L&#x27;\right)\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>gm</code></td><td>in</td><td>transconductance</td><td>S</td></tr><tr><td><code>r_pi</code></td><td>in</td><td>r_pi (use a very large value for a MOSFET)</td><td>ohm</td></tr><tr><td><code>Cpi</code></td><td>in</td><td>input capacitance Cpi (Cgs)</td><td>F</td></tr><tr><td><code>Cmu</code></td><td>in</td><td>feedback capacitance Cmu (Cgd)</td><td>F</td></tr><tr><td><code>RLp</code></td><td>in</td><td>total load at the collector (RC || RL || r_o)</td><td>ohm</td></tr><tr><td><code>Rsigp</code></td><td>in</td><td>source resistance seen at the base (Rsig || RB)</td><td>ohm</td></tr><tr><td><code>A_mid</code></td><td>out</td><td>gain across Cmu, -gm RL&#x27;</td><td>—</td></tr><tr><td><code>C_M</code></td><td>out</td><td>Miller capacitance</td><td>F</td></tr><tr><td><code>R_pi_eq</code></td><td>out</td><td>resistance seen by Cpi (r_pi || Rsig&#x27;)</td><td>ohm</td></tr><tr><td><code>f_H_miller</code></td><td>out</td><td>upper cutoff, Miller approximation</td><td>Hz</td></tr><tr><td><code>tau_oc</code></td><td>out</td><td>sum of open-circuit time constants</td><td>s</td></tr><tr><td><code>f_H_octc</code></td><td>out</td><td>upper cutoff, open-circuit time constants</td><td>Hz</td></tr></tbody></table>
<p><strong>Applies when:</strong> mid-band gain unchanged by the capacitors; dominant-pole estimate.</p>
<pre><code class="shell">$ electronics-engineering solve elx_miller_high_cutoff &quot;gm=40 mS&quot; &quot;r_pi=2500 ohm&quot; &quot;Cpi=10 pF&quot; &quot;Cmu=2 pF&quot; &quot;RLp=2500 ohm&quot; &quot;Rsigp=1000 ohm&quot;
A_mid = -100
C_M = 2.02e-10 F
R_pi_eq = 714.2857143 ohm
f_H_miller = 1051023.209 Hz
tau_oc = 1.564285714e-07 s
f_H_octc = 1017428.86 Hz
  by: Common-emitter high-frequency cutoff: Miller effect and open-circuit time constants  (C_M = Cmu (1 + gm RL&#x27;); f_H = 1/(2 pi (r_pi || Rsig&#x27;)(Cpi + C_M)); tau = Cpi R&#x27; + Cmu (R&#x27; + RL&#x27; + gm R&#x27; RL&#x27;))
  gm = 0.04 S
  r_pi = 2500 ohm
  Cpi = 1e-11 F
  Cmu = 2e-12 F
  RLp = 2500 ohm
  Rsigp = 1000 ohm
  assumes: mid-band gain unchanged by the capacitors; dominant-pole estimate</code></pre>
<p>In the worked example, gm = 40 mS, r_pi = 2500 ohm, Cpi = 10 pF, Cmu = 2 pF, RLp = 2500 ohm, Rsigp = 1000 ohm go through the equation above and give A_mid = -100, C_M = 2.02e-10 F, R_pi_eq = 714.2857143 ohm, f_H_miller = 1051023.209 Hz. It applies only when mid-band gain unchanged by the capacitors; dominant-pole estimate: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_low_frequency_cutoff">Common-emitter low-frequency cutoff by short-circuit time constants — <code>elx_low_frequency_cutoff</code></h4>
<p>The resistance seen by each coupling and bypass capacitor of a common-emitter amplifier and the lower -3 dB frequency estimated as the sum of the short-circuit pole frequencies (r_o neglected).</p>
<div class="math">\[f_L \approx \sum_i \frac{1}{2\pi R_iC_i}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Rsig</code></td><td>in</td><td>source resistance</td><td>ohm</td></tr><tr><td><code>RB</code></td><td>in</td><td>bias resistance at the base (R1 || R2)</td><td>ohm</td></tr><tr><td><code>r_pi</code></td><td>in</td><td>r_pi</td><td>ohm</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain</td><td>—</td></tr><tr><td><code>RE</code></td><td>in</td><td>emitter resistor (bypassed by CE)</td><td>ohm</td></tr><tr><td><code>RC</code></td><td>in</td><td>collector resistor</td><td>ohm</td></tr><tr><td><code>RL</code></td><td>in</td><td>load resistor</td><td>ohm</td></tr><tr><td><code>C1</code></td><td>in</td><td>input coupling capacitor</td><td>F</td></tr><tr><td><code>C2</code></td><td>in</td><td>output coupling capacitor</td><td>F</td></tr><tr><td><code>CE</code></td><td>in</td><td>emitter bypass capacitor</td><td>F</td></tr><tr><td><code>R_C1</code></td><td>out</td><td>resistance seen by C1</td><td>ohm</td></tr><tr><td><code>R_CE</code></td><td>out</td><td>resistance seen by CE</td><td>ohm</td></tr><tr><td><code>R_C2</code></td><td>out</td><td>resistance seen by C2</td><td>ohm</td></tr><tr><td><code>f_C1</code></td><td>out</td><td>pole of C1</td><td>Hz</td></tr><tr><td><code>f_CE</code></td><td>out</td><td>pole of CE</td><td>Hz</td></tr><tr><td><code>f_C2</code></td><td>out</td><td>pole of C2</td><td>Hz</td></tr><tr><td><code>f_L</code></td><td>out</td><td>estimated lower cutoff</td><td>Hz</td></tr></tbody></table>
<p><strong>Applies when:</strong> short-circuit time-constant estimate; r_o neglected.</p>
<pre><code class="shell">$ electronics-engineering solve elx_low_frequency_cutoff &quot;Rsig=1000 ohm&quot; &quot;RB=20000 ohm&quot; &quot;r_pi=2500 ohm&quot; beta=100 &quot;RE=1000 ohm&quot; &quot;RC=5000 ohm&quot; &quot;RL=10000 ohm&quot; &quot;C1=10 uF&quot; &quot;C2=10 uF&quot; &quot;CE=100 uF&quot;
R_C1 = 3222.222222 ohm
R_CE = 33.05219968 ohm
R_C2 = 15000 ohm
f_C1 = 4.939291337 Hz
f_CE = 48.15260244 Hz
f_C2 = 1.061032954 Hz
f_L = 54.15292673 Hz
  by: Common-emitter low-frequency cutoff by short-circuit time constants  (R_C1 = Rsig + RB || r_pi; R_CE = RE || (r_pi + Rsig || RB)/(beta + 1); R_C2 = RC + RL; f_L = sum 1/(2 pi R C))
  Rsig = 1000 ohm
  RB = 20000 ohm
  r_pi = 2500 ohm
  beta = 100
  RE = 1000 ohm
  RC = 5000 ohm
  RL = 10000 ohm
  C1 = 1e-05 F
  C2 = 1e-05 F
  CE = 0.0001 F
  assumes: short-circuit time-constant estimate; r_o neglected</code></pre>
<p>In the worked example, Rsig = 1000 ohm, RB = 20000 ohm, r_pi = 2500 ohm, beta = 100, RE = 1000 ohm, RC = 5000 ohm, RL = 10000 ohm, C1 = 10 uF, C2 = 10 uF, CE = 100 uF go through the equation above and give R_C1 = 3222.222222 ohm, R_CE = 33.05219968 ohm, R_C2 = 15000 ohm, f_C1 = 4.939291337 Hz. It applies only when short-circuit time-constant estimate; r_o neglected: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_wilson_current_mirror">Wilson current mirror output current — <code>elx_wilson_current_mirror</code></h4>
<p>The output current of a three-transistor Wilson current mirror and its small base-current error, 2/(beta^2 + 2 beta + 2).</p>
<div class="math">\[I_{out} = I_{ref}\left(1 - \frac{2}{\beta^2 + 2\beta + 2}\right)\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Iref</code></td><td>in</td><td>reference current</td><td>A</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain of each matched transistor</td><td>—</td></tr><tr><td><code>Iout</code></td><td>out</td><td>output current</td><td>A</td></tr><tr><td><code>ratio</code></td><td>out</td><td>Iout/Iref</td><td>—</td></tr><tr><td><code>error</code></td><td>out</td><td>relative error 1 - Iout/Iref</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> matched transistors, Early effect neglected.</p>
<pre><code class="shell">$ electronics-engineering solve elx_wilson_current_mirror &quot;Iref=1 mA&quot; beta=100
Iout = 0.00099980396 A
ratio = 0.99980396
error = 0.0001960399922
  by: Wilson current mirror output current  (Iout = Iref (1 - 2/(beta^2 + 2 beta + 2)))
  Iref = 0.001 A
  beta = 100
  assumes: matched transistors, Early effect neglected</code></pre>
<p>In the worked example, Iref = 1 mA, beta = 100 go through the equation above and give Iout = 0.00099980396 A, ratio = 0.99980396, error = 0.0001960399922. It applies only when matched transistors, Early effect neglected: outside that it says what is wrong instead of returning a number.</p>
<h3>CMOS (2)</h3>
<h4 id="elx_cmos_propagation_delay">CMOS gate propagation delay (switch-resistor model) — <code>elx_cmos_propagation_delay</code></h4>
<p>The high-to-low and low-to-high propagation delays (50 % points) and their average for a CMOS gate modelled as switched equivalent resistances driving a load capacitance.</p>
<div class="math">\[t_{pHL} = \ln 2\,R_nC_L,\quad t_{pLH} = \ln 2\,R_pC_L\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Rn</code></td><td>in</td><td>equivalent on-resistance of the pull-down network</td><td>ohm</td></tr><tr><td><code>Rp</code></td><td>in</td><td>equivalent on-resistance of the pull-up network</td><td>ohm</td></tr><tr><td><code>CL</code></td><td>in</td><td>load capacitance</td><td>F</td></tr><tr><td><code>tpHL</code></td><td>out</td><td>high-to-low delay</td><td>s</td></tr><tr><td><code>tpLH</code></td><td>out</td><td>low-to-high delay</td><td>s</td></tr><tr><td><code>tp</code></td><td>out</td><td>average propagation delay</td><td>s</td></tr></tbody></table>
<p><strong>Applies when:</strong> step input, RC switch model.</p>
<pre><code class="shell">$ electronics-engineering solve elx_cmos_propagation_delay &quot;Rn=10000 ohm&quot; &quot;Rp=20000 ohm&quot; &quot;CL=100 fF&quot;
tpHL = 6.931471806e-10 s
tpLH = 1.386294361e-09 s
tp = 1.039720771e-09 s
  by: CMOS gate propagation delay (switch-resistor model)  (tpHL = ln 2 Rn CL; tpLH = ln 2 Rp CL; tp = (tpHL + tpLH)/2)
  Rn = 10000 ohm
  Rp = 20000 ohm
  CL = 1e-13 F
  assumes: step input, RC switch model</code></pre>
<p>In the worked example, Rn = 10000 ohm, Rp = 20000 ohm, CL = 100 fF go through the equation above and give tpHL = 6.931471806e-10 s, tpLH = 1.386294361e-09 s, tp = 1.039720771e-09 s. It applies only when step input, RC switch model: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_cmos_switching_threshold">CMOS inverter switching threshold VM — <code>elx_cmos_switching_threshold</code></h4>
<p>The switching threshold of a CMOS inverter (input = output, both transistors saturated) from the supply, the two threshold voltages and the two transconductance parameters.</p>
<div class="math">\[V_M = \frac{V_{tn} + r\,(V_{DD} - |V_{tp}|)}{1 + r},\quad r = \sqrt{k_p/k_n}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>VDD</code></td><td>in</td><td>supply voltage</td><td>V</td></tr><tr><td><code>Vtn</code></td><td>in</td><td>NMOS threshold</td><td>V</td></tr><tr><td><code>Vtp</code></td><td>in</td><td>magnitude of the PMOS threshold</td><td>V</td></tr><tr><td><code>kn</code></td><td>in</td><td>NMOS mu_n Cox W/L</td><td>A/V^2</td></tr><tr><td><code>kp</code></td><td>in</td><td>PMOS mu_p Cox W/L</td><td>A/V^2</td></tr><tr><td><code>r</code></td><td>out</td><td>sqrt(kp/kn)</td><td>—</td></tr><tr><td><code>VM</code></td><td>out</td><td>switching threshold</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> Vtn + |Vtp| &lt; VDD; lambda neglected.</p>
<pre><code class="shell">$ electronics-engineering solve elx_cmos_switching_threshold &quot;VDD=2.5 V&quot; &quot;Vtn=0.4 V&quot; &quot;Vtp=0.4 V&quot; &quot;kn=0.1 mA/V^2&quot; &quot;kp=0.1 mA/V^2&quot;
r = 1
VM = 1.25 V
  by: CMOS inverter switching threshold VM  (VM = (Vtn + r (VDD - |Vtp|))/(1 + r), r = sqrt(kp/kn))
  VDD = 2.5 V
  Vtn = 0.4 V
  Vtp = 0.4 V
  kn = 0.0001 A/V^2
  kp = 0.0001 A/V^2
  assumes: Vtn + |Vtp| &lt; VDD; lambda neglected</code></pre>
<p>In the worked example, VDD = 2.5 V, Vtn = 0.4 V, Vtp = 0.4 V, kn = 0.1 mA/V^2, kp = 0.1 mA/V^2 go through the equation above and give r = 1, VM = 1.25 V. It applies only when Vtn + |Vtp| &lt; VDD; lambda neglected: outside that it says what is wrong instead of returning a number.</p>
<h3>Data converters (9)</h3>
<h4 id="elx_adc_code">ADC output code, LSB and quantisation error — <code>elx_adc_code</code></h4>
<p>The output code (decimal and binary) of an ideal unipolar truncating n-bit ADC for an input voltage, the LSB size, the voltage the code represents and the quantisation error.</p>
<div class="math">\[D = \left\lfloor \frac{V_{in}}{V_{ref}}2^n\right\rfloor,\quad \text{LSB} = \frac{V_{ref}}{2^n}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Vin</code></td><td>in</td><td>analog input</td><td>V</td></tr><tr><td><code>Vref</code></td><td>in</td><td>reference (full-scale) voltage</td><td>V</td></tr><tr><td><code>n</code></td><td>in</td><td>resolution in bits</td><td>—</td></tr><tr><td><code>code</code></td><td>out</td><td>output code (decimal)</td><td>—</td></tr><tr><td><code>bits</code></td><td>out</td><td>output code in binary</td><td>—</td></tr><tr><td><code>LSB</code></td><td>out</td><td>LSB = Vref/2^n</td><td>V</td></tr><tr><td><code>V_code</code></td><td>out</td><td>voltage of the code</td><td>V</td></tr><tr><td><code>error</code></td><td>out</td><td>quantisation error Vin - code LSB</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> 0 &lt;= Vin &lt;= Vref; 1 &lt;= n &lt;= 16.</p>
<pre><code class="shell">$ electronics-engineering solve elx_adc_code &quot;Vin=3.2 V&quot; &quot;Vref=5 V&quot; n=8
code = 163
bits = 10100011
LSB = 0.01953125 V
V_code = 3.18359375 V
error = 0.01640625 V
  by: ADC output code, LSB and quantisation error  (code = floor(Vin 2^n/Vref), at most 2^n - 1; LSB = Vref/2^n)
  Vin = 3.2 V
  Vref = 5 V
  assumes: 0 &lt;= Vin &lt;= Vref; 1 &lt;= n &lt;= 16</code></pre>
<p>In the worked example, Vin = 3.2 V, Vref = 5 V, n = 8 go through the equation above and give code = 163, bits = 10100011, LSB = 0.01953125 V, V_code = 3.18359375 V. It applies only when 0 &lt;= Vin &lt;= Vref; 1 &lt;= n &lt;= 16: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_adc_quantization_snr">ADC quantisation SNR with oversampling — <code>elx_adc_quantization_snr</code></h4>
<p>The signal-to-quantisation-noise ratio of an ideal n-bit converter for a sine input (6.02 n + 1.76 dB at full scale), with an oversampling ratio and a reduced amplitude, and the in-band noise in LSB.</p>
<div class="math">\[\text{SNR} = 6.02\,n + 1.76 + 10\log_{10}\text{OSR}\ \text{dB}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>n</code></td><td>in</td><td>resolution in bits</td><td>—</td></tr><tr><td><code>OSR</code></td><td>in</td><td>oversampling ratio (default 1) (optional)</td><td>—</td></tr><tr><td><code>A_frac</code></td><td>in</td><td>sine amplitude as a fraction of full scale (default 1) (optional)</td><td>—</td></tr><tr><td><code>SNR_dB</code></td><td>out</td><td>signal-to-quantisation-noise ratio, dB</td><td>—</td></tr><tr><td><code>noise_rms_lsb</code></td><td>out</td><td>in-band noise rms in LSB</td><td>—</td></tr><tr><td><code>SNR_full_scale_dB</code></td><td>out</td><td>full-scale SNR without oversampling, dB</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> uniform quantisation noise, white over Nyquist; OSR &gt;= 1.</p>
<pre><code class="shell">$ electronics-engineering solve elx_adc_quantization_snr n=12
SNR_dB = 74.00811155
noise_rms_lsb = 0.2886751346
SNR_full_scale_dB = 74.00811155
  by: ADC quantisation SNR with oversampling  (SNR = 20 log10(A 2^n sqrt(1.5)) + 10 log10(OSR) = 6.02 n + 1.76 + 20 log10 A + 10 log10 OSR)
  assumes: uniform quantisation noise, white over Nyquist; OSR &gt;= 1</code></pre>
<p>In the worked example, n = 12 go through the equation above and give SNR_dB = 74.00811155, noise_rms_lsb = 0.2886751346, SNR_full_scale_dB = 74.00811155. It applies only when uniform quantisation noise, white over Nyquist; OSR &gt;= 1: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_dac_binary_weighted">Binary-weighted resistor DAC — <code>elx_dac_binary_weighted</code></h4>
<p>The output voltage and summing current of a binary-weighted resistor DAC with an inverting op-amp (MSB resistor R, each lower bit doubling it) and the largest resistor needed.</p>
<div class="math">\[V_{out} = -V_{ref}\frac{R_f}{R}\sum_{k=0}^{n-1}\frac{b_k}{2^k} = -V_{ref}\frac{R_f}{R}\frac{D}{2^{n-1}}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>n</code></td><td>in</td><td>resolution in bits</td><td>—</td></tr><tr><td><code>code</code></td><td>in</td><td>input code (decimal)</td><td>—</td></tr><tr><td><code>Vref</code></td><td>in</td><td>reference voltage</td><td>V</td></tr><tr><td><code>R</code></td><td>in</td><td>MSB resistor</td><td>ohm</td></tr><tr><td><code>Rf</code></td><td>in</td><td>feedback resistor</td><td>ohm</td></tr><tr><td><code>Vout</code></td><td>out</td><td>output voltage</td><td>V</td></tr><tr><td><code>I_total</code></td><td>out</td><td>total current into the summing node</td><td>A</td></tr><tr><td><code>R_LSB</code></td><td>out</td><td>LSB resistor R 2^(n-1)</td><td>ohm</td></tr></tbody></table>
<p><strong>Applies when:</strong> ideal switches and op-amp.</p>
<pre><code class="shell">$ electronics-engineering solve elx_dac_binary_weighted n=4 code=10 &quot;Vref=5 V&quot; &quot;R=10000 ohm&quot; &quot;Rf=5000 ohm&quot;
Vout = -3.125 V
I_total = 0.000625 A
R_LSB = 80000 ohm
  by: Binary-weighted resistor DAC  (I = Vref D/(R 2^(n-1)); Vout = -Rf I)
  Vref = 5 V
  R = 10000 ohm
  Rf = 5000 ohm
  assumes: ideal switches and op-amp</code></pre>
<p>In the worked example, n = 4, code = 10, Vref = 5 V, R = 10000 ohm, Rf = 5000 ohm go through the equation above and give Vout = -3.125 V, I_total = 0.000625 A, R_LSB = 80000 ohm. It applies only when ideal switches and op-amp: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_dac_output">DAC output voltage (R-2R or any binary DAC) — <code>elx_dac_output</code></h4>
<p>The output voltage of an ideal n-bit unipolar DAC for a code, Vout = Vref D/2^n, its step size and its full-scale output.</p>
<div class="math">\[V_{out} = V_{ref}\frac{D}{2^n}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>n</code></td><td>in</td><td>resolution in bits</td><td>—</td></tr><tr><td><code>code</code></td><td>in</td><td>input code (decimal)</td><td>—</td></tr><tr><td><code>Vref</code></td><td>in</td><td>reference voltage</td><td>V</td></tr><tr><td><code>Vout</code></td><td>out</td><td>output voltage</td><td>V</td></tr><tr><td><code>LSB</code></td><td>out</td><td>step size Vref/2^n</td><td>V</td></tr><tr><td><code>V_full_scale</code></td><td>out</td><td>output for the all-ones code</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> 0 &lt;= code &lt;= 2^n - 1.</p>
<pre><code class="shell">$ electronics-engineering solve elx_dac_output n=8 code=200 &quot;Vref=5 V&quot;
Vout = 3.90625 V
LSB = 0.01953125 V
V_full_scale = 4.98046875 V
  by: DAC output voltage (R-2R or any binary DAC)  (Vout = Vref D/2^n; full scale Vref (2^n - 1)/2^n)
  Vref = 5 V
  assumes: 0 &lt;= code &lt;= 2^n - 1</code></pre>
<p>In the worked example, n = 8, code = 200, Vref = 5 V go through the equation above and give Vout = 3.90625 V, LSB = 0.01953125 V, V_full_scale = 4.98046875 V. It applies only when 0 &lt;= code &lt;= 2^n - 1: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_dual_slope_adc">Dual-slope integrating ADC — <code>elx_dual_slope_adc</code></h4>
<p>The fixed integration time, the de-integration time and count, and the peak integrator voltage of a dual-slope ADC.</p>
<div class="math">\[T_2 = T_1\frac{V_{in}}{V_{ref}},\quad N_2 = N_1\frac{V_{in}}{V_{ref}}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Vin</code></td><td>in</td><td>input voltage (magnitude)</td><td>V</td></tr><tr><td><code>Vref</code></td><td>in</td><td>reference voltage (magnitude)</td><td>V</td></tr><tr><td><code>N1</code></td><td>in</td><td>fixed count of the integration phase</td><td>—</td></tr><tr><td><code>fclk</code></td><td>in</td><td>clock frequency</td><td>Hz</td></tr><tr><td><code>R</code></td><td>in</td><td>integrator resistor</td><td>ohm</td></tr><tr><td><code>C</code></td><td>in</td><td>integrator capacitor</td><td>F</td></tr><tr><td><code>T1</code></td><td>out</td><td>integration time N1/fclk</td><td>s</td></tr><tr><td><code>T2</code></td><td>out</td><td>de-integration time</td><td>s</td></tr><tr><td><code>N2</code></td><td>out</td><td>count of the de-integration phase (unrounded)</td><td>—</td></tr><tr><td><code>V_peak</code></td><td>out</td><td>peak integrator output</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> 0 &lt; Vin &lt;= Vref.</p>
<pre><code class="shell">$ electronics-engineering solve elx_dual_slope_adc &quot;Vin=0.5 V&quot; &quot;Vref=1 V&quot; N1=1000 &quot;fclk=100000 Hz&quot; &quot;R=100000 ohm&quot; &quot;C=0.1 uF&quot;
T1 = 0.01 s
T2 = 0.005 s
N2 = 500
V_peak = 0.5 V
  by: Dual-slope integrating ADC  (T1 = N1/fclk; T2 = T1 Vin/Vref; N2 = N1 Vin/Vref; V_peak = Vin T1/(R C))
  Vin = 0.5 V
  Vref = 1 V
  fclk = 100000 Hz
  R = 100000 ohm
  C = 1e-07 F
  assumes: 0 &lt; Vin &lt;= Vref</code></pre>
<p>In the worked example, Vin = 0.5 V, Vref = 1 V, N1 = 1000, fclk = 100000 Hz, R = 100000 ohm, C = 0.1 uF go through the equation above and give T1 = 0.01 s, T2 = 0.005 s, N2 = 500, V_peak = 0.5 V. It applies only when 0 &lt; Vin &lt;= Vref: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_adc_enob">Effective number of bits (ENOB) from SINAD — <code>elx_adc_enob</code></h4>
<p>The effective number of bits of a converter from its measured SINAD (IEEE 1241: ENOB = (SINAD - 1.76)/6.02) and the bits lost against its nominal resolution.</p>
<div class="math">\[\text{ENOB} = \frac{\text{SINAD} - 1.76}{6.02}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>SINAD</code></td><td>in</td><td>signal to noise and distortion ratio in dB</td><td>—</td></tr><tr><td><code>n</code></td><td>in</td><td>nominal resolution in bits</td><td>—</td></tr><tr><td><code>ENOB</code></td><td>out</td><td>effective number of bits</td><td>—</td></tr><tr><td><code>bits_lost</code></td><td>out</td><td>n - ENOB</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> full-scale sine test.</p>
<pre><code class="shell">$ electronics-engineering solve elx_adc_enob SINAD=74 n=14
ENOB = 12
bits_lost = 2
  by: Effective number of bits (ENOB) from SINAD  (ENOB = (SINAD - 1.76)/6.02)
  SINAD = 74
  assumes: full-scale sine test</code></pre>
<p>In the worked example, SINAD = 74, n = 14 go through the equation above and give ENOB = 12, bits_lost = 2. It applies only when full-scale sine test: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_sample_hold_droop">Sample-and-hold droop — <code>elx_sample_hold_droop</code></h4>
<p>The droop rate I/C of a sample-and-hold capacitor discharged by a leakage current, the droop over a hold time (in volts and LSB) and the longest hold that keeps the droop within half an LSB of an n-bit converter.</p>
<div class="math">\[\frac{dV}{dt} = \frac{I_{leak}}{C}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>I_leak</code></td><td>in</td><td>leakage (bias) current</td><td>A</td></tr><tr><td><code>C</code></td><td>in</td><td>hold capacitor</td><td>F</td></tr><tr><td><code>t_hold</code></td><td>in</td><td>hold time</td><td>s</td></tr><tr><td><code>Vref</code></td><td>in</td><td>converter full scale</td><td>V</td></tr><tr><td><code>n</code></td><td>in</td><td>converter resolution in bits</td><td>—</td></tr><tr><td><code>droop_rate</code></td><td>out</td><td>droop rate I/C</td><td>V/s</td></tr><tr><td><code>droop</code></td><td>out</td><td>droop over the hold time</td><td>V</td></tr><tr><td><code>droop_lsb</code></td><td>out</td><td>droop in LSB</td><td>—</td></tr><tr><td><code>t_max_half_lsb</code></td><td>out</td><td>longest hold for half an LSB</td><td>s</td></tr></tbody></table>
<p><strong>Applies when:</strong> constant leakage current.</p>
<pre><code class="shell">$ electronics-engineering solve elx_sample_hold_droop &quot;I_leak=1 nA&quot; &quot;C=1 nF&quot; &quot;t_hold=10 us&quot; &quot;Vref=5 V&quot; n=12
droop_rate = 1 V/s
droop = 1e-05 V
droop_lsb = 0.008192
t_max_half_lsb = 0.0006103515625 s
  by: Sample-and-hold droop  (dV/dt = I/C; dV = I t/C; t_max = (Vref/2^(n+1)) C/I)
  I_leak = 1e-09 A
  C = 1e-09 F
  t_hold = 1e-05 s
  Vref = 5 V
  assumes: constant leakage current</code></pre>
<p>In the worked example, I_leak = 1 nA, C = 1 nF, t_hold = 10 us, Vref = 5 V, n = 12 go through the equation above and give droop_rate = 1 V/s, droop = 1e-05 V, droop_lsb = 0.008192, t_max_half_lsb = 0.0006103515625 s. It applies only when constant leakage current: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_aperture_jitter_snr">SNR limit from sampling-clock (aperture) jitter — <code>elx_aperture_jitter_snr</code></h4>
<p>The SNR limit -20 log10(2 pi f tj) set by rms sampling-clock jitter for a full-scale sine, combined with the quantisation SNR of an n-bit converter into a total SNR and effective bits.</p>
<div class="math">\[\text{SNR}_j = -20\log_{10}(2\pi f t_j)\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>f</code></td><td>in</td><td>input frequency</td><td>Hz</td></tr><tr><td><code>tj</code></td><td>in</td><td>rms clock jitter</td><td>s</td></tr><tr><td><code>n</code></td><td>in</td><td>converter resolution in bits</td><td>—</td></tr><tr><td><code>SNR_jitter_dB</code></td><td>out</td><td>jitter-limited SNR, dB</td><td>—</td></tr><tr><td><code>SNR_quant_dB</code></td><td>out</td><td>quantisation SNR, dB</td><td>—</td></tr><tr><td><code>SNR_total_dB</code></td><td>out</td><td>combined SNR, dB</td><td>—</td></tr><tr><td><code>ENOB_total</code></td><td>out</td><td>effective bits of the combination</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> full-scale sine; jitter and quantisation noise uncorrelated.</p>
<pre><code class="shell">$ electronics-engineering solve elx_aperture_jitter_snr &quot;f=100000000 Hz&quot; &quot;tj=1 ps&quot; n=14
SNR_jitter_dB = 64.03640263
SNR_quant_dB = 86.04931138
SNR_total_dB = 64.00916741
ENOB_total = 10.34039326
  by: SNR limit from sampling-clock (aperture) jitter  (SNR_j = -20 log10(2 pi f tj); SNR_q = 6.02 n + 1.76; noise powers add)
  f = 100000000 Hz
  tj = 1e-12 s
  assumes: full-scale sine; jitter and quantisation noise uncorrelated</code></pre>
<p>In the worked example, f = 100000000 Hz, tj = 1 ps, n = 14 go through the equation above and give SNR_jitter_dB = 64.03640263, SNR_quant_dB = 86.04931138, SNR_total_dB = 64.00916741, ENOB_total = 10.34039326. It applies only when full-scale sine; jitter and quantisation noise uncorrelated: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_sar_conversion">Successive-approximation (SAR) ADC conversion — <code>elx_sar_conversion</code></h4>
<p>The bit-by-bit trial voltages, the final code (decimal and binary) and the DAC voltage of an ideal n-bit successive-approximation ADC converting an input.</p>
<div class="math">\[b_k = \left[V_{in} \ge V_{DAC}(D_{k} + 2^k)\right]\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Vin</code></td><td>in</td><td>analog input</td><td>V</td></tr><tr><td><code>Vref</code></td><td>in</td><td>reference voltage</td><td>V</td></tr><tr><td><code>n</code></td><td>in</td><td>resolution in bits</td><td>—</td></tr><tr><td><code>code</code></td><td>out</td><td>final code</td><td>—</td></tr><tr><td><code>bits</code></td><td>out</td><td>final code in binary</td><td>—</td></tr><tr><td><code>trials</code></td><td>out</td><td>trial DAC voltages, MSB first (V)</td><td>—</td></tr><tr><td><code>V_dac</code></td><td>out</td><td>DAC voltage of the final code</td><td>V</td></tr><tr><td><code>cycles</code></td><td>out</td><td>comparison cycles</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> 0 &lt;= Vin &lt; Vref.</p>
<pre><code class="shell">$ electronics-engineering solve elx_sar_conversion &quot;Vin=3.2 V&quot; &quot;Vref=5 V&quot; n=4
code = 10
bits = 1010
trials = [2.5,3.75,3.125,3.4375]
V_dac = 3.125 V
cycles = 4
  by: Successive-approximation (SAR) ADC conversion  (for each bit from the MSB: set it, keep it if Vin &gt;= DAC(trial); LSB = Vref/2^n)
  Vin = 3.2 V
  Vref = 5 V
  assumes: 0 &lt;= Vin &lt; Vref</code></pre>
<p>In the worked example, Vin = 3.2 V, Vref = 5 V, n = 4 go through the equation above and give code = 10, bits = 1010, trials = [2.5, 3.75, 3.125, 3.4375], V_dac = 3.125 V. It applies only when 0 &lt;= Vin &lt; Vref: outside that it says what is wrong instead of returning a number.</p>
<h3>Diodes (8)</h3>
<h4 id="elx_capacitor_filter_ripple">Capacitor-input filter: ripple voltage and DC output — <code>elx_capacitor_filter_ripple</code></h4>
<p>The peak-to-peak ripple, the DC output, the RMS ripple and the ripple factor of a rectifier with a smoothing capacitor and resistive load (small-ripple approximation).</p>
<div class="math">\[V_r = \frac{V_p}{f_rR_LC},\quad V_{dc} = V_p - \frac{V_r}{2}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Vp</code></td><td>in</td><td>peak rectified voltage (after the diode drops)</td><td>V</td></tr><tr><td><code>f</code></td><td>in</td><td>line frequency</td><td>Hz</td></tr><tr><td><code>RL</code></td><td>in</td><td>load resistance</td><td>ohm</td></tr><tr><td><code>C</code></td><td>in</td><td>filter capacitance</td><td>F</td></tr><tr><td><code>circuit</code></td><td>in</td><td>half-wave or full-wave rectification</td><td>—</td></tr><tr><td><code>f_ripple</code></td><td>out</td><td>ripple frequency</td><td>Hz</td></tr><tr><td><code>Vr</code></td><td>out</td><td>peak-to-peak ripple</td><td>V</td></tr><tr><td><code>Vdc</code></td><td>out</td><td>DC output voltage</td><td>V</td></tr><tr><td><code>Vr_rms</code></td><td>out</td><td>RMS ripple</td><td>V</td></tr><tr><td><code>ripple_factor</code></td><td>out</td><td>ripple factor</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> Vr &lt; Vp (small ripple).</p>
<pre><code class="shell">$ electronics-engineering solve elx_capacitor_filter_ripple &quot;Vp=16.3 V&quot; &quot;f=60 Hz&quot; &quot;RL=500 ohm&quot; &quot;C=1000 uF&quot; circuit=full-wave
f_ripple = 120 Hz
Vr = 0.2716666667 V
Vdc = 16.16416667 V
Vr_rms = 0.07842341156 V
ripple_factor = 0.004851682934
  by: Capacitor-input filter: ripple voltage and DC output  (Vr = Vp/(f_r RL C); Vdc = Vp - Vr/2; Vr,rms = Vr/(2 sqrt 3))
  Vp = 16.3 V
  f = 60 Hz
  RL = 500 ohm
  C = 0.001 F
  circuit = full-wave
  assumes: Vr &lt; Vp (small ripple)</code></pre>
<p>In the worked example, Vp = 16.3 V, f = 60 Hz, RL = 500 ohm, C = 1000 uF, circuit = full-wave go through the equation above and give f_ripple = 120 Hz, Vr = 0.2716666667 V, Vdc = 16.16416667 V, Vr_rms = 0.07842341156 V. It applies only when Vr &lt; Vp (small ripple): outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_shockley_diode_current">Diode current from the Shockley equation — <code>elx_shockley_diode_current</code></h4>
<p>The current of a pn-junction diode at a terminal voltage from its saturation current, ideality factor and temperature (forward or reverse).</p>
<div class="math">\[I_D = I_S\left(e^{V_D/nV_T} - 1\right)\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Is</code></td><td>in</td><td>saturation current</td><td>A</td></tr><tr><td><code>n</code></td><td>in</td><td>ideality (emission) factor, 1 to 2</td><td>—</td></tr><tr><td><code>VD</code></td><td>in</td><td>diode voltage (negative for reverse bias)</td><td>V</td></tr><tr><td><code>T</code></td><td>in</td><td>junction temperature</td><td>K</td></tr><tr><td><code>ID</code></td><td>out</td><td>diode current</td><td>A</td></tr><tr><td><code>VT</code></td><td>out</td><td>thermal voltage</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> Is, n, T &gt; 0.</p>
<pre><code class="shell">$ electronics-engineering solve elx_shockley_diode_current &quot;Is=1e-14 A&quot; n=1 &quot;VD=0.65 V&quot; &quot;T=300 K&quot;
ID = 0.0008308438348 A
VT = 0.02585199979 V
  by: Diode current from the Shockley equation  (ID = Is (exp(VD/(n VT)) - 1), VT = kT/q)
  Is = 1e-14 A
  n = 1
  VD = 0.65 V
  T = 300 K
  assumes: Is, n, T &gt; 0</code></pre>
<p>In the worked example, Is = 1e-14 A, n = 1, VD = 0.65 V, T = 300 K go through the equation above and give ID = 0.0008308438348 A, VT = 0.02585199979 V. It applies only when Is, n, T &gt; 0: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_diode_voltage">Diode voltage for a given current — <code>elx_diode_voltage</code></h4>
<p>The voltage across a pn-junction diode carrying a given current (the inverse of the Shockley equation).</p>
<div class="math">\[V_D = nV_T\ln\left(1 + \frac{I_D}{I_S}\right)\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>ID</code></td><td>in</td><td>diode current</td><td>A</td></tr><tr><td><code>Is</code></td><td>in</td><td>saturation current</td><td>A</td></tr><tr><td><code>n</code></td><td>in</td><td>ideality factor</td><td>—</td></tr><tr><td><code>T</code></td><td>in</td><td>junction temperature</td><td>K</td></tr><tr><td><code>VD</code></td><td>out</td><td>diode voltage</td><td>V</td></tr><tr><td><code>VT</code></td><td>out</td><td>thermal voltage</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> ID &gt; -Is; Is, n, T &gt; 0.</p>
<pre><code class="shell">$ electronics-engineering solve elx_diode_voltage &quot;ID=0.001 A&quot; &quot;Is=1e-14 A&quot; n=1 &quot;T=300 K&quot;
VD = 0.6547907227 V
VT = 0.02585199979 V
  by: Diode voltage for a given current  (VD = n VT ln(1 + ID/Is))
  ID = 0.001 A
  Is = 1e-14 A
  n = 1
  T = 300 K
  assumes: ID &gt; -Is; Is, n, T &gt; 0</code></pre>
<p>In the worked example, ID = 0.001 A, Is = 1e-14 A, n = 1, T = 300 K go through the equation above and give VD = 0.6547907227 V, VT = 0.02585199979 V. It applies only when ID &gt; -Is; Is, n, T &gt; 0: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_led_series_resistor">LED series (current-limiting) resistor — <code>elx_led_series_resistor</code></h4>
<p>The current-limiting resistor for one LED or a string of LEDs in series at a chosen forward current, and the power in the resistor and in the LEDs.</p>
<div class="math">\[R = \frac{V_S - nV_F}{I_F}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Vs</code></td><td>in</td><td>supply voltage</td><td>V</td></tr><tr><td><code>Vf</code></td><td>in</td><td>forward voltage of one LED</td><td>V</td></tr><tr><td><code>If</code></td><td>in</td><td>LED forward current</td><td>A</td></tr><tr><td><code>n</code></td><td>in</td><td>number of LEDs in series (default 1) (optional)</td><td>—</td></tr><tr><td><code>R</code></td><td>out</td><td>series resistance</td><td>ohm</td></tr><tr><td><code>P_R</code></td><td>out</td><td>power in the resistor</td><td>W</td></tr><tr><td><code>P_LED</code></td><td>out</td><td>power in the LEDs</td><td>W</td></tr></tbody></table>
<p><strong>Applies when:</strong> Vs &gt; n Vf; If &gt; 0.</p>
<pre><code class="shell">$ electronics-engineering solve elx_led_series_resistor &quot;Vs=5 V&quot; &quot;Vf=2 V&quot; &quot;If=20 mA&quot;
R = 150 ohm
P_R = 0.06 W
P_LED = 0.04 W
  by: LED series (current-limiting) resistor  (R = (Vs - n Vf)/If; P_R = If^2 R)
  Vs = 5 V
  Vf = 2 V
  If = 0.02 A
  assumes: Vs &gt; n Vf; If &gt; 0</code></pre>
<p>In the worked example, Vs = 5 V, Vf = 2 V, If = 20 mA go through the equation above and give R = 150 ohm, P_R = 0.06 W, P_LED = 0.04 W. It applies only when Vs &gt; n Vf; If &gt; 0: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_diode_operating_point">Operating point of a diode in series with a resistor (exact) — <code>elx_diode_operating_point</code></h4>
<p>The current and voltage of a forward-biased diode fed from a DC source through a resistor, solving the Shockley equation and Kirchhoff&#x27;s voltage law together (no constant-drop approximation).</p>
<div class="math">\[V_S = I_DR + nV_T\ln\left(1 + \frac{I_D}{I_S}\right)\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>VS</code></td><td>in</td><td>source voltage</td><td>V</td></tr><tr><td><code>R</code></td><td>in</td><td>series resistance</td><td>ohm</td></tr><tr><td><code>Is</code></td><td>in</td><td>saturation current</td><td>A</td></tr><tr><td><code>n</code></td><td>in</td><td>ideality factor</td><td>—</td></tr><tr><td><code>T</code></td><td>in</td><td>junction temperature</td><td>K</td></tr><tr><td><code>ID</code></td><td>out</td><td>diode current</td><td>A</td></tr><tr><td><code>VD</code></td><td>out</td><td>diode voltage</td><td>V</td></tr><tr><td><code>P_D</code></td><td>out</td><td>power in the diode</td><td>W</td></tr></tbody></table>
<p><strong>Applies when:</strong> VS &gt; 0 (forward bias); R, Is, n, T &gt; 0.</p>
<pre><code class="shell">$ electronics-engineering solve elx_diode_operating_point &quot;VS=5 V&quot; &quot;R=1000 ohm&quot; &quot;Is=1e-14 A&quot; n=1 &quot;T=300 K&quot;
ID = 0.004307456373 A
VD = 0.6925436275 V
P_D = 0.002983101461 W
  by: Operating point of a diode in series with a resistor (exact)  (solve VS = ID R + n VT ln(1 + ID/Is) (bisection on VD))
  VS = 5 V
  R = 1000 ohm
  Is = 1e-14 A
  n = 1
  T = 300 K
  assumes: VS &gt; 0 (forward bias); R, Is, n, T &gt; 0</code></pre>
<p>In the worked example, VS = 5 V, R = 1000 ohm, Is = 1e-14 A, n = 1, T = 300 K go through the equation above and give ID = 0.004307456373 A, VD = 0.6925436275 V, P_D = 0.002983101461 W. It applies only when VS &gt; 0 (forward bias); R, Is, n, T &gt; 0: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_rectifier_averages">Rectifier output: average, RMS, ripple factor and PIV — <code>elx_rectifier_averages</code></h4>
<p>The DC (average) and RMS output voltage, ripple factor, peak inverse voltage and conduction angle of an unfiltered half-wave, bridge or centre-tapped full-wave rectifier with a constant diode drop (0 V for ideal diodes).</p>
<div class="math">\[V_{dc} = \frac{k}{2\pi}\left[2V_m\cos\theta_1 - V(\pi - 2\theta_1)\right],\ \theta_1 = \arcsin\frac{V}{V_m}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Vm</code></td><td>in</td><td>peak AC voltage of the (secondary) winding</td><td>V</td></tr><tr><td><code>circuit</code></td><td>in</td><td>half-wave, bridge or center-tapped (Vm per half of the winding)</td><td>—</td></tr><tr><td><code>Von</code></td><td>in</td><td>forward drop of one diode (0 V for ideal diodes)</td><td>V</td></tr><tr><td><code>Vp_out</code></td><td>out</td><td>peak output voltage</td><td>V</td></tr><tr><td><code>Vdc</code></td><td>out</td><td>average output voltage</td><td>V</td></tr><tr><td><code>Vrms</code></td><td>out</td><td>RMS output voltage</td><td>V</td></tr><tr><td><code>ripple_factor</code></td><td>out</td><td>ripple factor (AC rms / DC)</td><td>—</td></tr><tr><td><code>PIV</code></td><td>out</td><td>peak inverse voltage of a diode</td><td>V</td></tr><tr><td><code>conduction_deg</code></td><td>out</td><td>conduction angle per half cycle, degrees</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> diode drops below Vm; resistive load, no filter.</p>
<pre><code class="shell">$ electronics-engineering solve elx_rectifier_averages &quot;Vm=10 V&quot; circuit=half-wave &quot;Von=0 V&quot;
Vp_out = 10 V
Vdc = 3.183098862 V
Vrms = 5 V
ripple_factor = 1.211363323
PIV = 10 V
conduction_deg = 180
  by: Rectifier output: average, RMS, ripple factor and PIV  (output max(0, Vm|sin| - V) with V = Von (2 Von for a bridge); averages integrated exactly; PIV Vm, Vm - Von, 2Vm - Von)
  Vm = 10 V
  Von = 0 V
  circuit = half-wave
  assumes: diode drops below Vm; resistive load, no filter</code></pre>
<p>In the worked example, Vm = 10 V, circuit = half-wave, Von = 0 V go through the equation above and give Vp_out = 10 V, Vdc = 3.183098862 V, Vrms = 5 V, ripple_factor = 1.211363323. It applies only when diode drops below Vm; resistive load, no filter: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_zener_series_resistor_design">Zener regulator design: series resistor and Zener rating — <code>elx_zener_series_resistor_design</code></h4>
<p>The largest series resistance that keeps a Zener regulator in regulation at the lowest input and largest load, and the resulting worst-case Zener current and power (highest input, smallest load) and resistor power.</p>
<div class="math">\[R_S = \frac{V_{in,min} - V_Z}{I_{Z,min} + I_{L,max}}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Vin_min</code></td><td>in</td><td>lowest input voltage</td><td>V</td></tr><tr><td><code>Vin_max</code></td><td>in</td><td>highest input voltage</td><td>V</td></tr><tr><td><code>Vz</code></td><td>in</td><td>Zener voltage</td><td>V</td></tr><tr><td><code>IL_min</code></td><td>in</td><td>smallest load current</td><td>A</td></tr><tr><td><code>IL_max</code></td><td>in</td><td>largest load current</td><td>A</td></tr><tr><td><code>Iz_min</code></td><td>in</td><td>minimum Zener current for regulation</td><td>A</td></tr><tr><td><code>Rs_max</code></td><td>out</td><td>largest series resistance</td><td>ohm</td></tr><tr><td><code>Iz_max</code></td><td>out</td><td>worst-case Zener current</td><td>A</td></tr><tr><td><code>Pz_max</code></td><td>out</td><td>worst-case Zener power</td><td>W</td></tr><tr><td><code>PRs_max</code></td><td>out</td><td>worst-case resistor power</td><td>W</td></tr></tbody></table>
<p><strong>Applies when:</strong> Vin_min &gt; Vz; Vin_max &gt;= Vin_min, IL_max &gt;= IL_min &gt;= 0.</p>
<pre><code class="shell">$ electronics-engineering solve elx_zener_series_resistor_design &quot;Vin_min=12 V&quot; &quot;Vin_max=15 V&quot; &quot;Vz=9.1 V&quot; &quot;IL_min=0 mA&quot; &quot;IL_max=50 mA&quot; &quot;Iz_min=5 mA&quot;
Rs_max = 52.72727273 ohm
Iz_max = 0.1118965517 A
Pz_max = 1.018258621 W
PRs_max = 0.6601896552 W
  by: Zener regulator design: series resistor and Zener rating  (Rs = (Vin,min - Vz)/(Iz,min + IL,max); Iz,max = (Vin,max - Vz)/Rs - IL,min; Pz = Vz Iz,max)
  Vin_min = 12 V
  Vin_max = 15 V
  Vz = 9.1 V
  IL_min = 0 A
  IL_max = 0.05 A
  Iz_min = 0.005 A
  assumes: Vin_min &gt; Vz; Vin_max &gt;= Vin_min, IL_max &gt;= IL_min &gt;= 0</code></pre>
<p>In the worked example, Vin_min = 12 V, Vin_max = 15 V, Vz = 9.1 V, IL_min = 0 mA, IL_max = 50 mA, Iz_min = 5 mA go through the equation above and give Rs_max = 52.72727273 ohm, Iz_max = 0.1118965517 A, Pz_max = 1.018258621 W, PRs_max = 0.6601896552 W. It applies only when Vin_min &gt; Vz; Vin_max &gt;= Vin_min, IL_max &gt;= IL_min &gt;= 0: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_zener_regulator">Zener shunt regulator: load voltage and currents — <code>elx_zener_regulator</code></h4>
<p>The output voltage and the source, load and Zener currents and the Zener power of a Zener shunt regulator (series resistor, Zener across the load), with an optional Zener resistance.</p>
<div class="math">\[I_Z = \frac{V_{in} - V_Z}{R_S} - \frac{V_Z}{R_L}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Vin</code></td><td>in</td><td>input voltage</td><td>V</td></tr><tr><td><code>Rs</code></td><td>in</td><td>series resistance</td><td>ohm</td></tr><tr><td><code>Vz</code></td><td>in</td><td>Zener (breakdown) voltage</td><td>V</td></tr><tr><td><code>RL</code></td><td>in</td><td>load resistance</td><td>ohm</td></tr><tr><td><code>rz</code></td><td>in</td><td>Zener resistance (0 for an ideal Zener) (optional)</td><td>ohm</td></tr><tr><td><code>Vout</code></td><td>out</td><td>load voltage</td><td>V</td></tr><tr><td><code>I_s</code></td><td>out</td><td>current in the series resistor</td><td>A</td></tr><tr><td><code>I_L</code></td><td>out</td><td>load current</td><td>A</td></tr><tr><td><code>I_z</code></td><td>out</td><td>Zener current</td><td>A</td></tr><tr><td><code>P_z</code></td><td>out</td><td>Zener power</td><td>W</td></tr></tbody></table>
<p><strong>Applies when:</strong> the Zener must be in breakdown: Vin RL/(Rs + RL) &gt; Vz.</p>
<pre><code class="shell">$ electronics-engineering solve elx_zener_regulator &quot;Vin=20 V&quot; &quot;Rs=220 ohm&quot; &quot;Vz=10 V&quot; &quot;RL=1000 ohm&quot;
Vout = 10 V
I_s = 0.04545454545 A
I_L = 0.01 A
I_z = 0.03545454545 A
P_z = 0.3545454545 W
  by: Zener shunt regulator: load voltage and currents  (ideal: Vout = Vz, Iz = (Vin - Vz)/Rs - Vz/RL; with rz: node equation at the load)
  Vin = 20 V
  Rs = 220 ohm
  Vz = 10 V
  RL = 1000 ohm
  assumes: the Zener must be in breakdown: Vin RL/(Rs + RL) &gt; Vz</code></pre>
<p>In the worked example, Vin = 20 V, Rs = 220 ohm, Vz = 10 V, RL = 1000 ohm go through the equation above and give Vout = 10 V, I_s = 0.04545454545 A, I_L = 0.01 A, I_z = 0.03545454545 A. It applies only when the Zener must be in breakdown: Vin RL/(Rs + RL) &gt; Vz: outside that it says what is wrong instead of returning a number.</p>
<h3>MOSFET (6)</h3>
<h4 id="elx_common_source_amplifier">Common-source amplifier with source degeneration and ro — <code>elx_common_source_amplifier</code></h4>
<p>The voltage gain, input and output resistances and overall gain of a common-source stage, exact with the transistor&#x27;s output resistance ro and an optional unbypassed source resistor.</p>
<div class="math">\[A_v = -\frac{g_mr_oR_D&#x27;}{R_D&#x27; + r_o + R_S(1 + g_mr_o)}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>gm</code></td><td>in</td><td>transconductance</td><td>S</td></tr><tr><td><code>ro</code></td><td>in</td><td>transistor output resistance</td><td>ohm</td></tr><tr><td><code>RD</code></td><td>in</td><td>drain resistor</td><td>ohm</td></tr><tr><td><code>RL</code></td><td>in</td><td>load resistor</td><td>ohm</td></tr><tr><td><code>RS</code></td><td>in</td><td>unbypassed source resistance (0 if bypassed)</td><td>ohm</td></tr><tr><td><code>RG</code></td><td>in</td><td>gate bias resistance</td><td>ohm</td></tr><tr><td><code>Rsig</code></td><td>in</td><td>source resistance</td><td>ohm</td></tr><tr><td><code>Av</code></td><td>out</td><td>voltage gain gate to output</td><td>—</td></tr><tr><td><code>Rin</code></td><td>out</td><td>input resistance</td><td>ohm</td></tr><tr><td><code>Rout</code></td><td>out</td><td>output resistance (excluding RL)</td><td>ohm</td></tr><tr><td><code>Gv</code></td><td>out</td><td>overall gain from the source</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> gm, ro, RD, RL, RG, Rsig &gt; 0; RS &gt;= 0.</p>
<pre><code class="shell">$ electronics-engineering solve elx_common_source_amplifier &quot;gm=2 mS&quot; &quot;ro=100000 ohm&quot; &quot;RD=10000 ohm&quot; &quot;RL=10000 ohm&quot; &quot;RS=0 ohm&quot; &quot;RG=1000000 ohm&quot; &quot;Rsig=10000 ohm&quot;
Av = -9.523809524
Rin = 1000000 ohm
Rout = 9090.909091 ohm
Gv = -9.42951438
  by: Common-source amplifier with source degeneration and ro  (Av = -gm ro RD&#x27;/(RD&#x27; + ro + RS (1 + gm ro)) with RD&#x27; = RD || RL; Rout = RD || (ro + RS(1 + gm ro)))
  gm = 0.002 S
  ro = 100000 ohm
  RD = 10000 ohm
  RL = 10000 ohm
  RS = 0 ohm
  RG = 1000000 ohm
  Rsig = 10000 ohm
  assumes: gm, ro, RD, RL, RG, Rsig &gt; 0; RS &gt;= 0</code></pre>
<p>In the worked example, gm = 2 mS, ro = 100000 ohm, RD = 10000 ohm, RL = 10000 ohm, RS = 0 ohm, RG = 1000000 ohm, Rsig = 10000 ohm go through the equation above and give Av = -9.523809524, Rin = 1000000 ohm, Rout = 9090.909091 ohm, Gv = -9.42951438. It applies only when gm, ro, RD, RL, RG, Rsig &gt; 0; RS &gt;= 0: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_mosfet_drain_current">MOSFET drain current (cutoff, triode, saturation) — <code>elx_mosfet_drain_current</code></h4>
<p>The operating region and drain current of an enhancement NMOS transistor by the square law: cutoff, triode or saturation with optional channel-length modulation (use magnitudes for PMOS).</p>
<div class="math">\[I_D = \begin{cases} k_n\left(V_{OV}V_{DS} - \tfrac{1}{2}V_{DS}^2\right) &amp; V_{DS} &lt; V_{OV}\\ \tfrac{1}{2}k_nV_{OV}^2(1+\lambda V_{DS}) &amp; V_{DS}\ge V_{OV}\end{cases}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>kn</code></td><td>in</td><td>process transconductance times aspect ratio, mu Cox W/L</td><td>A/V^2</td></tr><tr><td><code>Vt</code></td><td>in</td><td>threshold voltage</td><td>V</td></tr><tr><td><code>VGS</code></td><td>in</td><td>gate-source voltage</td><td>V</td></tr><tr><td><code>VDS</code></td><td>in</td><td>drain-source voltage</td><td>V</td></tr><tr><td><code>lam</code></td><td>in</td><td>channel-length modulation lambda (default 0) (optional)</td><td>1/V</td></tr><tr><td><code>region</code></td><td>out</td><td>cutoff, triode or saturation</td><td>—</td></tr><tr><td><code>ID</code></td><td>out</td><td>drain current</td><td>A</td></tr><tr><td><code>VOV</code></td><td>out</td><td>overdrive VGS - Vt</td><td>V</td></tr><tr><td><code>VDS_sat</code></td><td>out</td><td>saturation voltage</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> kn, Vt &gt; 0; VDS &gt;= 0; long-channel square law.</p>
<pre><code class="shell">$ electronics-engineering solve elx_mosfet_drain_current &quot;kn=2 mA/V^2&quot; &quot;Vt=1 V&quot; &quot;VGS=3 V&quot; &quot;VDS=5 V&quot;
region = saturation
ID = 0.004 A
VOV = 2 V
VDS_sat = 2 V
  by: MOSFET drain current (cutoff, triode, saturation)  (cutoff VOV &lt;= 0; triode VDS &lt; VOV: ID = kn (VOV VDS - VDS^2/2); saturation: ID = (kn/2) VOV^2 (1 + lambda VDS))
  kn = 0.002 A/V^2
  Vt = 1 V
  VGS = 3 V
  VDS = 5 V
  assumes: kn, Vt &gt; 0; VDS &gt;= 0; long-channel square law</code></pre>
<p>In the worked example, kn = 2 mA/V^2, Vt = 1 V, VGS = 3 V, VDS = 5 V go through the equation above and give region = saturation, ID = 0.004 A, VOV = 2 V, VDS_sat = 2 V. It applies only when kn, Vt &gt; 0; VDS &gt;= 0; long-channel square law: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_mosfet_gm_ro">MOSFET small-signal gm, ro and intrinsic gain — <code>elx_mosfet_gm_ro</code></h4>
<p>The overdrive voltage, gate-source voltage, transconductance gm = sqrt(2 kn ID), output resistance ro = 1/(lambda ID) and intrinsic gain of a MOSFET in saturation at a drain current.</p>
<div class="math">\[g_m = \sqrt{2k_nI_D} = \frac{2I_D}{V_{OV}},\quad r_o = \frac{1}{\lambda I_D}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>kn</code></td><td>in</td><td>mu Cox W/L</td><td>A/V^2</td></tr><tr><td><code>ID</code></td><td>in</td><td>drain bias current</td><td>A</td></tr><tr><td><code>lam</code></td><td>in</td><td>channel-length modulation lambda</td><td>1/V</td></tr><tr><td><code>Vt</code></td><td>in</td><td>threshold voltage</td><td>V</td></tr><tr><td><code>VOV</code></td><td>out</td><td>overdrive voltage</td><td>V</td></tr><tr><td><code>VGS</code></td><td>out</td><td>gate-source voltage</td><td>V</td></tr><tr><td><code>gm</code></td><td>out</td><td>transconductance</td><td>S</td></tr><tr><td><code>r_o</code></td><td>out</td><td>output resistance</td><td>ohm</td></tr><tr><td><code>A0</code></td><td>out</td><td>intrinsic gain gm r_o</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> saturation; ID taken without the (1 + lambda VDS) factor.</p>
<pre><code class="shell">$ electronics-engineering solve elx_mosfet_gm_ro &quot;kn=2 mA/V^2&quot; &quot;ID=1 mA&quot; &quot;lam=0.01 1/V&quot; &quot;Vt=0.7 V&quot;
VOV = 1 V
VGS = 1.7 V
gm = 0.002 S
r_o = 100000 ohm
A0 = 200
  by: MOSFET small-signal gm, ro and intrinsic gain  (VOV = sqrt(2 ID/kn); gm = sqrt(2 kn ID) = 2 ID/VOV; ro = 1/(lambda ID))
  kn = 0.002 A/V^2
  ID = 0.001 A
  lam = 0.01 1/V
  Vt = 0.7 V
  assumes: saturation; ID taken without the (1 + lambda VDS) factor</code></pre>
<p>In the worked example, kn = 2 mA/V^2, ID = 1 mA, lam = 0.01 1/V, Vt = 0.7 V go through the equation above and give VOV = 1 V, VGS = 1.7 V, gm = 0.002 S, r_o = 100000 ohm. It applies only when saturation; ID taken without the (1 + lambda VDS) factor: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_mosfet_body_effect">MOSFET threshold voltage with body effect — <code>elx_mosfet_body_effect</code></h4>
<p>The threshold voltage of a MOSFET whose source is above its body, Vt = Vt0 + gamma (sqrt(2 phiF + VSB) - sqrt(2 phiF)).</p>
<div class="math">\[V_t = V_{t0} + \gamma\left(\sqrt{2\phi_F + V_{SB}} - \sqrt{2\phi_F}\right)\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Vt0</code></td><td>in</td><td>zero-bias threshold voltage</td><td>V</td></tr><tr><td><code>gamma</code></td><td>in</td><td>body-effect coefficient in V^0.5</td><td>—</td></tr><tr><td><code>phi2F</code></td><td>in</td><td>surface potential 2 phi_F (about 0.6 to 0.9 V)</td><td>V</td></tr><tr><td><code>VSB</code></td><td>in</td><td>source-body voltage</td><td>V</td></tr><tr><td><code>Vt</code></td><td>out</td><td>threshold voltage</td><td>V</td></tr><tr><td><code>dVt</code></td><td>out</td><td>threshold increase</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> VSB &gt;= 0; uniform substrate doping.</p>
<pre><code class="shell">$ electronics-engineering solve elx_mosfet_body_effect &quot;Vt0=0.7 V&quot; gamma=0.4 &quot;phi2F=0.7 V&quot; &quot;VSB=3 V&quot;
Vt = 1.134751352 V
dVt = 0.4347513519 V
  by: MOSFET threshold voltage with body effect  (Vt = Vt0 + gamma (sqrt(2 phiF + VSB) - sqrt(2 phiF)))
  Vt0 = 0.7 V
  gamma = 0.4
  phi2F = 0.7 V
  VSB = 3 V
  assumes: VSB &gt;= 0; uniform substrate doping</code></pre>
<p>In the worked example, Vt0 = 0.7 V, gamma = 0.4, phi2F = 0.7 V, VSB = 3 V go through the equation above and give Vt = 1.134751352 V, dVt = 0.4347513519 V. It applies only when VSB &gt;= 0; uniform substrate doping: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_mosfet_divider_bias">MOSFET voltage-divider bias with source resistor: Q-point — <code>elx_mosfet_divider_bias</code></h4>
<p>The Q-point (gate voltage, VGS, drain current, node voltages and VDS) of an NMOS stage with a gate divider and a source resistor, solving the square law and the gate loop (the physical root), with a saturation check.</p>
<div class="math">\[V_{OV} = \frac{2(V_G - V_t)}{1 + \sqrt{1 + 2k_nR_S(V_G - V_t)}},\quad I_D = \tfrac{1}{2}k_nV_{OV}^2\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>VDD</code></td><td>in</td><td>supply voltage</td><td>V</td></tr><tr><td><code>R1</code></td><td>in</td><td>upper gate resistor</td><td>ohm</td></tr><tr><td><code>R2</code></td><td>in</td><td>lower gate resistor</td><td>ohm</td></tr><tr><td><code>RD</code></td><td>in</td><td>drain resistor</td><td>ohm</td></tr><tr><td><code>RS</code></td><td>in</td><td>source resistor (0 allowed)</td><td>ohm</td></tr><tr><td><code>kn</code></td><td>in</td><td>mu Cox W/L</td><td>A/V^2</td></tr><tr><td><code>Vt</code></td><td>in</td><td>threshold voltage</td><td>V</td></tr><tr><td><code>VG</code></td><td>out</td><td>gate voltage</td><td>V</td></tr><tr><td><code>VGS</code></td><td>out</td><td>gate-source voltage</td><td>V</td></tr><tr><td><code>VOV</code></td><td>out</td><td>overdrive</td><td>V</td></tr><tr><td><code>ID</code></td><td>out</td><td>drain current</td><td>A</td></tr><tr><td><code>VS</code></td><td>out</td><td>source voltage</td><td>V</td></tr><tr><td><code>VD</code></td><td>out</td><td>drain voltage</td><td>V</td></tr><tr><td><code>VDS</code></td><td>out</td><td>drain-source voltage</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> VG &gt; Vt; saturation: VDS &gt;= VOV (otherwise refused); lambda neglected.</p>
<pre><code class="shell">$ electronics-engineering solve elx_mosfet_divider_bias &quot;VDD=15 V&quot; &quot;R1=1000000 ohm&quot; &quot;R2=500000 ohm&quot; &quot;RD=3300 ohm&quot; &quot;RS=1000 ohm&quot; &quot;kn=2 mA/V^2&quot; &quot;Vt=1.5 V&quot;
VG = 5 V
VGS = 2.936491673 V
VOV = 1.436491673 V
ID = 0.002063508327 A
VS = 2.063508327 V
VD = 8.190422521 V
VDS = 6.126914194 V
  by: MOSFET voltage-divider bias with source resistor: Q-point  (VG = VDD R2/(R1 + R2); (kn RS/2) VOV^2 + VOV - (VG - Vt) = 0, positive root; ID = (kn/2) VOV^2)
  VDD = 15 V
  R1 = 1000000 ohm
  R2 = 500000 ohm
  RD = 3300 ohm
  RS = 1000 ohm
  kn = 0.002 A/V^2
  Vt = 1.5 V
  assumes: VG &gt; Vt; saturation: VDS &gt;= VOV (otherwise refused); lambda neglected</code></pre>
<p>In the worked example, VDD = 15 V, R1 = 1000000 ohm, R2 = 500000 ohm, RD = 3300 ohm, RS = 1000 ohm, kn = 2 mA/V^2, Vt = 1.5 V go through the equation above and give VG = 5 V, VGS = 2.936491673 V, VOV = 1.436491673 V, ID = 0.002063508327 A. It applies only when VG &gt; Vt; saturation: VDS &gt;= VOV (otherwise refused); lambda neglected: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_source_follower">Source follower (common drain) — <code>elx_source_follower</code></h4>
<p>The voltage gain, input resistance, output resistance and overall gain of a MOSFET source follower, including ro.</p>
<div class="math">\[A_v = \frac{g_mR}{1 + g_mR},\quad R_{out} = R_S\parallel r_o\parallel\frac{1}{g_m}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>gm</code></td><td>in</td><td>transconductance</td><td>S</td></tr><tr><td><code>ro</code></td><td>in</td><td>transistor output resistance</td><td>ohm</td></tr><tr><td><code>RS</code></td><td>in</td><td>source resistor</td><td>ohm</td></tr><tr><td><code>RL</code></td><td>in</td><td>load resistor</td><td>ohm</td></tr><tr><td><code>RG</code></td><td>in</td><td>gate bias resistance</td><td>ohm</td></tr><tr><td><code>Rsig</code></td><td>in</td><td>source resistance</td><td>ohm</td></tr><tr><td><code>Av</code></td><td>out</td><td>voltage gain gate to output</td><td>—</td></tr><tr><td><code>Rin</code></td><td>out</td><td>input resistance</td><td>ohm</td></tr><tr><td><code>Rout</code></td><td>out</td><td>output resistance</td><td>ohm</td></tr><tr><td><code>Gv</code></td><td>out</td><td>overall gain</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> drain at signal ground.</p>
<pre><code class="shell">$ electronics-engineering solve elx_source_follower &quot;gm=2 mS&quot; &quot;ro=50000 ohm&quot; &quot;RS=2000 ohm&quot; &quot;RL=2000 ohm&quot; &quot;RG=1000000 ohm&quot; &quot;Rsig=10000 ohm&quot;
Av = 0.6622516556
Rin = 1000000 ohm
Rout = 396.8253968 ohm
Gv = 0.6556947085
  by: Source follower (common drain)  (Av = gm R/(1 + gm R) with R = RS || RL || ro; Rout = RS || ro || 1/gm)
  gm = 0.002 S
  ro = 50000 ohm
  RS = 2000 ohm
  RL = 2000 ohm
  RG = 1000000 ohm
  Rsig = 10000 ohm
  assumes: drain at signal ground</code></pre>
<p>In the worked example, gm = 2 mS, ro = 50000 ohm, RS = 2000 ohm, RL = 2000 ohm, RG = 1000000 ohm, Rsig = 10000 ohm go through the equation above and give Av = 0.6622516556, Rin = 1000000 ohm, Rout = 396.8253968 ohm, Gv = 0.6556947085. It applies only when drain at signal ground: outside that it says what is wrong instead of returning a number.</p>
<h3>Op-amps (14)</h3>
<h4 id="elx_closed_loop_bandwidth">Closed-loop bandwidth from the gain-bandwidth product — <code>elx_closed_loop_bandwidth</code></h4>
<p>The closed-loop gain, the noise gain 1 + Rf/R1 and the -3 dB bandwidth GBW/(noise gain) of an inverting or non-inverting amplifier built with a single-pole op-amp.</p>
<div class="math">\[f_{3dB} = \frac{\text{GBW}}{1 + R_f/R_1}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>GBW</code></td><td>in</td><td>gain-bandwidth product (unity-gain frequency)</td><td>Hz</td></tr><tr><td><code>config</code></td><td>in</td><td>inverting or non-inverting amplifier</td><td>—</td></tr><tr><td><code>Rf</code></td><td>in</td><td>feedback resistor</td><td>ohm</td></tr><tr><td><code>R1</code></td><td>in</td><td>input (or ground) resistor</td><td>ohm</td></tr><tr><td><code>G0</code></td><td>out</td><td>low-frequency closed-loop gain</td><td>—</td></tr><tr><td><code>noise_gain</code></td><td>out</td><td>noise gain 1 + Rf/R1</td><td>—</td></tr><tr><td><code>f_3dB</code></td><td>out</td><td>closed-loop -3 dB bandwidth</td><td>Hz</td></tr></tbody></table>
<p><strong>Applies when:</strong> single-pole op-amp with open-loop gain much larger than the closed-loop gain.</p>
<pre><code class="shell">$ electronics-engineering solve elx_closed_loop_bandwidth &quot;GBW=1000000 Hz&quot; config=non-inverting &quot;Rf=90000 ohm&quot; &quot;R1=10000 ohm&quot;
G0 = 10
noise_gain = 10
f_3dB = 100000 Hz
  by: Closed-loop bandwidth from the gain-bandwidth product  (f_3dB = GBW/(1 + Rf/R1) for both configurations)
  GBW = 1000000 Hz
  Rf = 90000 ohm
  R1 = 10000 ohm
  config = non-inverting
  assumes: single-pole op-amp with open-loop gain much larger than the closed-loop gain</code></pre>
<p>In the worked example, GBW = 1000000 Hz, config = non-inverting, Rf = 90000 ohm, R1 = 10000 ohm go through the equation above and give G0 = 10, noise_gain = 10, f_3dB = 100000 Hz. It applies only when single-pole op-amp with open-loop gain much larger than the closed-loop gain: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_inverting_amplifier_finite_gain">Inverting amplifier with finite open-loop gain — <code>elx_inverting_amplifier_finite_gain</code></h4>
<p>The exact closed-loop gain of an inverting amplifier built with an op-amp of finite open-loop gain A0, its relative gain error and output.</p>
<div class="math">\[G = \frac{-R_f/R_1}{1 + \dfrac{1 + R_f/R_1}{A_0}}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Rf</code></td><td>in</td><td>feedback resistor</td><td>ohm</td></tr><tr><td><code>R1</code></td><td>in</td><td>input resistor</td><td>ohm</td></tr><tr><td><code>A0</code></td><td>in</td><td>open-loop voltage gain (a ratio, not dB)</td><td>—</td></tr><tr><td><code>Vin</code></td><td>in</td><td>input voltage</td><td>V</td></tr><tr><td><code>G</code></td><td>out</td><td>closed-loop gain</td><td>—</td></tr><tr><td><code>G_ideal</code></td><td>out</td><td>ideal gain -Rf/R1</td><td>—</td></tr><tr><td><code>Vout</code></td><td>out</td><td>output voltage</td><td>V</td></tr><tr><td><code>error</code></td><td>out</td><td>relative gain error 1 - G/G_ideal</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> A0 &gt; 0 (ratio); infinite input resistance, zero output resistance.</p>
<pre><code class="shell">$ electronics-engineering solve elx_inverting_amplifier_finite_gain &quot;Rf=100000 ohm&quot; &quot;R1=1000 ohm&quot; A0=10000 &quot;Vin=0.01 V&quot;
G = -99.000099
G_ideal = -100
Vout = -0.99000099 V
error = 0.009999009999
  by: Inverting amplifier with finite open-loop gain  (G = -(Rf/R1)/(1 + (1 + Rf/R1)/A0))
  Rf = 100000 ohm
  R1 = 1000 ohm
  A0 = 10000
  Vin = 0.01 V
  assumes: A0 &gt; 0 (ratio); infinite input resistance, zero output resistance</code></pre>
<p>In the worked example, Rf = 100000 ohm, R1 = 1000 ohm, A0 = 10000, Vin = 0.01 V go through the equation above and give G = -99.000099, G_ideal = -100, Vout = -0.99000099 V, error = 0.009999009999. It applies only when A0 &gt; 0 (ratio); infinite input resistance, zero output resistance: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_inverting_amplifier">Inverting op-amp amplifier — <code>elx_inverting_amplifier</code></h4>
<p>The closed-loop gain, output voltage and input resistance of an ideal inverting amplifier.</p>
<div class="math">\[V_{out} = -\frac{R_f}{R_{in}}V_{in}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Rf</code></td><td>in</td><td>feedback resistor</td><td>ohm</td></tr><tr><td><code>Rin</code></td><td>in</td><td>input resistor</td><td>ohm</td></tr><tr><td><code>Vin</code></td><td>in</td><td>input voltage</td><td>V</td></tr><tr><td><code>G</code></td><td>out</td><td>closed-loop gain -Rf/Rin</td><td>—</td></tr><tr><td><code>Vout</code></td><td>out</td><td>output voltage</td><td>V</td></tr><tr><td><code>Zin</code></td><td>out</td><td>input resistance</td><td>ohm</td></tr></tbody></table>
<p><strong>Applies when:</strong> ideal op-amp, output not saturated.</p>
<pre><code class="shell">$ electronics-engineering solve elx_inverting_amplifier &quot;Rf=100000 ohm&quot; &quot;Rin=10000 ohm&quot; &quot;Vin=0.5 V&quot;
G = -10
Vout = -5 V
Zin = 10000 ohm
  by: Inverting op-amp amplifier  (G = -Rf/Rin; Vout = G Vin; Zin = Rin)
  Rf = 100000 ohm
  Rin = 10000 ohm
  Vin = 0.5 V
  assumes: ideal op-amp, output not saturated</code></pre>
<p>In the worked example, Rf = 100000 ohm, Rin = 10000 ohm, Vin = 0.5 V go through the equation above and give G = -10, Vout = -5 V, Zin = 10000 ohm. It applies only when ideal op-amp, output not saturated: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_schmitt_trigger">Inverting Schmitt trigger thresholds — <code>elx_schmitt_trigger</code></h4>
<p>The upper and lower switching thresholds, the hysteresis width and the centre of an inverting op-amp Schmitt trigger whose positive feedback divider (Rf from the output, R1 to a reference) sets the + input.</p>
<div class="math">\[V_{TH,TL} = \frac{V_{sat}R_1 + V_{ref}R_f}{R_1 + R_f}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Rf</code></td><td>in</td><td>resistor from the output to the + input</td><td>ohm</td></tr><tr><td><code>R1</code></td><td>in</td><td>resistor from the + input to Vref</td><td>ohm</td></tr><tr><td><code>VsatH</code></td><td>in</td><td>high output saturation voltage</td><td>V</td></tr><tr><td><code>VsatL</code></td><td>in</td><td>low output saturation voltage (negative for a split supply)</td><td>V</td></tr><tr><td><code>Vref</code></td><td>in</td><td>reference voltage (0 V for ground)</td><td>V</td></tr><tr><td><code>V_TH</code></td><td>out</td><td>upper threshold</td><td>V</td></tr><tr><td><code>V_TL</code></td><td>out</td><td>lower threshold</td><td>V</td></tr><tr><td><code>hysteresis</code></td><td>out</td><td>hysteresis width</td><td>V</td></tr><tr><td><code>center</code></td><td>out</td><td>centre of the hysteresis band</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> VsatH &gt; VsatL; input on the inverting terminal.</p>
<pre><code class="shell">$ electronics-engineering solve elx_schmitt_trigger &quot;Rf=90000 ohm&quot; &quot;R1=10000 ohm&quot; &quot;VsatH=12 V&quot; &quot;VsatL=-12 V&quot; &quot;Vref=0 V&quot;
V_TH = 1.2 V
V_TL = -1.2 V
hysteresis = 2.4 V
center = 0 V
  by: Inverting Schmitt trigger thresholds  (V_T = (Vsat R1 + Vref Rf)/(R1 + Rf); hysteresis = (VsatH - VsatL) R1/(R1 + Rf))
  Rf = 90000 ohm
  R1 = 10000 ohm
  VsatH = 12 V
  VsatL = -12 V
  Vref = 0 V
  assumes: VsatH &gt; VsatL; input on the inverting terminal</code></pre>
<p>In the worked example, Rf = 90000 ohm, R1 = 10000 ohm, VsatH = 12 V, VsatL = -12 V, Vref = 0 V go through the equation above and give V_TH = 1.2 V, V_TL = -1.2 V, hysteresis = 2.4 V, center = 0 V. It applies only when VsatH &gt; VsatL; input on the inverting terminal: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_summing_amplifier">Inverting summing amplifier — <code>elx_summing_amplifier</code></h4>
<p>The output of an ideal inverting summing amplifier with several inputs, each through its own resistor, and the feedback current.</p>
<div class="math">\[V_{out} = -R_f\sum_i\frac{V_i}{R_i}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>V</code></td><td>in</td><td>input voltages in volts</td><td>—</td></tr><tr><td><code>R</code></td><td>in</td><td>input resistors in kilohms, one per input</td><td>—</td></tr><tr><td><code>Rf</code></td><td>in</td><td>feedback resistor</td><td>ohm</td></tr><tr><td><code>Vout</code></td><td>out</td><td>output voltage</td><td>V</td></tr><tr><td><code>I_f</code></td><td>out</td><td>current through the feedback resistor</td><td>A</td></tr></tbody></table>
<p><strong>Applies when:</strong> one resistor per input; ideal op-amp.</p>
<pre><code class="shell">$ electronics-engineering solve elx_summing_amplifier &quot;V=[1, 2, -0.5]&quot; &quot;R=[10, 20, 5]&quot; &quot;Rf=10000 ohm&quot;
Vout = -1 V
I_f = 0.0001 A
  by: Inverting summing amplifier  (Vout = -Rf sum(Vi/Ri))
  Rf = 10000 ohm
  assumes: one resistor per input; ideal op-amp</code></pre>
<p>In the worked example, V = [1, 2, -0.5], R = [10, 20, 5], Rf = 10000 ohm go through the equation above and give Vout = -1 V, I_f = 0.0001 A. It applies only when one resistor per input; ideal op-amp: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_negative_feedback">Negative feedback: closed-loop gain and bandwidth extension — <code>elx_negative_feedback</code></h4>
<p>The closed-loop gain A/(1 + A beta), the loop gain, the desensitivity factor (also in dB) and the extended bandwidth of a single-pole amplifier with negative feedback.</p>
<div class="math">\[A_f = \frac{A}{1 + A\beta},\quad f_{H,f} = f_H(1 + A\beta)\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>A</code></td><td>in</td><td>open-loop gain (a ratio)</td><td>—</td></tr><tr><td><code>beta</code></td><td>in</td><td>feedback factor (a ratio)</td><td>—</td></tr><tr><td><code>fH</code></td><td>in</td><td>open-loop -3 dB bandwidth</td><td>Hz</td></tr><tr><td><code>Af</code></td><td>out</td><td>closed-loop gain</td><td>—</td></tr><tr><td><code>loop_gain</code></td><td>out</td><td>loop gain A beta</td><td>—</td></tr><tr><td><code>desensitivity</code></td><td>out</td><td>1 + A beta</td><td>—</td></tr><tr><td><code>desensitivity_dB</code></td><td>out</td><td>amount of feedback in dB</td><td>—</td></tr><tr><td><code>fH_closed</code></td><td>out</td><td>closed-loop bandwidth</td><td>Hz</td></tr></tbody></table>
<p><strong>Applies when:</strong> single-pole open-loop response; frequency-independent beta.</p>
<pre><code class="shell">$ electronics-engineering solve elx_negative_feedback A=10000 beta=0.01 &quot;fH=1000 Hz&quot;
Af = 99.00990099
loop_gain = 100
desensitivity = 101
desensitivity_dB = 40.08642748
fH_closed = 101000 Hz
  by: Negative feedback: closed-loop gain and bandwidth extension  (Af = A/(1 + A beta); fH,f = fH (1 + A beta))
  A = 10000
  beta = 0.01
  fH = 1000 Hz
  assumes: single-pole open-loop response; frequency-independent beta</code></pre>
<p>In the worked example, A = 10000, beta = 0.01, fH = 1000 Hz go through the equation above and give Af = 99.00990099, loop_gain = 100, desensitivity = 101, desensitivity_dB = 40.08642748. It applies only when single-pole open-loop response; frequency-independent beta: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_noninverting_amplifier">Non-inverting op-amp amplifier — <code>elx_noninverting_amplifier</code></h4>
<p>The closed-loop gain 1 + Rf/Rg and the output voltage of an ideal non-inverting amplifier.</p>
<div class="math">\[V_{out} = \left(1 + \frac{R_f}{R_g}\right)V_{in}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Rf</code></td><td>in</td><td>feedback resistor</td><td>ohm</td></tr><tr><td><code>Rg</code></td><td>in</td><td>resistor from the inverting input to ground</td><td>ohm</td></tr><tr><td><code>Vin</code></td><td>in</td><td>input voltage</td><td>V</td></tr><tr><td><code>G</code></td><td>out</td><td>closed-loop gain</td><td>—</td></tr><tr><td><code>Vout</code></td><td>out</td><td>output voltage</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> ideal op-amp.</p>
<pre><code class="shell">$ electronics-engineering solve elx_noninverting_amplifier &quot;Rf=90000 ohm&quot; &quot;Rg=10000 ohm&quot; &quot;Vin=0.3 V&quot;
G = 10
Vout = 3 V
  by: Non-inverting op-amp amplifier  (G = 1 + Rf/Rg; Vout = G Vin)
  Rf = 90000 ohm
  Rg = 10000 ohm
  Vin = 0.3 V
  assumes: ideal op-amp</code></pre>
<p>In the worked example, Rf = 90000 ohm, Rg = 10000 ohm, Vin = 0.3 V go through the equation above and give G = 10, Vout = 3 V. It applies only when ideal op-amp: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_difference_amplifier">Op-amp difference amplifier (with resistor mismatch) — <code>elx_difference_amplifier</code></h4>
<p>The output of a one-op-amp difference amplifier with any four resistors, and its differential and common-mode gains (the common-mode gain is zero only when R4/R3 = R2/R1).</p>
<div class="math">\[V_{out} = \frac{R_4}{R_3+R_4}\left(1+\frac{R_2}{R_1}\right)V_2 - \frac{R_2}{R_1}V_1\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R1</code></td><td>in</td><td>resistor from V1 to the inverting input</td><td>ohm</td></tr><tr><td><code>R2</code></td><td>in</td><td>feedback resistor</td><td>ohm</td></tr><tr><td><code>R3</code></td><td>in</td><td>resistor from V2 to the non-inverting input</td><td>ohm</td></tr><tr><td><code>R4</code></td><td>in</td><td>resistor from the non-inverting input to ground</td><td>ohm</td></tr><tr><td><code>V1</code></td><td>in</td><td>voltage at the inverting side</td><td>V</td></tr><tr><td><code>V2</code></td><td>in</td><td>voltage at the non-inverting side</td><td>V</td></tr><tr><td><code>Vout</code></td><td>out</td><td>output voltage</td><td>V</td></tr><tr><td><code>Ad</code></td><td>out</td><td>differential gain (per volt of V2 - V1)</td><td>—</td></tr><tr><td><code>Acm</code></td><td>out</td><td>common-mode gain</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> ideal op-amp.</p>
<pre><code class="shell">$ electronics-engineering solve elx_difference_amplifier &quot;R1=10000 ohm&quot; &quot;R2=100000 ohm&quot; &quot;R3=10000 ohm&quot; &quot;R4=100000 ohm&quot; &quot;V1=1 V&quot; &quot;V2=1.2 V&quot;
Vout = 2 V
Ad = 10
Acm = 0
  by: Op-amp difference amplifier (with resistor mismatch)  (Vout = -(R2/R1) V1 + (R4/(R3 + R4))(1 + R2/R1) V2; Ad = (a2 - a1)/2; Acm = a1 + a2)
  R1 = 10000 ohm
  R2 = 100000 ohm
  R3 = 10000 ohm
  R4 = 100000 ohm
  V1 = 1 V
  V2 = 1.2 V
  assumes: ideal op-amp</code></pre>
<p>In the worked example, R1 = 10000 ohm, R2 = 100000 ohm, R3 = 10000 ohm, R4 = 100000 ohm, V1 = 1 V, V2 = 1.2 V go through the equation above and give Vout = 2 V, Ad = 10, Acm = 0. It applies only when ideal op-amp: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_opamp_differentiator">Op-amp differentiator: gain and output amplitude — <code>elx_opamp_differentiator</code></h4>
<p>The gain |H| = 2 pi f R C of an ideal inverting differentiator at a frequency and the peak output for a sinusoidal input of given amplitude.</p>
<div class="math">\[|H(j\omega)| = \omega RC\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R</code></td><td>in</td><td>feedback resistor</td><td>ohm</td></tr><tr><td><code>C</code></td><td>in</td><td>input capacitor</td><td>F</td></tr><tr><td><code>A</code></td><td>in</td><td>peak input amplitude</td><td>V</td></tr><tr><td><code>f</code></td><td>in</td><td>input frequency</td><td>Hz</td></tr><tr><td><code>gain</code></td><td>out</td><td>gain magnitude</td><td>—</td></tr><tr><td><code>Vout_peak</code></td><td>out</td><td>peak output voltage</td><td>V</td></tr><tr><td><code>gain_dB</code></td><td>out</td><td>gain in dB</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> ideal op-amp (no high-frequency limiting).</p>
<pre><code class="shell">$ electronics-engineering solve elx_opamp_differentiator &quot;R=10000 ohm&quot; &quot;C=10 nF&quot; &quot;A=1 V&quot; &quot;f=1000 Hz&quot;
gain = 0.6283185307
Vout_peak = 0.6283185307 V
gain_dB = -4.036402633
  by: Op-amp differentiator: gain and output amplitude  (|H| = 2 pi f R C; Vout,peak = |H| A)
  R = 10000 ohm
  C = 1e-08 F
  A = 1 V
  f = 1000 Hz
  assumes: ideal op-amp (no high-frequency limiting)</code></pre>
<p>In the worked example, R = 10000 ohm, C = 10 nF, A = 1 V, f = 1000 Hz go through the equation above and give gain = 0.6283185307, Vout_peak = 0.6283185307 V, gain_dB = -4.036402633. It applies only when ideal op-amp (no high-frequency limiting): outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_opamp_integrator">Op-amp integrator: output ramp and unity-gain frequency — <code>elx_opamp_integrator</code></h4>
<p>The output of an ideal inverting integrator after a time with a constant input, its ramp rate, and the frequency at which its gain is one.</p>
<div class="math">\[V_{out}(t) = V_0 - \frac{1}{RC}\int_0^t V_{in}\,dt\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R</code></td><td>in</td><td>input resistor</td><td>ohm</td></tr><tr><td><code>C</code></td><td>in</td><td>feedback capacitor</td><td>F</td></tr><tr><td><code>Vin</code></td><td>in</td><td>constant input voltage</td><td>V</td></tr><tr><td><code>t</code></td><td>in</td><td>time since the start</td><td>s</td></tr><tr><td><code>V0</code></td><td>in</td><td>initial output voltage (default 0) (optional)</td><td>V</td></tr><tr><td><code>Vout</code></td><td>out</td><td>output voltage at t</td><td>V</td></tr><tr><td><code>slope</code></td><td>out</td><td>output ramp rate</td><td>V/s</td></tr><tr><td><code>f_unity</code></td><td>out</td><td>unity-gain frequency 1/(2 pi R C)</td><td>Hz</td></tr></tbody></table>
<p><strong>Applies when:</strong> ideal op-amp, output not saturated.</p>
<pre><code class="shell">$ electronics-engineering solve elx_opamp_integrator &quot;R=10000 ohm&quot; &quot;C=1 uF&quot; &quot;Vin=0.5 V&quot; &quot;t=2 ms&quot;
Vout = -0.1 V
slope = -50 V/s
f_unity = 15.91549431 Hz
  by: Op-amp integrator: output ramp and unity-gain frequency  (Vout = V0 - Vin t/(R C); f = 1/(2 pi R C))
  R = 10000 ohm
  C = 1e-06 F
  Vin = 0.5 V
  t = 0.002 s
  assumes: ideal op-amp, output not saturated</code></pre>
<p>In the worked example, R = 10000 ohm, C = 1 uF, Vin = 0.5 V, t = 2 ms go through the equation above and give Vout = -0.1 V, slope = -50 V/s, f_unity = 15.91549431 Hz. It applies only when ideal op-amp, output not saturated: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_opamp_dc_offset">Op-amp output offset from input offset voltage and bias currents — <code>elx_opamp_dc_offset</code></h4>
<p>The DC output error of an inverting or non-inverting amplifier (input grounded) caused by the input offset voltage and the input bias and offset currents, and the compensating resistor that cancels the bias-current error.</p>
<div class="math">\[V_{out} = \left(V_{os} - I_{B+}R_p\right)\left(1 + \frac{R_f}{R_1}\right) + I_{B-}R_f\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Vos</code></td><td>in</td><td>input offset voltage (in series with the + input)</td><td>V</td></tr><tr><td><code>IB</code></td><td>in</td><td>average input bias current</td><td>A</td></tr><tr><td><code>Ios</code></td><td>in</td><td>input offset current IB- minus IB+</td><td>A</td></tr><tr><td><code>Rf</code></td><td>in</td><td>feedback resistor</td><td>ohm</td></tr><tr><td><code>R1</code></td><td>in</td><td>resistor from the inverting input to ground</td><td>ohm</td></tr><tr><td><code>Rp</code></td><td>in</td><td>resistor from the + input to ground (0 if none)</td><td>ohm</td></tr><tr><td><code>Vout_Vos</code></td><td>out</td><td>output error from Vos</td><td>V</td></tr><tr><td><code>Vout_bias</code></td><td>out</td><td>output error from the bias currents</td><td>V</td></tr><tr><td><code>Vout_total</code></td><td>out</td><td>total output error</td><td>V</td></tr><tr><td><code>Rp_optimal</code></td><td>out</td><td>bias-cancelling Rp = R1 || Rf</td><td>ohm</td></tr></tbody></table>
<p><strong>Applies when:</strong> currents flow into the inputs; IB- = IB + Ios/2, IB+ = IB - Ios/2.</p>
<pre><code class="shell">$ electronics-engineering solve elx_opamp_dc_offset &quot;Vos=2 mV&quot; &quot;IB=100 nA&quot; &quot;Ios=10 nA&quot; &quot;Rf=100000 ohm&quot; &quot;R1=10000 ohm&quot; &quot;Rp=0 ohm&quot;
Vout_Vos = 0.022 V
Vout_bias = 0.0105 V
Vout_total = 0.0325 V
Rp_optimal = 9090.909091 ohm
  by: Op-amp output offset from input offset voltage and bias currents  (Vout = Vos (1 + Rf/R1) + IB- Rf - IB+ Rp (1 + Rf/R1))
  Vos = 0.002 V
  IB = 1e-07 A
  Ios = 1e-08 A
  Rf = 100000 ohm
  R1 = 10000 ohm
  Rp = 0 ohm
  assumes: currents flow into the inputs; IB- = IB + Ios/2, IB+ = IB - Ios/2</code></pre>
<p>In the worked example, Vos = 2 mV, IB = 100 nA, Ios = 10 nA, Rf = 100000 ohm, R1 = 10000 ohm, Rp = 0 ohm go through the equation above and give Vout_Vos = 0.022 V, Vout_bias = 0.0105 V, Vout_total = 0.0325 V, Rp_optimal = 9090.909091 ohm. It applies only when currents flow into the inputs; IB- = IB + Ios/2, IB+ = IB - Ios/2: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_two_pole_phase_margin">Phase margin of a two-pole amplifier with feedback — <code>elx_two_pole_phase_margin</code></h4>
<p>The loop-gain crossover frequency and the phase margin of an amplifier with two real poles and a frequency-independent feedback factor, and its closed-loop DC gain.</p>
<div class="math">\[PM = 180^\circ - \arctan\frac{f_c}{f_1} - \arctan\frac{f_c}{f_2}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>A0</code></td><td>in</td><td>DC open-loop gain (a ratio)</td><td>—</td></tr><tr><td><code>f1</code></td><td>in</td><td>first pole frequency</td><td>Hz</td></tr><tr><td><code>f2</code></td><td>in</td><td>second pole frequency</td><td>Hz</td></tr><tr><td><code>beta</code></td><td>in</td><td>feedback factor</td><td>—</td></tr><tr><td><code>f_c</code></td><td>out</td><td>loop-gain crossover frequency</td><td>Hz</td></tr><tr><td><code>PM_deg</code></td><td>out</td><td>phase margin in degrees</td><td>—</td></tr><tr><td><code>Af</code></td><td>out</td><td>closed-loop DC gain</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> A0 beta &gt; 1; two real left-half-plane poles.</p>
<pre><code class="shell">$ electronics-engineering solve elx_two_pole_phase_margin A0=100000 &quot;f1=10 Hz&quot; &quot;f2=1000000 Hz&quot; beta=0.1
f_c = 99508.54868 Hz
PM_deg = 84.32304539
Af = 9.9990001
  by: Phase margin of a two-pole amplifier with feedback  (|A0 beta|^2 = (1 + (fc/f1)^2)(1 + (fc/f2)^2) solved for fc^2; PM = 180 - atan(fc/f1) - atan(fc/f2))
  A0 = 100000
  f1 = 10 Hz
  f2 = 1000000 Hz
  beta = 0.1
  assumes: A0 beta &gt; 1; two real left-half-plane poles</code></pre>
<p>In the worked example, A0 = 100000, f1 = 10 Hz, f2 = 1000000 Hz, beta = 0.1 go through the equation above and give f_c = 99508.54868 Hz, PM_deg = 84.32304539, Af = 9.9990001. It applies only when A0 beta &gt; 1; two real left-half-plane poles: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_slew_rate_limit">Slew-rate limit: full-power bandwidth — <code>elx_slew_rate_limit</code></h4>
<p>The full-power bandwidth SR/(2 pi Vp) of an op-amp, the largest undistorted amplitude at a frequency, the slope a sine wave needs and whether it is slew-limited.</p>
<div class="math">\[f_{max} = \frac{SR}{2\pi V_p}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>SR</code></td><td>in</td><td>slew rate</td><td>V/s</td></tr><tr><td><code>Vp</code></td><td>in</td><td>peak output amplitude</td><td>V</td></tr><tr><td><code>f</code></td><td>in</td><td>signal frequency</td><td>Hz</td></tr><tr><td><code>f_max</code></td><td>out</td><td>full-power bandwidth at Vp</td><td>Hz</td></tr><tr><td><code>Vp_max</code></td><td>out</td><td>largest undistorted amplitude at f</td><td>V</td></tr><tr><td><code>slope_needed</code></td><td>out</td><td>maximum slope of the sine, 2 pi f Vp</td><td>V/s</td></tr><tr><td><code>limited</code></td><td>out</td><td>slew-limited or not slew-limited</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> sinusoidal output.</p>
<pre><code class="shell">$ electronics-engineering solve elx_slew_rate_limit &quot;SR=0.5 V/us&quot; &quot;Vp=10 V&quot; &quot;f=20000 Hz&quot;
f_max = 7957.747155 Hz
Vp_max = 3.978873577 V
slope_needed = 1256637.061 V/s
limited = slew-limited
  by: Slew-rate limit: full-power bandwidth  (f_max = SR/(2 pi Vp); Vp,max = SR/(2 pi f); slope = 2 pi f Vp)
  SR = 500000 V/s
  Vp = 10 V
  f = 20000 Hz
  assumes: sinusoidal output</code></pre>
<p>In the worked example, SR = 0.5 V/us, Vp = 10 V, f = 20000 Hz go through the equation above and give f_max = 7957.747155 Hz, Vp_max = 3.978873577 V, slope_needed = 1256637.061 V/s, limited = slew-limited. It applies only when sinusoidal output: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_instrumentation_amplifier">Three-op-amp instrumentation amplifier — <code>elx_instrumentation_amplifier</code></h4>
<p>The gain and output of the classic three-op-amp instrumentation amplifier: input stage gain 1 + 2 R1/RG times the difference stage gain R3/R2.</p>
<div class="math">\[V_{out} = \left(1 + \frac{2R_1}{R_G}\right)\frac{R_3}{R_2}(V_2 - V_1)\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R1</code></td><td>in</td><td>feedback resistor of each input buffer</td><td>ohm</td></tr><tr><td><code>RG</code></td><td>in</td><td>gain-setting resistor between the buffers</td><td>ohm</td></tr><tr><td><code>R2</code></td><td>in</td><td>input resistors of the difference stage</td><td>ohm</td></tr><tr><td><code>R3</code></td><td>in</td><td>feedback and ground resistors of the difference stage</td><td>ohm</td></tr><tr><td><code>V1</code></td><td>in</td><td>input at the inverting side</td><td>V</td></tr><tr><td><code>V2</code></td><td>in</td><td>input at the non-inverting side</td><td>V</td></tr><tr><td><code>G</code></td><td>out</td><td>differential gain</td><td>—</td></tr><tr><td><code>G_stage1</code></td><td>out</td><td>gain of the input stage</td><td>—</td></tr><tr><td><code>Vout</code></td><td>out</td><td>output voltage</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> ideal op-amps, matched resistors.</p>
<pre><code class="shell">$ electronics-engineering solve elx_instrumentation_amplifier &quot;R1=25000 ohm&quot; &quot;RG=1000 ohm&quot; &quot;R2=10000 ohm&quot; &quot;R3=10000 ohm&quot; &quot;V1=1 V&quot; &quot;V2=1.01 V&quot;
G = 51
G_stage1 = 51
Vout = 0.51 V
  by: Three-op-amp instrumentation amplifier  (G = (1 + 2 R1/RG)(R3/R2); Vout = G (V2 - V1))
  R1 = 25000 ohm
  RG = 1000 ohm
  R2 = 10000 ohm
  R3 = 10000 ohm
  V1 = 1 V
  V2 = 1.01 V
  assumes: ideal op-amps, matched resistors</code></pre>
<p>In the worked example, R1 = 25000 ohm, RG = 1000 ohm, R2 = 10000 ohm, R3 = 10000 ohm, V1 = 1 V, V2 = 1.01 V go through the equation above and give G = 51, G_stage1 = 51, Vout = 0.51 V. It applies only when ideal op-amps, matched resistors: outside that it says what is wrong instead of returning a number.</p>
<h3>Oscillators (9)</h3>
<h4 id="elx_555_astable">555 timer astable: frequency and duty cycle — <code>elx_555_astable</code></h4>
<p>The high and low times, period, frequency and duty cycle of a 555 timer in astable mode with resistors RA and RB and timing capacitor C.</p>
<div class="math">\[t_H = \ln 2\,(R_A + R_B)C,\quad t_L = \ln 2\,R_BC,\quad f = \frac{1}{\ln 2\,(R_A + 2R_B)C}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>RA</code></td><td>in</td><td>resistor from Vcc to the discharge pin</td><td>ohm</td></tr><tr><td><code>RB</code></td><td>in</td><td>resistor from discharge to threshold/trigger</td><td>ohm</td></tr><tr><td><code>C</code></td><td>in</td><td>timing capacitor</td><td>F</td></tr><tr><td><code>t_high</code></td><td>out</td><td>output high time</td><td>s</td></tr><tr><td><code>t_low</code></td><td>out</td><td>output low time</td><td>s</td></tr><tr><td><code>T</code></td><td>out</td><td>period</td><td>s</td></tr><tr><td><code>f</code></td><td>out</td><td>frequency</td><td>Hz</td></tr><tr><td><code>duty</code></td><td>out</td><td>duty cycle (fraction high)</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> thresholds Vcc/3 and 2Vcc/3.</p>
<pre><code class="shell">$ electronics-engineering solve elx_555_astable &quot;RA=1000 ohm&quot; &quot;RB=10000 ohm&quot; &quot;C=10 uF&quot;
t_high = 0.07624618986 s
t_low = 0.06931471806 s
T = 0.1455609079 s
f = 6.869976385 Hz
duty = 0.5238095238
  by: 555 timer astable: frequency and duty cycle  (t_H = ln2 (RA + RB) C; t_L = ln2 RB C; f = 1/(t_H + t_L))
  RA = 1000 ohm
  RB = 10000 ohm
  C = 1e-05 F
  assumes: thresholds Vcc/3 and 2Vcc/3</code></pre>
<p>In the worked example, RA = 1000 ohm, RB = 10000 ohm, C = 10 uF go through the equation above and give t_high = 0.07624618986 s, t_low = 0.06931471806 s, T = 0.1455609079 s, f = 6.869976385 Hz. It applies only when thresholds Vcc/3 and 2Vcc/3: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_555_monostable">555 timer monostable pulse width — <code>elx_555_monostable</code></h4>
<p>The output pulse width T = ln 3 R C (about 1.1 R C) of a 555 timer in monostable (one-shot) mode.</p>
<div class="math">\[T = \ln 3\,RC \approx 1.1\,RC\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R</code></td><td>in</td><td>timing resistor</td><td>ohm</td></tr><tr><td><code>C</code></td><td>in</td><td>timing capacitor</td><td>F</td></tr><tr><td><code>T</code></td><td>out</td><td>pulse width</td><td>s</td></tr></tbody></table>
<p><strong>Applies when:</strong> threshold at 2Vcc/3; trigger pulse shorter than T.</p>
<pre><code class="shell">$ electronics-engineering solve elx_555_monostable &quot;R=100000 ohm&quot; &quot;C=10 uF&quot;
T = 1.098612289 s
  by: 555 timer monostable pulse width  (T = ln 3 R C)
  R = 100000 ohm
  C = 1e-05 F
  assumes: threshold at 2Vcc/3; trigger pulse shorter than T</code></pre>
<p>In the worked example, R = 100000 ohm, C = 10 uF go through the equation above and give T = 1.098612289 s. It applies only when threshold at 2Vcc/3; trigger pulse shorter than T: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_colpitts_oscillator">Colpitts oscillator frequency and feedback ratio — <code>elx_colpitts_oscillator</code></h4>
<p>The oscillation frequency of a Colpitts oscillator from its inductor and the series combination of its two tank capacitors, the feedback fraction C1/C2 and the minimum amplifier gain C2/C1.</p>
<div class="math">\[f_0 = \frac{1}{2\pi\sqrt{L\,\frac{C_1C_2}{C_1+C_2}}},\quad A_{min} = \frac{C_2}{C_1}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>L</code></td><td>in</td><td>tank inductance</td><td>H</td></tr><tr><td><code>C1</code></td><td>in</td><td>capacitor across the amplifier output</td><td>F</td></tr><tr><td><code>C2</code></td><td>in</td><td>capacitor across the amplifier input (feedback side)</td><td>F</td></tr><tr><td><code>C_eq</code></td><td>out</td><td>series equivalent capacitance</td><td>F</td></tr><tr><td><code>f0</code></td><td>out</td><td>oscillation frequency</td><td>Hz</td></tr><tr><td><code>beta</code></td><td>out</td><td>feedback fraction C1/C2</td><td>—</td></tr><tr><td><code>A_min</code></td><td>out</td><td>minimum amplifier gain C2/C1</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> lossless tank, amplifier does not load the tank.</p>
<pre><code class="shell">$ electronics-engineering solve elx_colpitts_oscillator &quot;L=100 uH&quot; &quot;C1=1 nF&quot; &quot;C2=10 nF&quot;
C_eq = 9.090909091e-10 F
f0 = 527857.2298 Hz
beta = 0.1
A_min = 10
  by: Colpitts oscillator frequency and feedback ratio  (C_eq = C1 C2/(C1 + C2); f0 = 1/(2 pi sqrt(L C_eq)); beta = C1/C2)
  L = 0.0001 H
  C1 = 1e-09 F
  C2 = 1e-08 F
  assumes: lossless tank, amplifier does not load the tank</code></pre>
<p>In the worked example, L = 100 uH, C1 = 1 nF, C2 = 10 nF go through the equation above and give C_eq = 9.090909091e-10 F, f0 = 527857.2298 Hz, beta = 0.1, A_min = 10. It applies only when lossless tank, amplifier does not load the tank: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_hartley_oscillator">Hartley oscillator frequency — <code>elx_hartley_oscillator</code></h4>
<p>The oscillation frequency of a Hartley oscillator with a tapped (or two coupled) inductors and a tank capacitor, and the gain ratio (L1 + M)/(L2 + M).</p>
<div class="math">\[f_0 = \frac{1}{2\pi\sqrt{(L_1 + L_2 + 2M)C}}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>L1</code></td><td>in</td><td>inductance of the output-side coil</td><td>H</td></tr><tr><td><code>L2</code></td><td>in</td><td>inductance of the feedback-side coil</td><td>H</td></tr><tr><td><code>M</code></td><td>in</td><td>mutual inductance (0 for uncoupled coils)</td><td>H</td></tr><tr><td><code>C</code></td><td>in</td><td>tank capacitance</td><td>F</td></tr><tr><td><code>L_eq</code></td><td>out</td><td>total inductance L1 + L2 + 2M</td><td>H</td></tr><tr><td><code>f0</code></td><td>out</td><td>oscillation frequency</td><td>Hz</td></tr><tr><td><code>A_min</code></td><td>out</td><td>minimum amplifier gain (L1 + M)/(L2 + M)</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> series-aiding coils, lossless tank; M &lt;= sqrt(L1 L2).</p>
<pre><code class="shell">$ electronics-engineering solve elx_hartley_oscillator &quot;L1=100 uH&quot; &quot;L2=20 uH&quot; &quot;M=0 uH&quot; &quot;C=1 nF&quot;
L_eq = 0.00012 H
f0 = 459440.7462 Hz
A_min = 5
  by: Hartley oscillator frequency  (L_eq = L1 + L2 + 2M; f0 = 1/(2 pi sqrt(L_eq C)))
  L1 = 0.0001 H
  L2 = 2e-05 H
  M = 0 H
  C = 1e-09 F
  assumes: series-aiding coils, lossless tank; M &lt;= sqrt(L1 L2)</code></pre>
<p>In the worked example, L1 = 100 uH, L2 = 20 uH, M = 0 uH, C = 1 nF go through the equation above and give L_eq = 0.00012 H, f0 = 459440.7462 Hz, A_min = 5. It applies only when series-aiding coils, lossless tank; M &lt;= sqrt(L1 L2): outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_opamp_relaxation_oscillator">Op-amp relaxation (astable) oscillator — <code>elx_opamp_relaxation_oscillator</code></h4>
<p>The period and frequency of a square-wave op-amp astable: an RC timing network on the inverting input and positive feedback R1/(R1 + R2) to the non-inverting input, symmetric supplies.</p>
<div class="math">\[T = 2RC\ln\frac{1+\beta}{1-\beta},\quad \beta = \frac{R_1}{R_1+R_2}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R</code></td><td>in</td><td>timing resistor (output to inverting input)</td><td>ohm</td></tr><tr><td><code>C</code></td><td>in</td><td>timing capacitor</td><td>F</td></tr><tr><td><code>R1</code></td><td>in</td><td>resistor from the + input to ground</td><td>ohm</td></tr><tr><td><code>R2</code></td><td>in</td><td>resistor from the output to the + input</td><td>ohm</td></tr><tr><td><code>beta</code></td><td>out</td><td>feedback fraction R1/(R1 + R2)</td><td>—</td></tr><tr><td><code>T</code></td><td>out</td><td>period</td><td>s</td></tr><tr><td><code>f</code></td><td>out</td><td>frequency</td><td>Hz</td></tr></tbody></table>
<p><strong>Applies when:</strong> symmetric output levels; ideal comparator action.</p>
<pre><code class="shell">$ electronics-engineering solve elx_opamp_relaxation_oscillator &quot;R=10000 ohm&quot; &quot;C=100 nF&quot; &quot;R1=10000 ohm&quot; &quot;R2=10000 ohm&quot;
beta = 0.5
T = 0.002197224577 s
f = 455.1196133 Hz
  by: Op-amp relaxation (astable) oscillator  (T = 2 R C ln((1 + beta)/(1 - beta)) = 2 R C ln(1 + 2 R1/R2))
  R = 10000 ohm
  C = 1e-07 F
  R1 = 10000 ohm
  R2 = 10000 ohm
  assumes: symmetric output levels; ideal comparator action</code></pre>
<p>In the worked example, R = 10000 ohm, C = 100 nF, R1 = 10000 ohm, R2 = 10000 ohm go through the equation above and give beta = 0.5, T = 0.002197224577 s, f = 455.1196133 Hz. It applies only when symmetric output levels; ideal comparator action: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_crystal_oscillator">Quartz crystal: series and parallel resonance, Q — <code>elx_crystal_oscillator</code></h4>
<p>The series and parallel (anti-) resonant frequencies, their spacing and the quality factor of a quartz crystal from its Butterworth-Van Dyke equivalent circuit.</p>
<div class="math">\[f_s = \frac{1}{2\pi\sqrt{L_mC_m}},\quad f_p = f_s\sqrt{1 + \frac{C_m}{C_0}}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Lm</code></td><td>in</td><td>motional inductance</td><td>H</td></tr><tr><td><code>Cm</code></td><td>in</td><td>motional capacitance</td><td>F</td></tr><tr><td><code>Rm</code></td><td>in</td><td>motional resistance</td><td>ohm</td></tr><tr><td><code>C0</code></td><td>in</td><td>shunt (holder) capacitance</td><td>F</td></tr><tr><td><code>fs</code></td><td>out</td><td>series resonance</td><td>Hz</td></tr><tr><td><code>fp</code></td><td>out</td><td>parallel resonance</td><td>Hz</td></tr><tr><td><code>delta_f</code></td><td>out</td><td>fp - fs</td><td>Hz</td></tr><tr><td><code>Q</code></td><td>out</td><td>quality factor</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> resonances of the lossless circuit; Q from Rm.</p>
<pre><code class="shell">$ electronics-engineering solve elx_crystal_oscillator &quot;Lm=0.05 H&quot; &quot;Cm=20 fF&quot; &quot;Rm=20 ohm&quot; &quot;C0=5 pF&quot;
fs = 5032921.21 Hz
fp = 5042977.007 Hz
delta_f = 10055.79666 Hz
Q = 79056.9415
  by: Quartz crystal: series and parallel resonance, Q  (fs = 1/(2 pi sqrt(Lm Cm)); fp = fs sqrt(1 + Cm/C0); Q = sqrt(Lm/Cm)/Rm)
  Lm = 0.05 H
  Cm = 2e-14 F
  Rm = 20 ohm
  C0 = 5e-12 F
  assumes: resonances of the lossless circuit; Q from Rm</code></pre>
<p>In the worked example, Lm = 0.05 H, Cm = 20 fF, Rm = 20 ohm, C0 = 5 pF go through the equation above and give fs = 5032921.21 Hz, fp = 5042977.007 Hz, delta_f = 10055.79666 Hz, Q = 79056.9415. It applies only when resonances of the lossless circuit; Q from Rm: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_rc_phase_shift_oscillator">RC phase-shift oscillator frequency and gain — <code>elx_rc_phase_shift_oscillator</code></h4>
<p>The oscillation frequency of a three-section RC phase-shift oscillator (high-pass ladder: series C, shunt R; or low-pass ladder) and the amplifier gain of 29 it needs.</p>
<div class="math">\[f_0 = \frac{1}{2\pi\sqrt{6}\,RC},\quad |A| \ge 29\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R</code></td><td>in</td><td>resistor of each section</td><td>ohm</td></tr><tr><td><code>C</code></td><td>in</td><td>capacitor of each section</td><td>F</td></tr><tr><td><code>ladder</code></td><td>in</td><td>highpass (series C, shunt R) or lowpass (series R, shunt C)</td><td>—</td></tr><tr><td><code>f0</code></td><td>out</td><td>oscillation frequency</td><td>Hz</td></tr><tr><td><code>A_min</code></td><td>out</td><td>minimum inverting amplifier gain</td><td>—</td></tr><tr><td><code>beta</code></td><td>out</td><td>feedback network attenuation at f0</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> unloaded ladder (driven by a voltage source, feeding a high impedance).</p>
<pre><code class="shell">$ electronics-engineering solve elx_rc_phase_shift_oscillator &quot;R=10000 ohm&quot; &quot;C=10 nF&quot; ladder=high-pass
f0 = 649.7473344 Hz
A_min = 29
beta = 0.03448275862
  by: RC phase-shift oscillator frequency and gain  (high-pass ladder f = 1/(2 pi sqrt(6) R C); low-pass ladder f = sqrt(6)/(2 pi R C); |beta| = 1/29)
  R = 10000 ohm
  C = 1e-08 F
  ladder = high-pass
  assumes: unloaded ladder (driven by a voltage source, feeding a high impedance)</code></pre>
<p>In the worked example, R = 10000 ohm, C = 10 nF, ladder = high-pass go through the equation above and give f0 = 649.7473344 Hz, A_min = 29, beta = 0.03448275862. It applies only when unloaded ladder (driven by a voltage source, feeding a high impedance): outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_pll_loop_dynamics">Type-2 PLL with active PI loop filter: natural frequency and damping — <code>elx_pll_loop_dynamics</code></h4>
<p>The natural frequency and damping factor of a second-order (type-2) phase-locked loop with phase-detector gain Kd, VCO gain Ko and an active PI loop filter F(s) = (1 + s tau2)/(s tau1).</p>
<div class="math">\[\omega_n = \sqrt{\frac{K_dK_o}{\tau_1}},\quad \zeta = \frac{\tau_2\omega_n}{2}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Kd</code></td><td>in</td><td>phase-detector gain in V/rad</td><td>—</td></tr><tr><td><code>Ko</code></td><td>in</td><td>VCO gain in rad/(s V)</td><td>—</td></tr><tr><td><code>tau1</code></td><td>in</td><td>integrator time constant R1 C</td><td>s</td></tr><tr><td><code>tau2</code></td><td>in</td><td>zero time constant R2 C</td><td>s</td></tr><tr><td><code>wn</code></td><td>out</td><td>natural frequency</td><td>rad/s</td></tr><tr><td><code>fn</code></td><td>out</td><td>natural frequency in Hz</td><td>Hz</td></tr><tr><td><code>zeta</code></td><td>out</td><td>damping factor</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> linear phase model, ideal integrator.</p>
<pre><code class="shell">$ electronics-engineering solve elx_pll_loop_dynamics Kd=0.5 Ko=20000 &quot;tau1=10 ms&quot; &quot;tau2=1 ms&quot;
wn = 1000 rad/s
fn = 159.1549431 Hz
zeta = 0.5
  by: Type-2 PLL with active PI loop filter: natural frequency and damping  (H(s) = K (1 + s tau2)/tau1 / (s^2 + s K tau2/tau1 + K/tau1), K = Kd Ko; wn = sqrt(K/tau1); zeta = tau2 wn/2)
  Kd = 0.5
  Ko = 20000
  tau1 = 0.01 s
  tau2 = 0.001 s
  assumes: linear phase model, ideal integrator</code></pre>
<p>In the worked example, Kd = 0.5, Ko = 20000, tau1 = 10 ms, tau2 = 1 ms go through the equation above and give wn = 1000 rad/s, fn = 159.1549431 Hz, zeta = 0.5. It applies only when linear phase model, ideal integrator: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_wien_bridge_oscillator">Wien-bridge oscillator frequency and required gain — <code>elx_wien_bridge_oscillator</code></h4>
<p>The oscillation frequency of a Wien-bridge oscillator (series R1 C1, parallel R2 C2) and the non-inverting gain it needs (3 for equal components).</p>
<div class="math">\[f_0 = \frac{1}{2\pi\sqrt{R_1R_2C_1C_2}},\quad A = 1 + \frac{R_1}{R_2} + \frac{C_2}{C_1}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R1</code></td><td>in</td><td>series-arm resistor</td><td>ohm</td></tr><tr><td><code>C1</code></td><td>in</td><td>series-arm capacitor</td><td>F</td></tr><tr><td><code>R2</code></td><td>in</td><td>parallel-arm resistor</td><td>ohm</td></tr><tr><td><code>C2</code></td><td>in</td><td>parallel-arm capacitor</td><td>F</td></tr><tr><td><code>f0</code></td><td>out</td><td>oscillation frequency</td><td>Hz</td></tr><tr><td><code>beta</code></td><td>out</td><td>feedback fraction at f0</td><td>—</td></tr><tr><td><code>A_min</code></td><td>out</td><td>required amplifier gain</td><td>—</td></tr><tr><td><code>Rf_over_Rg</code></td><td>out</td><td>gain resistor ratio</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> ideal amplifier.</p>
<pre><code class="shell">$ electronics-engineering solve elx_wien_bridge_oscillator &quot;R1=10000 ohm&quot; &quot;C1=16 nF&quot; &quot;R2=10000 ohm&quot; &quot;C2=16 nF&quot;
f0 = 994.7183943 Hz
beta = 0.3333333333
A_min = 3
Rf_over_Rg = 2
  by: Wien-bridge oscillator frequency and required gain  (f0 = 1/(2 pi sqrt(R1 R2 C1 C2)); A = 1 + R1/R2 + C2/C1)
  R1 = 10000 ohm
  C1 = 1.6e-08 F
  R2 = 10000 ohm
  C2 = 1.6e-08 F
  assumes: ideal amplifier</code></pre>
<p>In the worked example, R1 = 10000 ohm, C1 = 16 nF, R2 = 10000 ohm, C2 = 16 nF go through the equation above and give f0 = 994.7183943 Hz, beta = 0.3333333333, A_min = 3, Rf_over_Rg = 2. It applies only when ideal amplifier: outside that it says what is wrong instead of returning a number.</p>
<h3>Power supplies (5)</h3>
<h4 id="elx_adjustable_regulator_output">Adjustable three-terminal regulator output voltage — <code>elx_adjustable_regulator_output</code></h4>
<p>The output voltage of an adjustable three-terminal regulator (LM317 type: reference between OUT and ADJ, R1 from OUT to ADJ, R2 from ADJ to ground), including the adjust-pin current.</p>
<div class="math">\[V_{out} = V_{ref}\left(1 + \frac{R_2}{R_1}\right) + I_{adj}R_2\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R1</code></td><td>in</td><td>resistor from OUT to ADJ</td><td>ohm</td></tr><tr><td><code>R2</code></td><td>in</td><td>resistor from ADJ to ground</td><td>ohm</td></tr><tr><td><code>Vref</code></td><td>in</td><td>internal reference (1.25 V for the LM317 type)</td><td>V</td></tr><tr><td><code>Iadj</code></td><td>in</td><td>adjust-pin current (default 0) (optional)</td><td>A</td></tr><tr><td><code>Vout</code></td><td>out</td><td>output voltage</td><td>V</td></tr><tr><td><code>I_R1</code></td><td>out</td><td>current through R1</td><td>A</td></tr></tbody></table>
<p><strong>Applies when:</strong> regulator in regulation (input high enough).</p>
<pre><code class="shell">$ electronics-engineering solve elx_adjustable_regulator_output &quot;R1=240 ohm&quot; &quot;R2=720 ohm&quot; &quot;Vref=1.25 V&quot;
Vout = 5 V
I_R1 = 0.005208333333 A
  by: Adjustable three-terminal regulator output voltage  (Vout = Vref (1 + R2/R1) + Iadj R2)
  R1 = 240 ohm
  R2 = 720 ohm
  Vref = 1.25 V
  assumes: regulator in regulation (input high enough)</code></pre>
<p>In the worked example, R1 = 240 ohm, R2 = 720 ohm, Vref = 1.25 V go through the equation above and give Vout = 5 V, I_R1 = 0.005208333333 A. It applies only when regulator in regulation (input high enough): outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_heat_sink_temperatures">Heat-sink thermal path: junction, case and sink temperatures — <code>elx_heat_sink_temperatures</code></h4>
<p>The junction, case and heat-sink temperatures of a power device dissipating P through junction-to-case, case-to-sink (interface) and sink-to-ambient thermal resistances.</p>
<div class="math">\[T_j = T_a + P\,(\theta_{jc} + \theta_{cs} + \theta_{sa})\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>P</code></td><td>in</td><td>power dissipated</td><td>W</td></tr><tr><td><code>Ta</code></td><td>in</td><td>ambient temperature</td><td>K</td></tr><tr><td><code>theta_jc</code></td><td>in</td><td>junction-to-case thermal resistance</td><td>K/W</td></tr><tr><td><code>theta_cs</code></td><td>in</td><td>case-to-sink thermal resistance</td><td>K/W</td></tr><tr><td><code>theta_sa</code></td><td>in</td><td>sink-to-ambient thermal resistance</td><td>K/W</td></tr><tr><td><code>Tj</code></td><td>out</td><td>junction temperature</td><td>K</td></tr><tr><td><code>Tc</code></td><td>out</td><td>case temperature</td><td>K</td></tr><tr><td><code>Ts</code></td><td>out</td><td>sink temperature</td><td>K</td></tr><tr><td><code>Tj_C</code></td><td>out</td><td>junction temperature in degC</td><td>—</td></tr><tr><td><code>theta_ja</code></td><td>out</td><td>total junction-to-ambient resistance</td><td>K/W</td></tr></tbody></table>
<p><strong>Applies when:</strong> steady state, series thermal path.</p>
<pre><code class="shell">$ electronics-engineering solve elx_heat_sink_temperatures &quot;P=15 W&quot; &quot;Ta=25 degC&quot; &quot;theta_jc=1.5 K/W&quot; &quot;theta_cs=0.5 K/W&quot; &quot;theta_sa=3 K/W&quot;
Tj = 373.15 K
Tc = 350.65 K
Ts = 343.15 K
Tj_C = 100
theta_ja = 5 K/W
  by: Heat-sink thermal path: junction, case and sink temperatures  (Tj = Ta + P (theta_jc + theta_cs + theta_sa))
  P = 15 W
  Ta = 298.15 K
  theta_jc = 1.5 K/W
  theta_cs = 0.5 K/W
  theta_sa = 3 K/W
  assumes: steady state, series thermal path</code></pre>
<p>In the worked example, P = 15 W, Ta = 25 degC, theta_jc = 1.5 K/W, theta_cs = 0.5 K/W, theta_sa = 3 K/W go through the equation above and give Tj = 373.15 K, Tc = 350.65 K, Ts = 343.15 K, Tj_C = 100. It applies only when steady state, series thermal path: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_linear_regulator_efficiency">Linear regulator dissipation and efficiency — <code>elx_linear_regulator_efficiency</code></h4>
<p>The input and output power, the dissipation in the pass element and the efficiency of a linear (series) regulator including its quiescent current.</p>
<div class="math">\[P_D = (V_{in} - V_{out})I_L + V_{in}I_q,\quad \eta = \frac{V_{out}I_L}{V_{in}(I_L + I_q)}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Vin</code></td><td>in</td><td>input voltage</td><td>V</td></tr><tr><td><code>Vout</code></td><td>in</td><td>regulated output voltage</td><td>V</td></tr><tr><td><code>Iload</code></td><td>in</td><td>load current</td><td>A</td></tr><tr><td><code>Iq</code></td><td>in</td><td>quiescent (ground-pin) current</td><td>A</td></tr><tr><td><code>P_in</code></td><td>out</td><td>input power</td><td>W</td></tr><tr><td><code>P_out</code></td><td>out</td><td>output power</td><td>W</td></tr><tr><td><code>P_diss</code></td><td>out</td><td>dissipation in the regulator</td><td>W</td></tr><tr><td><code>efficiency</code></td><td>out</td><td>efficiency</td><td>—</td></tr><tr><td><code>efficiency_pct</code></td><td>out</td><td>efficiency in per cent</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> Vin &gt; Vout.</p>
<pre><code class="shell">$ electronics-engineering solve elx_linear_regulator_efficiency &quot;Vin=12 V&quot; &quot;Vout=5 V&quot; &quot;Iload=500 mA&quot; &quot;Iq=5 mA&quot;
P_in = 6.06 W
P_out = 2.5 W
P_diss = 3.56 W
efficiency = 0.4125412541
efficiency_pct = 41.25412541
  by: Linear regulator dissipation and efficiency  (P_in = Vin (IL + Iq); P_out = Vout IL; P_diss = P_in - P_out; eta = P_out/P_in)
  Vin = 12 V
  Vout = 5 V
  Iload = 0.5 A
  Iq = 0.005 A
  assumes: Vin &gt; Vout</code></pre>
<p>In the worked example, Vin = 12 V, Vout = 5 V, Iload = 500 mA, Iq = 5 mA go through the equation above and give P_in = 6.06 W, P_out = 2.5 W, P_diss = 3.56 W, efficiency = 0.4125412541. It applies only when Vin &gt; Vout: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_heat_sink_required">Required heat-sink thermal resistance — <code>elx_heat_sink_required</code></h4>
<p>The largest sink-to-ambient thermal resistance (and total junction-to-ambient resistance) that keeps a device dissipating P below its maximum junction temperature.</p>
<div class="math">\[\theta_{sa} \le \frac{T_{j,max} - T_a}{P} - \theta_{jc} - \theta_{cs}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>P</code></td><td>in</td><td>power dissipated</td><td>W</td></tr><tr><td><code>Ta</code></td><td>in</td><td>ambient temperature</td><td>K</td></tr><tr><td><code>Tj_max</code></td><td>in</td><td>maximum junction temperature</td><td>K</td></tr><tr><td><code>theta_jc</code></td><td>in</td><td>junction-to-case thermal resistance</td><td>K/W</td></tr><tr><td><code>theta_cs</code></td><td>in</td><td>case-to-sink thermal resistance</td><td>K/W</td></tr><tr><td><code>theta_ja_max</code></td><td>out</td><td>largest junction-to-ambient resistance</td><td>K/W</td></tr><tr><td><code>theta_sa_max</code></td><td>out</td><td>largest sink-to-ambient resistance</td><td>K/W</td></tr></tbody></table>
<p><strong>Applies when:</strong> a positive result (otherwise no heat sink suffices).</p>
<pre><code class="shell">$ electronics-engineering solve elx_heat_sink_required &quot;P=20 W&quot; &quot;Ta=40 degC&quot; &quot;Tj_max=150 degC&quot; &quot;theta_jc=1 K/W&quot; &quot;theta_cs=0.5 K/W&quot;
theta_ja_max = 5.5 K/W
theta_sa_max = 4 K/W
  by: Required heat-sink thermal resistance  (theta_sa = (Tj,max - Ta)/P - theta_jc - theta_cs)
  P = 20 W
  Ta = 313.15 K
  Tj_max = 423.15 K
  theta_jc = 1 K/W
  theta_cs = 0.5 K/W
  assumes: a positive result (otherwise no heat sink suffices)</code></pre>
<p>In the worked example, P = 20 W, Ta = 40 degC, Tj_max = 150 degC, theta_jc = 1 K/W, theta_cs = 0.5 K/W go through the equation above and give theta_ja_max = 5.5 K/W, theta_sa_max = 4 K/W. It applies only when a positive result (otherwise no heat sink suffices): outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_series_pass_regulator">Zener-referenced series-pass (emitter-follower) regulator — <code>elx_series_pass_regulator</code></h4>
<p>The output voltage, load, base, Zener and resistor currents and the pass-transistor dissipation of a regulator in which a Zener diode biased through Rs sets the base of an emitter-follower pass transistor.</p>
<div class="math">\[V_{out} = V_Z - V_{BE},\quad I_Z = \frac{V_{in} - V_Z}{R_S} - \frac{I_L}{\beta+1}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Vin</code></td><td>in</td><td>unregulated input</td><td>V</td></tr><tr><td><code>Vz</code></td><td>in</td><td>Zener voltage</td><td>V</td></tr><tr><td><code>Rs</code></td><td>in</td><td>Zener bias resistor</td><td>ohm</td></tr><tr><td><code>RL</code></td><td>in</td><td>load resistance</td><td>ohm</td></tr><tr><td><code>beta</code></td><td>in</td><td>current gain of the pass transistor</td><td>—</td></tr><tr><td><code>VBE</code></td><td>in</td><td>base-emitter voltage</td><td>V</td></tr><tr><td><code>Vout</code></td><td>out</td><td>output voltage Vz - VBE</td><td>V</td></tr><tr><td><code>I_L</code></td><td>out</td><td>load current</td><td>A</td></tr><tr><td><code>I_B</code></td><td>out</td><td>base current</td><td>A</td></tr><tr><td><code>I_z</code></td><td>out</td><td>Zener current</td><td>A</td></tr><tr><td><code>I_Rs</code></td><td>out</td><td>current in Rs</td><td>A</td></tr><tr><td><code>P_Q</code></td><td>out</td><td>pass-transistor dissipation</td><td>W</td></tr></tbody></table>
<p><strong>Applies when:</strong> Vin &gt; Vz &gt; VBE; the Zener stays in breakdown (Iz &gt; 0).</p>
<pre><code class="shell">$ electronics-engineering solve elx_series_pass_regulator &quot;Vin=15 V&quot; &quot;Vz=10 V&quot; &quot;Rs=1000 ohm&quot; &quot;RL=100 ohm&quot; beta=100 &quot;VBE=0.7 V&quot;
Vout = 9.3 V
I_L = 0.093 A
I_B = 0.0009207920792 A
I_z = 0.004079207921 A
I_Rs = 0.005 A
P_Q = 0.5248514851 W
  by: Zener-referenced series-pass (emitter-follower) regulator  (Vout = Vz - VBE; IB = IL/(beta + 1); Iz = (Vin - Vz)/Rs - IB; P = (Vin - Vout) IC)
  Vin = 15 V
  Vz = 10 V
  Rs = 1000 ohm
  RL = 100 ohm
  beta = 100
  VBE = 0.7 V
  assumes: Vin &gt; Vz &gt; VBE; the Zener stays in breakdown (Iz &gt; 0)</code></pre>
<p>In the worked example, Vin = 15 V, Vz = 10 V, Rs = 1000 ohm, RL = 100 ohm, beta = 100, VBE = 0.7 V go through the equation above and give Vout = 9.3 V, I_L = 0.093 A, I_B = 0.0009207920792 A, I_z = 0.004079207921 A. It applies only when Vin &gt; Vz &gt; VBE; the Zener stays in breakdown (Iz &gt; 0): outside that it says what is wrong instead of returning a number.</p>
<h3>Semiconductors (9)</h3>
<h4 id="elx_builtin_potential">Built-in potential of a pn junction — <code>elx_builtin_potential</code></h4>
<p>The built-in (contact) potential of an abrupt pn junction from the doping on each side, the intrinsic concentration and the temperature.</p>
<div class="math">\[V_{bi} = \frac{kT}{q}\ln\frac{N_AN_D}{n_i^2}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>NA</code></td><td>in</td><td>acceptor concentration on the p side</td><td>1/m^3</td></tr><tr><td><code>ND</code></td><td>in</td><td>donor concentration on the n side</td><td>1/m^3</td></tr><tr><td><code>ni</code></td><td>in</td><td>intrinsic carrier concentration</td><td>1/m^3</td></tr><tr><td><code>T</code></td><td>in</td><td>absolute temperature</td><td>K</td></tr><tr><td><code>Vbi</code></td><td>out</td><td>built-in potential</td><td>V</td></tr></tbody></table>
<p><strong>Applies when:</strong> NA, ND &gt;= 100 ni; non-degenerate, complete ionisation.</p>
<pre><code class="shell">$ electronics-engineering solve elx_builtin_potential &quot;NA=1e+17 cm^-3&quot; &quot;ND=1e+16 cm^-3&quot; &quot;ni=1.5e+10 cm^-3&quot; &quot;T=300 K&quot;
Vbi = 0.7528794135 V
  by: Built-in potential of a pn junction  (Vbi = (kT/q) ln(NA ND / ni^2))
  NA = 1e+23 1/m^3
  ND = 1e+22 1/m^3
  ni = 1.5e+16 1/m^3
  T = 300 K
  assumes: NA, ND &gt;= 100 ni; non-degenerate, complete ionisation</code></pre>
<p>In the worked example, NA = 1e+17 cm^-3, ND = 1e+16 cm^-3, ni = 1.5e+10 cm^-3, T = 300 K go through the equation above and give Vbi = 0.7528794135 V. It applies only when NA, ND &gt;= 100 ni; non-degenerate, complete ionisation: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_semiconductor_conductivity">Conductivity and resistivity of a semiconductor — <code>elx_semiconductor_conductivity</code></h4>
<p>The conductivity sigma = q (n mu_n + p mu_p) and the resistivity of a semiconductor from its electron and hole concentrations and mobilities.</p>
<div class="math">\[\sigma = q\,(n\mu_n + p\mu_p),\quad \rho = 1/\sigma\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>n</code></td><td>in</td><td>electron concentration</td><td>1/m^3</td></tr><tr><td><code>p</code></td><td>in</td><td>hole concentration</td><td>1/m^3</td></tr><tr><td><code>mu_n</code></td><td>in</td><td>electron mobility</td><td>m^2/(V*s)</td></tr><tr><td><code>mu_p</code></td><td>in</td><td>hole mobility</td><td>m^2/(V*s)</td></tr><tr><td><code>sigma</code></td><td>out</td><td>conductivity</td><td>1/(ohm*m)</td></tr><tr><td><code>rho</code></td><td>out</td><td>resistivity</td><td>ohm*m</td></tr><tr><td><code>rho_ohm_cm</code></td><td>out</td><td>resistivity in ohm cm</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> n, p &gt;= 0 (not both zero); mobilities &gt; 0.</p>
<pre><code class="shell">$ electronics-engineering solve elx_semiconductor_conductivity &quot;n=1e+16 cm^-3&quot; &quot;p=22500 cm^-3&quot; &quot;mu_n=1350 cm^2/(V*s)&quot; &quot;mu_p=480 cm^2/(V*s)&quot;
sigma = 216.2938456 1/(ohm*m)
rho = 0.004623340055 ohm*m
rho_ohm_cm = 0.4623340055
  by: Conductivity and resistivity of a semiconductor  (sigma = q (n mu_n + p mu_p); rho = 1/sigma)
  n = 1e+22 1/m^3
  p = 2.25e+10 1/m^3
  mu_n = 0.135 m^2/(V*s)
  mu_p = 0.048 m^2/(V*s)
  assumes: n, p &gt;= 0 (not both zero); mobilities &gt; 0</code></pre>
<p>In the worked example, n = 1e+16 cm^-3, p = 22500 cm^-3, mu_n = 1350 cm^2/(V*s), mu_p = 480 cm^2/(V*s) go through the equation above and give sigma = 216.2938456 1/(ohm*m), rho = 0.004623340055 ohm*m, rho_ohm_cm = 0.4623340055. It applies only when n, p &gt;= 0 (not both zero); mobilities &gt; 0: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_depletion_width">Depletion width, field and capacitance of an abrupt pn junction — <code>elx_depletion_width</code></h4>
<p>The depletion-region width (and its parts on each side), the peak electric field and the depletion capacitance per area of an abrupt pn junction at a reverse bias (negative VR for a forward bias below Vbi).</p>
<div class="math">\[W = \sqrt{\frac{2\varepsilon(V_{bi}+V_R)}{q}\left(\frac{1}{N_A}+\frac{1}{N_D}\right)}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>NA</code></td><td>in</td><td>acceptor concentration (p side)</td><td>1/m^3</td></tr><tr><td><code>ND</code></td><td>in</td><td>donor concentration (n side)</td><td>1/m^3</td></tr><tr><td><code>Vbi</code></td><td>in</td><td>built-in potential</td><td>V</td></tr><tr><td><code>VR</code></td><td>in</td><td>reverse bias (negative for forward)</td><td>V</td></tr><tr><td><code>eps_r</code></td><td>in</td><td>relative permittivity of the semiconductor (11.7 for silicon)</td><td>—</td></tr><tr><td><code>W</code></td><td>out</td><td>depletion width</td><td>m</td></tr><tr><td><code>W_um</code></td><td>out</td><td>depletion width in micrometres</td><td>—</td></tr><tr><td><code>xn</code></td><td>out</td><td>width on the n side</td><td>m</td></tr><tr><td><code>xp</code></td><td>out</td><td>width on the p side</td><td>m</td></tr><tr><td><code>Emax</code></td><td>out</td><td>peak electric field (V/m)</td><td>N/C</td></tr><tr><td><code>Cj_area</code></td><td>out</td><td>depletion capacitance per area</td><td>F/m^2</td></tr></tbody></table>
<p><strong>Applies when:</strong> Vbi + VR &gt; 0; abrupt junction, depletion approximation.</p>
<pre><code class="shell">$ electronics-engineering solve elx_depletion_width &quot;NA=1e+17 cm^-3&quot; &quot;ND=1e+16 cm^-3&quot; &quot;Vbi=0.81 V&quot; &quot;VR=5 V&quot; eps_r=11.7
W = 9.090996814e-07 m
W_um = 0.9090996814
xn = 8.264542558e-07 m
xp = 8.264542558e-08 m
Emax = 12781876.66 N/C
Cj_area = 0.0001139522976 F/m^2
  by: Depletion width, field and capacitance of an abrupt pn junction  (W = sqrt(2 eps (Vbi + VR)/q (1/NA + 1/ND)); xn = W NA/(NA+ND); Emax = q ND xn/eps; C&#x27; = eps/W)
  NA = 1e+23 1/m^3
  ND = 1e+22 1/m^3
  Vbi = 0.81 V
  VR = 5 V
  eps_r = 11.7
  assumes: Vbi + VR &gt; 0; abrupt junction, depletion approximation</code></pre>
<p>In the worked example, NA = 1e+17 cm^-3, ND = 1e+16 cm^-3, Vbi = 0.81 V, VR = 5 V, eps_r = 11.7 go through the equation above and give W = 9.090996814e-07 m, W_um = 0.9090996814, xn = 8.264542558e-07 m, xp = 8.264542558e-08 m. It applies only when Vbi + VR &gt; 0; abrupt junction, depletion approximation: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_drift_current">Drift velocity and drift current in a semiconductor bar — <code>elx_drift_current</code></h4>
<p>The electric field, the carrier drift velocity, the drift current density and the current when a voltage is applied along a uniformly doped bar.</p>
<div class="math">\[J = q\,n\,\mu\,E,\quad E = V/L\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>n</code></td><td>in</td><td>concentration of the carriers that drift</td><td>1/m^3</td></tr><tr><td><code>mu</code></td><td>in</td><td>their mobility</td><td>m^2/(V*s)</td></tr><tr><td><code>V</code></td><td>in</td><td>voltage applied along the bar</td><td>V</td></tr><tr><td><code>L</code></td><td>in</td><td>bar length</td><td>m</td></tr><tr><td><code>A</code></td><td>in</td><td>cross-sectional area</td><td>m^2</td></tr><tr><td><code>E</code></td><td>out</td><td>electric field (V/m)</td><td>N/C</td></tr><tr><td><code>v_d</code></td><td>out</td><td>drift velocity</td><td>m/s</td></tr><tr><td><code>J</code></td><td>out</td><td>drift current density</td><td>A/m^2</td></tr><tr><td><code>I</code></td><td>out</td><td>current</td><td>A</td></tr></tbody></table>
<p><strong>Applies when:</strong> n, mu, L, A &gt; 0; low field (constant mobility).</p>
<pre><code class="shell">$ electronics-engineering solve elx_drift_current &quot;n=1e+16 cm^-3&quot; &quot;mu=1350 cm^2/(V*s)&quot; &quot;V=5 V&quot; &quot;L=0.001 m&quot; &quot;A=1e-08 m^2&quot;
E = 5000 N/C
v_d = 675 m/s
J = 1081469.228 A/m^2
I = 0.01081469228 A
  by: Drift velocity and drift current in a semiconductor bar  (E = V/L; v_d = mu E; J = q n v_d; I = J A)
  n = 1e+22 1/m^3
  mu = 0.135 m^2/(V*s)
  V = 5 V
  L = 0.001 m
  A = 1e-08 m^2
  assumes: n, mu, L, A &gt; 0; low field (constant mobility)</code></pre>
<p>In the worked example, n = 1e+16 cm^-3, mu = 1350 cm^2/(V*s), V = 5 V, L = 0.001 m, A = 1e-08 m^2 go through the equation above and give E = 5000 N/C, v_d = 675 m/s, J = 1081469.228 A/m^2, I = 0.01081469228 A. It applies only when n, mu, L, A &gt; 0; low field (constant mobility): outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_einstein_diffusion">Einstein relation and diffusion length — <code>elx_einstein_diffusion</code></h4>
<p>The diffusion coefficient D = mu kT/q of carriers from their mobility (Einstein relation) and the diffusion length L = sqrt(D tau) from the minority-carrier lifetime.</p>
<div class="math">\[D = \mu\frac{kT}{q},\quad L = \sqrt{D\tau}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>mu</code></td><td>in</td><td>carrier mobility</td><td>m^2/(V*s)</td></tr><tr><td><code>T</code></td><td>in</td><td>absolute temperature</td><td>K</td></tr><tr><td><code>tau</code></td><td>in</td><td>minority-carrier lifetime</td><td>s</td></tr><tr><td><code>D</code></td><td>out</td><td>diffusion coefficient</td><td>m^2/s</td></tr><tr><td><code>D_cm2</code></td><td>out</td><td>D in cm^2/s</td><td>—</td></tr><tr><td><code>L_diff</code></td><td>out</td><td>diffusion length</td><td>m</td></tr><tr><td><code>L_um</code></td><td>out</td><td>diffusion length in micrometres</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> mu, T, tau &gt; 0; non-degenerate material.</p>
<pre><code class="shell">$ electronics-engineering solve elx_einstein_diffusion &quot;mu=1350 cm^2/(V*s)&quot; &quot;T=300 K&quot; &quot;tau=1 us&quot;
D = 0.003490019971 m^2/s
D_cm2 = 34.90019971
L_diff = 5.907639098e-05 m
L_um = 59.07639098
  by: Einstein relation and diffusion length  (D = mu kT/q; L = sqrt(D tau))
  mu = 0.135 m^2/(V*s)
  T = 300 K
  tau = 1e-06 s
  assumes: mu, T, tau &gt; 0; non-degenerate material</code></pre>
<p>In the worked example, mu = 1350 cm^2/(V*s), T = 300 K, tau = 1 us go through the equation above and give D = 0.003490019971 m^2/s, D_cm2 = 34.90019971, L_diff = 5.907639098e-05 m, L_um = 59.07639098. It applies only when mu, T, tau &gt; 0; non-degenerate material: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_doped_carrier_concentrations">Electron and hole concentrations of doped (compensated) material — <code>elx_doped_carrier_concentrations</code></h4>
<p>The equilibrium electron and hole concentrations of a semiconductor with donors and acceptors, from charge neutrality and the mass-action law (exact, so it also holds for light or compensated doping).</p>
<div class="math">\[n = \frac{N_D - N_A}{2} + \sqrt{\left(\frac{N_D - N_A}{2}\right)^2 + n_i^2},\quad p = \frac{n_i^2}{n}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>ND</code></td><td>in</td><td>donor concentration</td><td>1/m^3</td></tr><tr><td><code>NA</code></td><td>in</td><td>acceptor concentration</td><td>1/m^3</td></tr><tr><td><code>ni</code></td><td>in</td><td>intrinsic carrier concentration</td><td>1/m^3</td></tr><tr><td><code>n</code></td><td>out</td><td>electron concentration</td><td>1/m^3</td></tr><tr><td><code>p</code></td><td>out</td><td>hole concentration</td><td>1/m^3</td></tr><tr><td><code>n_cm3</code></td><td>out</td><td>n in cm^-3</td><td>—</td></tr><tr><td><code>p_cm3</code></td><td>out</td><td>p in cm^-3</td><td>—</td></tr><tr><td><code>type</code></td><td>out</td><td>n-type, p-type or intrinsic</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> ND, NA &gt;= 0; ni &gt; 0; complete ionisation, non-degenerate.</p>
<pre><code class="shell">$ electronics-engineering solve elx_doped_carrier_concentrations &quot;ND=1e+16 cm^-3&quot; &quot;NA=0 cm^-3&quot; &quot;ni=1.5e+10 cm^-3&quot;
n = 1e+22 1/m^3
p = 2.25e+10 1/m^3
n_cm3 = 1e+16
p_cm3 = 22500
type = n-type
  by: Electron and hole concentrations of doped (compensated) material  (n - p = ND - NA and n p = ni^2: majority = |ND-NA|/2 + sqrt((ND-NA)^2/4 + ni^2), minority = ni^2/majority)
  ND = 1e+22 1/m^3
  NA = 0 1/m^3
  ni = 1.5e+16 1/m^3
  assumes: ND, NA &gt;= 0; ni &gt; 0; complete ionisation, non-degenerate</code></pre>
<p>In the worked example, ND = 1e+16 cm^-3, NA = 0 cm^-3, ni = 1.5e+10 cm^-3 go through the equation above and give n = 1e+22 1/m^3, p = 2.25e+10 1/m^3, n_cm3 = 1e+16, p_cm3 = 22500. It applies only when ND, NA &gt;= 0; ni &gt; 0; complete ionisation, non-degenerate: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_intrinsic_carrier_concentration">Intrinsic carrier concentration — <code>elx_intrinsic_carrier_concentration</code></h4>
<p>The intrinsic carrier concentration ni = sqrt(Nc Nv) exp(-Eg/2kT) at a temperature, from the effective densities of states at 300 K (scaled as T^1.5) and the band gap; also the intrinsic level&#x27;s offset from midgap.</p>
<div class="math">\[n_i = \sqrt{N_cN_v}\,e^{-E_g/2kT},\quad N_{c,v}(T) = N_{c,v}(300)\left(\tfrac{T}{300}\right)^{3/2}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Nc</code></td><td>in</td><td>effective density of states in the conduction band at 300 K</td><td>1/m^3</td></tr><tr><td><code>Nv</code></td><td>in</td><td>effective density of states in the valence band at 300 K</td><td>1/m^3</td></tr><tr><td><code>Eg</code></td><td>in</td><td>band gap energy</td><td>J</td></tr><tr><td><code>T</code></td><td>in</td><td>absolute temperature</td><td>K</td></tr><tr><td><code>ni</code></td><td>out</td><td>intrinsic carrier concentration</td><td>1/m^3</td></tr><tr><td><code>ni_cm3</code></td><td>out</td><td>ni in cm^-3</td><td>—</td></tr><tr><td><code>Ei_minus_midgap_eV</code></td><td>out</td><td>intrinsic Fermi level above midgap, eV</td><td>—</td></tr><tr><td><code>Nc_T</code></td><td>out</td><td>Nc at T</td><td>1/m^3</td></tr><tr><td><code>Nv_T</code></td><td>out</td><td>Nv at T</td><td>1/m^3</td></tr></tbody></table>
<p><strong>Applies when:</strong> Nc, Nv, Eg, T &gt; 0; non-degenerate statistics, band gap independent of T.</p>
<pre><code class="shell">$ electronics-engineering solve elx_intrinsic_carrier_concentration &quot;Nc=2.8e+19 cm^-3&quot; &quot;Nv=1.04e+19 cm^-3&quot; &quot;Eg=1.12 eV&quot; &quot;T=300 K&quot;
ni = 6.67589872e+15 1/m^3
ni_cm3 = 6675898720
Ei_minus_midgap_eV = -0.01280189354
Nc_T = 2.8e+25 1/m^3
Nv_T = 1.04e+25 1/m^3
  by: Intrinsic carrier concentration  (Nc(T) = Nc (T/300)^1.5, Nv likewise; ni = sqrt(Nc Nv) exp(-Eg/(2kT)); Ei - Emid = (kT/2) ln(Nv/Nc))
  Nc = 2.8e+25 1/m^3
  Nv = 1.04e+25 1/m^3
  Eg = 1.79443783e-19 J
  T = 300 K
  assumes: Nc, Nv, Eg, T &gt; 0; non-degenerate statistics, band gap independent of T</code></pre>
<p>In the worked example, Nc = 2.8e+19 cm^-3, Nv = 1.04e+19 cm^-3, Eg = 1.12 eV, T = 300 K go through the equation above and give ni = 6.67589872e+15 1/m^3, ni_cm3 = 6675898720, Ei_minus_midgap_eV = -0.01280189354, Nc_T = 2.8e+25 1/m^3. It applies only when Nc, Nv, Eg, T &gt; 0; non-degenerate statistics, band gap independent of T: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_junction_capacitance">Junction (depletion) capacitance versus bias — <code>elx_junction_capacitance</code></h4>
<p>The depletion capacitance of a pn junction at a reverse bias from its zero-bias value, the built-in potential and the grading coefficient (1/2 abrupt, 1/3 linearly graded), as used for varactors.</p>
<div class="math">\[C_j = \frac{C_{j0}}{\left(1 + V_R/V_{bi}\right)^{m}}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>Cj0</code></td><td>in</td><td>zero-bias junction capacitance</td><td>F</td></tr><tr><td><code>Vbi</code></td><td>in</td><td>built-in potential</td><td>V</td></tr><tr><td><code>VR</code></td><td>in</td><td>reverse bias (negative for forward)</td><td>V</td></tr><tr><td><code>m</code></td><td>in</td><td>grading coefficient (0.5 abrupt, 0.33 linearly graded)</td><td>—</td></tr><tr><td><code>Cj</code></td><td>out</td><td>junction capacitance</td><td>F</td></tr><tr><td><code>ratio</code></td><td>out</td><td>Cj/Cj0</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> 0 &lt; m &lt; 1; VR &gt; -Vbi.</p>
<pre><code class="shell">$ electronics-engineering solve elx_junction_capacitance &quot;Cj0=2 pF&quot; &quot;Vbi=0.75 V&quot; &quot;VR=5 V&quot; m=0.5
Cj = 7.223151185e-13 F
ratio = 0.3611575593
  by: Junction (depletion) capacitance versus bias  (Cj = Cj0 / (1 + VR/Vbi)^m)
  Cj0 = 2e-12 F
  Vbi = 0.75 V
  VR = 5 V
  m = 0.5
  assumes: 0 &lt; m &lt; 1; VR &gt; -Vbi</code></pre>
<p>In the worked example, Cj0 = 2 pF, Vbi = 0.75 V, VR = 5 V, m = 0.5 go through the equation above and give Cj = 7.223151185e-13 F, ratio = 0.3611575593. It applies only when 0 &lt; m &lt; 1; VR &gt; -Vbi: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_thermal_voltage">Thermal voltage kT/q — <code>elx_thermal_voltage</code></h4>
<p>The thermal voltage VT = kT/q at an absolute temperature (about 25.85 mV at 300 K), the voltage scale of every diode and transistor equation.</p>
<div class="math">\[V_T = \frac{kT}{q}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>T</code></td><td>in</td><td>absolute temperature (degC is converted)</td><td>K</td></tr><tr><td><code>VT</code></td><td>out</td><td>thermal voltage</td><td>V</td></tr><tr><td><code>VT_mV</code></td><td>out</td><td>thermal voltage in millivolts</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> T &gt; 0 K.</p>
<pre><code class="shell">$ electronics-engineering solve elx_thermal_voltage &quot;T=300 K&quot;
VT = 0.02585199979 V
VT_mV = 25.85199979
  by: Thermal voltage kT/q  (VT = k T / q)
  T = 300 K
  assumes: T &gt; 0 K</code></pre>
<p>In the worked example, T = 300 K go through the equation above and give VT = 0.02585199979 V, VT_mV = 25.85199979. It applies only when T &gt; 0 K: outside that it says what is wrong instead of returning a number.</p>
<h3>Timing (5)</h3>
<h4 id="elx_cmos_dynamic_power">CMOS dynamic (switching) power — <code>elx_cmos_dynamic_power</code></h4>
<p>The dynamic power alpha C VDD^2 f of CMOS logic, the energy drawn from the supply per 0 -&gt; 1 transition, the energy stored on the load and the average supply current.</p>
<div class="math">\[P_{dyn} = \alpha\,C\,V_{DD}^2f\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>alpha</code></td><td>in</td><td>activity factor: probability of a 0 -&gt; 1 transition per clock cycle</td><td>—</td></tr><tr><td><code>C</code></td><td>in</td><td>switched capacitance</td><td>F</td></tr><tr><td><code>VDD</code></td><td>in</td><td>supply voltage</td><td>V</td></tr><tr><td><code>f</code></td><td>in</td><td>clock frequency</td><td>Hz</td></tr><tr><td><code>P</code></td><td>out</td><td>dynamic power</td><td>W</td></tr><tr><td><code>E_supply</code></td><td>out</td><td>energy from the supply per transition, C VDD^2</td><td>J</td></tr><tr><td><code>E_stored</code></td><td>out</td><td>energy stored on C, C VDD^2/2</td><td>J</td></tr><tr><td><code>I_avg</code></td><td>out</td><td>average supply current</td><td>A</td></tr></tbody></table>
<p><strong>Applies when:</strong> 0 &lt;= alpha &lt;= 1; full-swing switching, short-circuit and leakage power not included.</p>
<pre><code class="shell">$ electronics-engineering solve elx_cmos_dynamic_power alpha=0.1 &quot;C=1000 pF&quot; &quot;VDD=1 V&quot; &quot;f=1000000000 Hz&quot;
P = 0.1 W
E_supply = 1e-09 J
E_stored = 5e-10 J
I_avg = 0.1 A
  by: CMOS dynamic (switching) power  (P = alpha C VDD^2 f)
  alpha = 0.1
  C = 1e-09 F
  VDD = 1 V
  f = 1000000000 Hz
  assumes: 0 &lt;= alpha &lt;= 1; full-swing switching, short-circuit and leakage power not included</code></pre>
<p>In the worked example, alpha = 0.1, C = 1000 pF, VDD = 1 V, f = 1000000000 Hz go through the equation above and give P = 0.1 W, E_supply = 1e-09 J, E_stored = 5e-10 J, I_avg = 0.1 A. It applies only when 0 &lt;= alpha &lt;= 1; full-swing switching, short-circuit and leakage power not included: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_elmore_delay">Elmore delay of an RC ladder (interconnect) — <code>elx_elmore_delay</code></h4>
<p>The Elmore delay to every node of an RC ladder (a driver resistance and wire segments, each followed by a capacitance to ground), the delay at the far end and its 50 % estimate ln 2 tau.</p>
<div class="math">\[\tau_D = \sum_i C_i\sum_{j\le i}R_j\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R</code></td><td>in</td><td>series resistances in ohms, from the driver outwards</td><td>—</td></tr><tr><td><code>C</code></td><td>in</td><td>node capacitances in picofarads, one after each resistor</td><td>—</td></tr><tr><td><code>tau_D</code></td><td>out</td><td>Elmore delay at the far end</td><td>s</td></tr><tr><td><code>t50</code></td><td>out</td><td>50 % delay estimate ln 2 tau_D</td><td>s</td></tr><tr><td><code>delays</code></td><td>out</td><td>Elmore delay at each node, seconds</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> one capacitance per resistor; step input.</p>
<pre><code class="shell">$ electronics-engineering solve elx_elmore_delay &quot;R=[100, 50, 50]&quot; &quot;C=[0.1, 0.1, 0.2]&quot;
tau_D = 6.5e-11 s
t50 = 4.505456674e-11 s
delays = [4e-11,5.5e-11,6.5e-11]
  by: Elmore delay of an RC ladder (interconnect)  (tau_k = sum_i C_i R(shared path of nodes i and k))
  assumes: one capacitance per resistor; step input</code></pre>
<p>In the worked example, R = [100, 50, 50], C = [0.1, 0.1, 0.2] go through the equation above and give tau_D = 6.5e-11 s, t50 = 4.505456674e-11 s, delays = [4e-11, 5.5e-11, 6.5e-11]. It applies only when one capacitance per resistor; step input: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_setup_hold_timing">Flip-flop setup and hold slack, maximum clock frequency — <code>elx_setup_hold_timing</code></h4>
<p>The setup slack, hold slack, maximum clock frequency and a verdict for a register-to-register path from clock-to-Q, logic delays, setup and hold times and clock skew (positive when the capture clock is late).</p>
<div class="math">\[T \ge t_{cq} + t_{pd} + t_{su} - t_{skew},\quad t_{ccq} + t_{cd} \ge t_h + t_{skew}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>T</code></td><td>in</td><td>clock period</td><td>s</td></tr><tr><td><code>tcq</code></td><td>in</td><td>maximum clock-to-Q delay</td><td>s</td></tr><tr><td><code>tpd</code></td><td>in</td><td>maximum logic delay</td><td>s</td></tr><tr><td><code>tsu</code></td><td>in</td><td>setup time</td><td>s</td></tr><tr><td><code>tskew</code></td><td>in</td><td>clock skew, capture minus launch</td><td>s</td></tr><tr><td><code>tccq</code></td><td>in</td><td>minimum (contamination) clock-to-Q</td><td>s</td></tr><tr><td><code>tcd</code></td><td>in</td><td>minimum (contamination) logic delay</td><td>s</td></tr><tr><td><code>th</code></td><td>in</td><td>hold time</td><td>s</td></tr><tr><td><code>setup_slack</code></td><td>out</td><td>setup slack</td><td>s</td></tr><tr><td><code>hold_slack</code></td><td>out</td><td>hold slack</td><td>s</td></tr><tr><td><code>f_max</code></td><td>out</td><td>maximum clock frequency</td><td>Hz</td></tr><tr><td><code>verdict</code></td><td>out</td><td>meets timing, setup violation, hold violation or both</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> edge-triggered registers, single clock.</p>
<pre><code class="shell">$ electronics-engineering solve elx_setup_hold_timing &quot;T=5 ns&quot; &quot;tcq=0.3 ns&quot; &quot;tpd=3.5 ns&quot; &quot;tsu=0.2 ns&quot; &quot;tskew=0.1 ns&quot; &quot;tccq=0.1 ns&quot; &quot;tcd=0.2 ns&quot; &quot;th=0.1 ns&quot;
setup_slack = 1.1e-09 s
hold_slack = 1e-10 s
f_max = 256410256.4 Hz
verdict = meets timing
  by: Flip-flop setup and hold slack, maximum clock frequency  (setup slack = T + skew - (tcq + tpd + tsu); hold slack = tccq + tcd - th - skew; f_max = 1/(tcq + tpd + tsu - skew))
  T = 5e-09 s
  tcq = 3e-10 s
  tpd = 3.5e-09 s
  tsu = 2e-10 s
  tskew = 1e-10 s
  tccq = 1e-10 s
  tcd = 2e-10 s
  th = 1e-10 s
  assumes: edge-triggered registers, single clock</code></pre>
<p>In the worked example, T = 5 ns, tcq = 0.3 ns, tpd = 3.5 ns, tsu = 0.2 ns, tskew = 0.1 ns, tccq = 0.1 ns, tcd = 0.2 ns, th = 0.1 ns go through the equation above and give setup_slack = 1.1e-09 s, hold_slack = 1e-10 s, f_max = 256410256.4 Hz, verdict = meets timing. It applies only when edge-triggered registers, single clock: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_rc_delay_rise_time">RC delay, 10-90 % rise time and bandwidth — <code>elx_rc_delay_rise_time</code></h4>
<p>The time constant, the 50 % delay (ln 2 RC), the 10-90 % rise time (ln 9 RC = 2.2 RC), the -3 dB bandwidth and the rise-time-bandwidth product (0.35) of a first-order RC low-pass.</p>
<div class="math">\[t_r = \ln 9\,RC \approx 2.2RC,\quad t_rf_{3dB} \approx 0.35\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>R</code></td><td>in</td><td>resistance</td><td>ohm</td></tr><tr><td><code>C</code></td><td>in</td><td>capacitance</td><td>F</td></tr><tr><td><code>tau</code></td><td>out</td><td>time constant RC</td><td>s</td></tr><tr><td><code>t50</code></td><td>out</td><td>50 % delay</td><td>s</td></tr><tr><td><code>t_rise</code></td><td>out</td><td>10-90 % rise time</td><td>s</td></tr><tr><td><code>f_3dB</code></td><td>out</td><td>-3 dB bandwidth</td><td>Hz</td></tr><tr><td><code>tr_times_bw</code></td><td>out</td><td>rise time x bandwidth</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> step input, first-order RC.</p>
<pre><code class="shell">$ electronics-engineering solve elx_rc_delay_rise_time &quot;R=1000 ohm&quot; &quot;C=10 pF&quot;
tau = 1e-08 s
t50 = 6.931471806e-09 s
t_rise = 2.197224577e-08 s
f_3dB = 15915494.31 Hz
tr_times_bw = 0.3496991526
  by: RC delay, 10-90 % rise time and bandwidth  (t50 = ln 2 RC; tr = ln 9 RC; f = 1/(2 pi RC); tr f = ln 9/(2 pi))
  R = 1000 ohm
  C = 1e-11 F
  assumes: step input, first-order RC</code></pre>
<p>In the worked example, R = 1000 ohm, C = 10 pF go through the equation above and give tau = 1e-08 s, t50 = 6.931471806e-09 s, t_rise = 2.197224577e-08 s, f_3dB = 15915494.31 Hz. It applies only when step input, first-order RC: outside that it says what is wrong instead of returning a number.</p>
<h4 id="elx_metastability_mtbf">Synchronizer metastability MTBF — <code>elx_metastability_mtbf</code></h4>
<p>The mean time between synchronizer failures MTBF = exp(tr/tau)/(T0 fclk fdata) from the resolution time allowed, the flip-flop&#x27;s time constant and window, and the clock and data rates.</p>
<div class="math">\[\text{MTBF} = \frac{e^{t_r/\tau}}{T_0f_{clk}f_{data}}\]</div>
<table><thead><tr><th>symbol</th><th></th><th>meaning</th><th>SI unit</th></tr></thead><tbody><tr><td><code>tr</code></td><td>in</td><td>resolution time available</td><td>s</td></tr><tr><td><code>tau</code></td><td>in</td><td>metastability time constant</td><td>s</td></tr><tr><td><code>T0</code></td><td>in</td><td>metastability window T0</td><td>s</td></tr><tr><td><code>fclk</code></td><td>in</td><td>clock frequency</td><td>Hz</td></tr><tr><td><code>fdata</code></td><td>in</td><td>rate of asynchronous data changes</td><td>Hz</td></tr><tr><td><code>MTBF_s</code></td><td>out</td><td>MTBF</td><td>s</td></tr><tr><td><code>MTBF_years</code></td><td>out</td><td>MTBF in years (365.25 days)</td><td>—</td></tr><tr><td><code>log10_MTBF_s</code></td><td>out</td><td>log10 of MTBF in seconds</td><td>—</td></tr></tbody></table>
<p><strong>Applies when:</strong> tr/tau &lt;= 700.</p>
<pre><code class="shell">$ electronics-engineering solve elx_metastability_mtbf &quot;tr=2 ns&quot; &quot;tau=50 ps&quot; &quot;T0=100 ps&quot; &quot;fclk=500000000 Hz&quot; &quot;fdata=10000000 Hz&quot;
MTBF_s = 4.707705337e+11 s
MTBF_years = 14917.81801
log10_MTBF_s = 11.67280927
  by: Synchronizer metastability MTBF  (MTBF = exp(tr/tau)/(T0 fclk fdata))
  tr = 2e-09 s
  tau = 5e-11 s
  T0 = 1e-10 s
  fclk = 500000000 Hz
  fdata = 10000000 Hz
  assumes: tr/tau &lt;= 700</code></pre>
<p>In the worked example, tr = 2 ns, tau = 50 ps, T0 = 100 ps, fclk = 500000000 Hz, fdata = 10000000 Hz go through the equation above and give MTBF_s = 4.707705337e+11 s, MTBF_years = 14917.81801, log10_MTBF_s = 11.67280927. It applies only when tr/tau &lt;= 700: outside that it says what is wrong instead of returning a number.</p>
<p>Questions and reports: support@ai999x.com. AI999X — The Future Is Self-Improving.</p></body></html>