This repository has been archived by the owner on Nov 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
FormulaPro_fullcode.lua
4723 lines (3943 loc) · 165 KB
/
FormulaPro_fullcode.lua
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
--------------------------
---- FormulaPro 1.42b ----
---- (Nov 11, 2015) ----
---- LGLP 3 License ----
--------------------------
---- Jim Bauwens ----
---- Adrien Bertrand ----
--------------------------
---- TI-Planet.org ----
---- Inspired-Lua.org ----
--------------------------
local utf8 = string.uchar
SubNumbers = {185, 178, 179, 8308, 8309, 8310, 8311, 8312, 8313}
function numberToSub(w, n)
return w .. utf8(SubNumbers[tonumber(n)])
end
Constants = {}
Constants["g" ] = {info="Acceleration due to gravity" , value="9.81" , unit="m*s^-2" }
Constants["mu" ] = {info="Atomic mass unit" , value="1.66 * 10^-27" , unit="kg" }
Constants["u" ] = Constants["mu"]
Constants["N" ] = {info="Avogadro's Number" , value="6.022 * 10^23" , unit="mol^-1" }
Constants["a0" ] = {info="Bohr radius" , value="0.529 * 10^-10" , unit="m" }
Constants["k" ] = {info="Boltzmann constant" , value="1.38 * 10^-23" , unit="J/K^-1" }
Constants["em" ] = {info="Electron charge to mass ratio" , value="-1.7588 * 10^11" , unit="C/kg^-1" }
Constants["re" ] = {info="Electron classical radius" , value="2.818 * 10^-15" , unit="m" }
Constants["mec2" ] = {info="Electron mass energy (J)" , value="8.187 * 10^-14" , unit="J" }
Constants["mec2DUP"] = {info="Electron mass energy (MeV)" , value="0.511" , unit="MeV" }
Constants["me" ] = {info="Electron rest mass" , value="9.109 * 10^-31" , unit="kg" }
Constants["F" ] = {info="Faraday constant" , value="9.649 * 10^4" , unit="C/mol^-1" }
Constants[utf8(945)] = {info="Fine-structure constant" , value="7.297 * 10^-3" , unit=nil }
Constants["R" ] = {info="Gas constant" , value="8.314" , unit="J/((mol^-1)*(K^-1))"}
Constants["G" ] = {info="Gravitational constant" , value="6.67 * 10^-11" , unit="Nm^2/kg^-2" }
Constants["mnc2" ] = {info="Neutron mass energy (J)" , value="1.505 * 10^-10" , unit="J" }
Constants["mnc2DUP"] = {info="Neutron mass energy (MeV)" , value="939.565" , unit="MeV" }
Constants["mn" ] = {info="Neutron rest mass" , value="1.675 * 10^-27" , unit="kg" }
--Constants["mn/me"] = {info="Neutron-electron mass ratio" , value="1838.68" , unit=nil }
--Constants["mn/mp"] = {info="Neutron-proton mass ratio" , value="1.0014" , unit=nil }
Constants[utf8(956).."0"] = {info="Permeability of a vacuum" , value="4*pi * 10^-7" , unit="N/A^-2" }
Constants[utf8(949).."0"] = {info="Permittivity of a vacuum" , value="8.854 * 10^-12" , unit="F/m^-1" }
Constants["h" ] = {info="Planck constant" , value="6.626 * 10^-34" , unit="J/s" }
Constants["mpc2" ] = {info="Proton mass energy (J)" , value="1.503 * 10^-10" , unit="J" }
Constants["mpc2DUP"] = {info="Proton mass energy (MeV)" , value="938.272" , unit="MeV" }
Constants["mp" ] = {info="Proton rest mass" , value="1.6726 * 10^-27" , unit="kg" }
Constants["pe" ] = {info="Proton-electron mass ratio" , value="1836.15" , unit=nil }
Constants["Rbc" ] = {info="Rydberg constant" , value="1.0974 * 10^7" , unit="m^-1" }
Constants["C" ] = {info="Speed of light in vacuum" , value="2.9979 * 10^8" , unit="m/s" }
Constants["q" ] = {info="e elementary charge" , value="1.60218 * 10^-19" , unit="C" }
Constants["pi" ] = {info="PI" , value="pi" , unit=nil }
Constants[utf8(956).."0"] = {info="Magnetic permeability constant" , value="4*pi*10^-7" , unit=nil }
Constants[utf8(960)] = Constants["pi"]
function checkIfExists(table, name)
for k,v in pairs(table) do
if (v.name == name) or (v == name) then -- lulz lua powa
print("Conflict (i.e elements appearing twice) detected when loading Database. Skipping the item.")
return true
end
end
return false
end
function checkIfFormulaExists(table, formula)
for k,v in pairs(table) do
if (v.formula == formula) then -- lulz lua powa
print("Conflict (i.e formula appearing twice) detected when loading Database. Skipping formula.")
return true
end
end
return false
end
Categories = {}
Formulas = {}
function addCat(id,name,info)
if checkIfExists(Categories, name) then
print("Warning ! This category appears to exist already ! Adding anyway....")
end
return table.insert(Categories, id, {id=id, name=name, info=info, sub={}, varlink={}})
end
function addCatVar(cid, var, info, unit)
Categories[cid].varlink[var] = {unit=unit, info=info }
end
function addSubCat(cid, id, name, info)
if checkIfExists(Categories[cid].sub, name) then
print("Warning ! This subcategory appears to exist already ! Adding anyway....")
end
return table.insert(Categories[cid].sub, id, {category=cid, id=id, name=name, info=info, formulas={}, variables={}})
end
function aF(cid, sid, formula, variables) --add Formula
local fr = {category=cid, sub=sid, formula=formula, variables=variables}
-- In times like this we are happy that inserting tables just inserts a reference
-- commented out this check because only the subcategory duplicates should be avoided, and not on the whole db.
--if not checkIfFormulaExists(Formulas, fr.formula) then
table.insert(Formulas, fr)
--end
if not checkIfFormulaExists(Categories[cid].sub[sid].formulas, fr.formula) then
table.insert(Categories[cid].sub[sid].formulas, fr)
end
-- This function might need to be merged with U(...)
for variable,_ in pairs(variables) do
Categories[cid].sub[sid].variables[variable] = true
end
end
function U(...)
local out = {}
for i, p in ipairs({...}) do
out[p] = true
end
return out
end
----------------------------------------------
-- Categories && Sub-Categories && Formulas --
----------------------------------------------
c_O = utf8(963)
c_alpha = utf8(945)
c_beta = utf8(946)
c_delta = utf8(948)
c_epsilon = utf8(949)
c_e = c_epsilon
c_Pi = utf8(960)
c_pi = c_Pi
c_mu = utf8(956)
c_tau = utf8(964)
c_rho = utf8(961)
c_phi = utf8(966)
c_omega = utf8(969)
c_CAPomega = utf8(937)
c_Ohm = c_CAPomega
c_theta = utf8(952)
addCat(1, "Resistive Circuits", "Performs routine calculations of resistive circuits")
addCatVar(1, "A", "Area", "m2")
addCatVar(1, "G", "Conductance", "S")
addCatVar(1, "I", "Current", "A")
addCatVar(1, "Il", "Load current", "A")
addCatVar(1, "Is", "Current source", "A")
addCatVar(1, "len", "Length", "m")
addCatVar(1, "P", "Power", "W")
addCatVar(1, "Pmax", "Maximum power in load", "W")
addCatVar(1, "R", "Resistance", c_CAPomega)
addCatVar(1, "Rl", "Load resistance", c_CAPomega)
addCatVar(1, "Rlm", "Match load resistance", c_CAPomega)
addCatVar(1, "RR1", "Resistance, T1", c_CAPomega)
addCatVar(1, "RR2", "Resistance, T2", c_CAPomega)
addCatVar(1, "Rs", "Source resistance", c_CAPomega)
addCatVar(1, "T1", "Temperature 1", "K")
addCatVar(1, "T2", "Temperature 2", "K")
addCatVar(1, "U", "Voltage", "V")
addCatVar(1, "Vl", "Load voltage", "V")
addCatVar(1, "Vs", "Source voltage", "V")
addCatVar(1, c_alpha, "Temperature coefficient", "1/"..utf8(176).."K")
addCatVar(1, c_rho, "Resistivity", c_CAPomega.."*m")
addCatVar(1, utf8(963), "Conductivity", "S/m")
addSubCat(1, 1, "Resistance Formulas", "")
aF(1, 1, "R=("..c_rho.."*len)/A",U("R",c_rho,"len","A") )
aF(1, 1, "G=("..c_O.."*A)/len",U("G",c_O,"len","A") )
aF(1, 1, "G=1/R", U("G","R"))
aF(1, 1, c_O.."=1/"..c_rho, U(c_O,c_P))
addSubCat(1, 2, "Ohm\'s Law and Power", "")
aF(1, 2, "U=I*R", U("R","U","I") )
aF(1, 2, "P=I*U", U("P","U","I") )
aF(1, 2, "P=(U*U)/R", U("P","U","R") )
aF(1, 2, "P=U*U*G", U("P","U","G") )
aF(1, 2, "R=1/G", U("R","G") )
addSubCat(1, 3, "Temperature Effect", "")
aF(1, 3, "RR2=RR1*(1+"..c_alpha.."*(T2-T1))", U("RR2","RR1","T1", "T2", c_alpha) )
addSubCat(1, 4, "Maximum DC Power Transfer", "")
aF(1, 4, "Vl=(Vs*Rl)/(Rs+Rl)", U("Vl","Vs","Rl","Rs") )
aF(1, 4, "Il=Vs/(Rs+Rl)", U("Il","Rs","Rs","Rl") )
aF(1, 4, "P=Il*Vl", U("P","Il", "Vl") )
aF(1, 3, "Pmax=(Vs*Vs)/(4*Rs)", U("Pmax","Vs","Rs") )
aF(1, 3, "Rlm=Rs", U("Rlm","Rs") )
addSubCat(1, 5, "Voltage and Current Source Equivalence", "")
aF(1, 5, "Is=Vs/Rs", U("Is","Vs","Rs"))
aF(1, 5, "Vs=Is*Rs", U("Vs","Is","Rs"))
addCat(2, "Capacitors, E-Fields", "Compute electric field properties and capacitance of various types\nof structures")
addCatVar(2, "A", "Area", "m2")
addCatVar(2, "C", "Capacitance", "F")
addCatVar(2, "cl", "Capacitance per unit length", "F/m")
addCatVar(2, "d", "Separation", "m")
addCatVar(2, "E", "Electric field", "V/m")
addCatVar(2, "Er", "Radial electric field", "V/m")
addCatVar(2, "Ez", "Electric field along z axis", "V/m")
addCatVar(2, "F", "Force on plate", "N")
addCatVar(2, "Q", "Charge", "C")
addCatVar(2, "r", "Radial distance", "m")
addCatVar(2, "ra", "Inner radius, wire radius", "m")
addCatVar(2, "rb", "Outer radius", "m")
addCatVar(2, "V", "Potential", "V")
addCatVar(2, "Vz", "Potential along z axis", "V")
addCatVar(2, "W", "Energy stored", "J")
addCatVar(2, "z", "z axis distance from disk", "m")
addCatVar(2, c_epsilon.."r", "Relative permittivity", "unitless")
addCatVar(2, c_rho.."l", "Line charge", "C/m")
addCatVar(2, c_rho.."s", "Charge density", "C/m2")
addSubCat(2, 1, "Point Charge", "")
aF(2, 1, "Er=Q/(4*"..c_Pi.."*"..c_e.."0*"..c_e.."r*r^2)", U("Er","Q",c_e.."0",c_e.."r", "r") )
aF(2, 1, "V=Q/(4*"..c_Pi.."*"..c_e.."0*"..c_e.."r*r)", U("V","Q",c_e.."0",c_e.."r", "r") )
addSubCat(2, 2, "Long Charged Line", "")
aF(2, 2, "Er="..c_rho.."l/(2*"..c_Pi.."*"..c_e.."0*"..c_e.."r)", U("Er",c_rho.."l",c_e.."0",c_e.."r") )
addSubCat(2, 3, "Charged Disk", "")
aF(2, 3, "Ez=("..c_rho.."s/(2*"..c_e.."0*"..c_e.."r))*(1-abs(z)/sqrt(ra^2+z^2))", U("Ez",c_rho.."s",c_e.."0",c_e.."r","z","ra") )
aF(2, 3, "Vz=("..c_rho.."s/(2*"..c_e.."0*"..c_e.."r))*(sqrt(ra^2+z^2)-abs(z))", U("Vz",c_rho.."s",c_e.."0",c_e.."r","z","ra") )
addSubCat(2, 4, "Parallel Plates", "")
aF(2, 4, "E=V/d", U("E","V","d"))
aF(2, 4, "C=("..c_e.."0*"..c_e.."r*A)/d", U("C",c_e.."0",c_e.."r","A","d") )
aF(2, 4, "Q=C*V", U("Q","C","V"))
aF(2, 4, "F=-1/2*(V^2*C)/d", U("F","V","C","d") )
aF(2, 4, "W=1/2*V^2*C",U("W","V","C"))
addSubCat(2, 5, "Parallel Wires", "")
aF(2, 5, "cl="..c_Pi.."*"..c_e.."0*"..c_e.."r/arccosh(d/(2*ra))", U("cl",c_e.."0",c_e.."r","d","ra") )
addSubCat(2, 6, "Coaxial Cable", "")
aF(2, 6, "V=("..c_rho.."l/(2*"..c_Pi.."*"..c_e.."0*"..c_e.."r))*ln(rb/ra)", U("V",c_rho.."l",c_e.."0",c_e.."r","ra") )
aF(2, 6, "Er=V/(r*ln(rb/ra))", U("Er","V","r","rb","ra") )
aF(2, 6, "cl=(2*"..c_Pi.."*"..c_e.."0*"..c_e.."r)/ln(rb/ra)", U("cl",c_e.."0",c_e.."r","rb","ra") )
addSubCat(2, 7, "Sphere", "")
aF(2, 7, "V=(Q/(4*"..c_Pi.."*"..c_e.."0*"..c_e.."r))*(1/ra-1/rb)", U("V","Q",c_e.."0",c_e.."r","ra","rb") )
aF(2, 7, "Er=Q/(4*"..c_Pi.."*"..c_e.."0*"..c_e.."r*r^2)", U("Er","Q","r",c_e.."0",c_e.."r") )
aF(2, 7, "C=(4*"..c_Pi.."*"..c_e.."0*"..c_e.."r*ra*rb)/(rb-ra)", U("C",c_e.."0",c_e.."r","rb","ra") )
addCat(3, "Inductors and Magnetism", "Calculate electrical and magnetic properties of physical elements")
addCatVar(3, c_theta, "Angle", "rad")
addCatVar(3, utf8(956).."r", "Relative permeability", "unitless")
addCatVar(3, "a", "Loop radius or side of a rectangular loop", "m")
addCatVar(3, "B", "Magnetic field", "T")
addCatVar(3, "bl", "Width of rectangular loop", "m")
addCatVar(3, "Bx", "Magnetic field, x axis", "T")
addCatVar(3, "By", "Magnetic field, y axis", "T")
addCatVar(3, "D", "Center-center wire spacing", "m")
addCatVar(3, "d", "Strip width", "m")
addCatVar(3, "f", "Frequency", "Hz")
addCatVar(3, "Fw", "Force between wires/unit length", "N/m")
addCatVar(3, "I", "Current", "A")
addCatVar(3, "I1", "Current in line 1", "A")
addCatVar(3, "I2", "Current in line 2", "A")
addCatVar(3, "Is", "Current in strip", "A/m")
addCatVar(3, "L", "Inductance per unit length", "H/m")
addCatVar(3, "L12", "Mutual inductance", "H")
addCatVar(3, "Ls", "Loop self-inductance", "H")
addCatVar(3, "r", "Radial distance", "m")
addCatVar(3, "ra", "Radius of inner conductor", "m")
addCatVar(3, "rb", "Radius of outer conductor", "m")
addCatVar(3, "Reff", "Effective resistance", c_CAPomega) -- in Ohms
addCatVar(3, "rr0", "Wire radius", "m")
addCatVar(3, "T12", "Torque", "N*m")
addCatVar(3, "x", "x axis distance", "m")
addCatVar(3, "y", "y axis distance", "m")
addCatVar(3, "z", "Distance to loop z axis", "m")
addCatVar(3, c_delta, "Skin depth", "m") -- delta
addCatVar(3, c_rho, "Resistivity", c_CAPomega.."*m") -- rho
addSubCat(3, 1, "Long Line", "")
aF(3, 1, "B=("..c_mu.."0*I)/(2*"..c_Pi.."*r)", U("B",c_mu.."0","I","r",c_Pi) )
addSubCat(3, 2, "Long Strip", "")
aF(3, 2, "Bx=((-"..c_mu.."0*Is)/(2*"..c_Pi.."))*(arctan((x+d/2)/y)-arctan((x-d/2)/y))", U("Bx",c_mu.."0","Is","x","d","y") )
aF(3, 2, "By=(("..c_mu.."0*Is)/(4*"..c_Pi.."))*ln((y^2-(x+d/2)^2)/(y^2-(x-d/2)^2))", U("By",c_mu.."0","Is","x","d","y") )
addSubCat(3, 3, "Parallel Wires", "")
aF(3, 3, "Fw=("..c_mu.."0*I1*I2)/(2*"..c_Pi.."*D)", U("Fw",c_mu.."0","I1","I2","D"))
aF(3, 3, "Bx=("..c_mu.."0/(2*"..c_Pi.."))*(I1/x-I2/(D-x))", U("Bx",c_mu.."0","I1","I2","D","x" ))
aF(3, 3, "L=("..c_mu.."0/(4*"..c_Pi.."))+("..c_mu.."0/("..c_Pi.."))*arccosh(D/(2*a))", U("L",c_mu.."0","a","D" ))
addSubCat(3, 4, "Loop", "")
aF(3, 4, "B=("..c_mu.."0*I*a^2)/(2*(sqrt(a^2+z^2))^3)", U("B", c_mu.."0", "I", "a", "z") )
aF(3, 4, "Ls=("..c_mu.."0*a)*(ln(8*a/rr0)-2)", U(c_mu.."0", "a", "rr0") )
aF(3, 4, "L12=("..c_mu.."0*a)*cos("..c_theta..")/(2*"..c_pi..")*ln((bl+d)/d)", U("L12", c_mu.."0", "a", c_theta, c_pi, "bl", "d") )
aF(3, 4, "T12=("..c_mu.."0*a)*sin("..c_theta..")/(2*"..c_pi..")*I1*I2*ln((bl+d)/d)", U("T12", c_mu.."0", "a", c_theta, c_pi, "I1", "I2", "bl", "d") )
addSubCat(3, 5, "Coaxial Cable", "")
aF(3, 5, "L="..c_mu.."0/(8*"..c_pi..")+"..c_mu.."0/(2*"..c_pi..")*ln(rb/ra)", U("L", c_mu.."0", c_pi, "rb", "ra"))
addSubCat(3, 6, "Skin Effect", "")
aF(3, 6, c_delta.."=1/(sqrt(("..c_pi.."*f*"..c_mu.."0*"..c_mu.."r)/"..c_rho.."))", U(c_delta, c_mu.."0", c_mu.."r", c_pi, "f", c_rho))
aF(3, 6, "Reff=sqrt(("..c_pi.."*f*"..c_mu.."0*"..c_mu.."r*"..c_rho.."))", U("Reff", c_mu.."0", c_mu.."r", c_pi, "f", c_rho))
addCat(4, "Electron Motion", "Investigate the trajectories of electrons under the influence \nof electric and magnetic fields")
addCatVar(4, "A0", "Richardson\'s constant", "A/(m2*K2)")
addCatVar(4, "B", "Magnetic field", "T")
addCatVar(4, "d", "Deflection tube diameter, plate spacing", "m")
addCatVar(4, "f", "Frequency", "Hz")
addCatVar(4, "f0", "Critical frequency", "Hz")
addCatVar(4, "I", "Thermionic current", "A")
addCatVar(4, "L", "Deflecting plate length", "m")
addCatVar(4, "Ls", "Beam length to destination", "m")
addCatVar(4, "r", "Radius of circular path", "m")
addCatVar(4, "S", "Surface area", "m2")
addCatVar(4, "T", "Temperature", "K")
addCatVar(4, "v", "Vertical velocity", "m/s")
addCatVar(4, "Va", "Accelerating voltage", "V")
addCatVar(4, "Vd", "Deflecting voltage", "V")
addCatVar(4, "y", "Vertical deflection", "m")
addCatVar(4, "yd", "Beam deflection on screen", "m")
addCatVar(4, "z", "Distance along beam axis", "m")
addCatVar(4, c_phi, "Work function", "V")
addSubCat(4, 1, "Beam Deflection", "")
aF(4, 1, "v=sqrt(2*(q/me)*Va)", U("v","q","me","Va"))
aF(4, 1, "r=me*v/(q*B)", U("r","me","v","q","B"))
aF(4, 1, "yd=L*Ls/(2*d*Va)*Vd", U("yd","L","Ls","d","Va","Vd"))
aF(4, 1, "y=q*Vd/(2*me*d*v^2)*z^2", U("y","q","Vd","me","d","v","z"))
addSubCat(4, 2, "Thermionic Emission", "")
aF(4, 2, "I=A0*S*T^2*exp(-q*"..c_phi.."/(k*T))", U("I","A0","S","T","q",c_phi,"k"))
addSubCat(4, 3, "Photoemission", "")
aF(4, 3, "h*f=q*"..c_phi.."+1/2*me*v^2", U("h","f","q",c_phi,"me","v"))
aF(4, 3, "f0=q*"..c_phi.."/h", U("f0","q",c_phi,"h"))
addCat(5, "Meters and Bridge Circuits", "This category covers a variety of topics on meters, commonly used\nbridge and attenuator circuits")
addCatVar(5, "a", "Resistance multiplier", "unitless")
addCatVar(5, "b", "Resistance Multiplier", "unitless")
addCatVar(5, "c", "Resistance Multiplier", "unitless")
addCatVar(5, "CC3", "Capacitance, arm 3", "F")
addCatVar(5, "CC4", "Capacitance, arm 4", "F")
addCatVar(5, "Cs", "Series capacitor", "F")
addCatVar(5, "Cx", "Unknown capacitor", "F")
addCatVar(5, "DB", "Attenuator loss", "unitless")
addCatVar(5, "f", "Frequency", "Hz")
addCatVar(5, "Ig", "Galvanometer current", "A")
addCatVar(5, "Imax", "Maximum current", "A")
addCatVar(5, "Isen", "Current sensitivity", "A")
addCatVar(5, "Lx", "Unknown inductance", "unitless")
addCatVar(5, "Q", "Quality Factor", "unitless")
addCatVar(5, "Radj", "Adjustable resistor", c_CAPomega)
addCatVar(5, "Rg", "Galvanometer resistance", c_CAPomega)
addCatVar(5, "Rj", "Resistance in L pad", c_CAPomega)
addCatVar(5, "Rk", "Resistance in L pad", c_CAPomega)
addCatVar(5, "Rl", "Resistance from left", c_CAPomega)
addCatVar(5, "Rm", "Meter resistance", c_CAPomega)
addCatVar(5, "Rr", "Resistance from right", c_CAPomega)
addCatVar(5, "RR1", "Resistance, arm 1", c_CAPomega)
addCatVar(5, "RR2", "Resistance, arm 2", c_CAPomega)
addCatVar(5, "RR3", "Resistance, arm 3", c_CAPomega)
addCatVar(5, "RR4", "Resistance, arm 4", c_CAPomega)
addCatVar(5, "Rs", "Series resistance", c_CAPomega)
addCatVar(5, "Rse", "Series resistance", c_CAPomega)
addCatVar(5, "Rsh", "Shunt resistance", "A")
addCatVar(5, "Rx", "Unknown resistance", c_CAPomega)
addCatVar(5, "Vm", "Voltage across meter", "V")
addCatVar(5, "Vmax", "Maximum voltage", "V")
addCatVar(5, "Vs", "Source voltage", "V")
addCatVar(5, "Vsen", "Voltage sensitivity", "V")
addCatVar(5, c_omega, "Radian frequency", "rad/s")
addSubCat(5, 1, "A, V, Omega Meters", "")
aF(5, 1, "Rsh=Rm*Isen/(Imax-Isen)", U("Rsh","Rm","Isen","Imax"))
aF(5, 1, "Rs=(Vmax-Vsen)/Isen", U("Rs","Vmax","Vsen","Isen"))
aF(5, 1, "Isen=Vs/(Rs+Rm+Radj/2)", U("Isen","Vs","Rs","Rm","Radj"))
addSubCat(5, 2, "Wheatstone Bridge", "")
aF(5, 2, "Rx/RR2=RR3/RR4", U("Rx","RR2","RR3","RR4"))
aF(5, 2, "Vm=eegalv(Rx,RR2,RR3,RR4,Rg,Rs,Vs)", U("Vm","Rx","RR2","RR3","RR4","Rg","Rs","Vs"))
aF(5, 2, "Ig=Vm/Rg", U("Ig","Vm","Rg"))
addSubCat(5, 3, "Wien Bridge", "")
aF(5, 3, "Cx=((RR3/RR1)-(Rs/Rx))*Cs", U("Cx","RR3","RR1","Rs","Rx","Cs"))
aF(5, 3, "Cx=1/("..c_omega.."^2*Rs*Rx*Cs)", U("Cx",c_omega,"Rs","Rx","Cs"))
aF(5, 3, "f=1/(2/"..c_Pi.."*Cs*Rs)", U("f","Cs","Rs"))
aF(5, 3, c_omega.."=2*"..c_Pi.."*f", U(c_omega,"f"))
addSubCat(5, 4, "Maxwell Bridge", "")
aF(5, 4, "Cx=((RR3/RR1)-(Rs/Rx))*Cs", U("Cx","RR3","RR1","Rs","Rx","Cs"))
aF(5, 4, "Cx=1/("..c_omega.."^2*Rs*Rx*Cs)", U("Cx",c_omega,"Rs","Rx","Cs"))
aF(5, 4, "f=1/(2/"..c_Pi.."*Cs*Rs)", U("f","Cs","Rs"))
aF(5, 4, c_omega.."=2*"..c_Pi.."*f", U(c_omega,"f"))
addSubCat(5, 5, "Owen Bridge", "")
aF(5, 5, "Lx=CC3*RR1*RR4", U("Lx","CC3","RR1","RR4"))
aF(5, 5, "Rx=CC3*RR1/CC4-RR2", U("Rx","CC3","RR1","CC4","RR2"))
addSubCat(5, 6, "Symmetrical Resistive Attenuator", "")
aF(5, 6, "a=(10^(DB/20)-1)/(10^(DB/20)+1)", U("a","DB"))
aF(5, 6, "b=2*10^(DB/20)/(10^(DB/10)-1)", U("b","DB"))
aF(5, 6, "c=(10^(DB/20)-1)", U("c","DB"))
addSubCat(5, 7, "Unsymmetrical Resistive Attenuator", "")
aF(5, 7, "Rj=Rl-Rk*Rr/(Rk+Rr)", U("Rj","Rl","Rk","Rr"))
aF(5, 7, "Rk=sqrt(Rl*Rr^2/(Rl-Rr))", U("Rk","Rl","Rr"))
aF(5, 7, "DB=20*LOG(sqrt((Rl-Rr)/Rr)+sqrt(Rl/Rr))", U("DB","Rl","Rr"))
addCat(6, "RL and RC Circuits", "Compute the natural and transient properties of simple RL\nand RC circuits")
addCatVar(6, "C", "Capacitor", "F")
addCatVar(6, "Cs", "Series capacitance", "F")
addCatVar(6, "Cp", "Parallel capacitance", "F")
addCatVar(6, "f", "Frequency", "Hz")
addCatVar(6, "iC", "Capacitor current", "A")
addCatVar(6, "iL", "Inductor current", "A")
addCatVar(6, "I0", "Initial inductor current", "A")
addCatVar(6, "L", "Inductance", "H")
addCatVar(6, "Lp", "Parallel inductance", "H")
addCatVar(6, "Ls", "Series inductance", "H")
addCatVar(6, "Qp", "Q, parallel circuit", "unitless")
addCatVar(6, "Qs", "Q, series circuit", "unitless")
addCatVar(6, "R", "Resistance", c_CAPomega)
addCatVar(6, "Rp", "Parallel resistance", c_CAPomega)
addCatVar(6, "Rs", "Series resistance", c_CAPomega)
addCatVar(6, c_tau, "Time constant", "s")
addCatVar(6, "t", "Time", "s")
addCatVar(6, "vC", "Capacitor voltage", "V")
addCatVar(6, "vL", "Inductor voltage", "V")
addCatVar(6, "V0", "Initial capacitor voltage", "V")
addCatVar(6, "Vs", "Voltage stimulus", "V")
addCatVar(6, c_omega, "Radian frequency", "rad/s") -- lowercase omega
addCatVar(6, "W", "Energy dissipated", "J")
addSubCat(6, 1, "RL Natural Response", "")
aF(6, 1, c_tau.."=L/R", U(c_tau,"L","R"))
aF(6, 1, "vL=I0*R*exp(-t/"..c_tau..")", U("vL","I0","R","t",c_tau))
aF(6, 1, "iL=I0*exp(-t/"..c_tau..")", U("iL","I0","t",c_tau))
aF(6, 1, "W=1/2*L*I0^2*(1-exp(-2*t/"..c_tau.."))", U("W","L","I0","t",c_tau))
addSubCat(6, 2, "RC Natural Response", "")
aF(6, 2, c_tau.."=R*C", U(c_tau,"R","C"))
aF(6, 2, "vC=V0*exp(-t/"..c_tau..")", U("vC","V0","t",c_tau))
aF(6, 2, "iC=V0/R*exp(-t/"..c_tau..")", U("iC","V0","R","t",c_tau))
aF(6, 2, "W=1/2*C*V0^2*(1-exp(-2*t/"..c_tau.."))", U("W","C","V0","t",c_tau))
addSubCat(6, 3, "RL Step Response", "")
aF(6, 3, c_tau.."=L/R", U(c_tau,"L","R"))
aF(6, 3, "vL=(Vs-I0*R)*exp(-t/"..c_tau..")", U("vL","Vs","I0","R","t",c_tau))
aF(6, 3, "iL=Vs/R+(I0-Vs/R)*exp(-t/"..c_tau..")", U("iL","Vs","R","I0","t",c_tau))
addSubCat(6, 4, "RC Step Response", "")
aF(6, 4, c_tau.."=R*C", U(c_tau,"R","C"))
aF(6, 4, "vC=Vs+(V0-Vs)*exp(-t/"..c_tau..")", U("vC","Vs","V0","t",c_tau))
aF(6, 4, "iC=(Vs-V0)/R*exp(-t/"..c_tau..")", U("iC","Vs","V0","R","t",c_tau))
addSubCat(6, 5, "RL Series-Parallel", "")
aF(6, 5, c_omega.."=2*"..c_Pi.."*f", U(c_omega,"f"))
aF(6, 5, "Qs="..c_omega.."*Ls/Rs", U("Qs",c_omega,"Ls","Rs"))
aF(6, 5, "Rp=(Rs^2+"..c_omega.."^2*Ls^2)/Rs", U("Rp","Rs",c_omega,"Ls"))
aF(6, 5, "Lp=(Rs^2+"..c_omega.."^2*Ls^2)/("..c_omega.."^2*Ls)", U("Lp","Rs",c_omega,"Ls"))
aF(6, 5, "Qp=Rp/("..c_omega.."*Lp)", U("Qp","Rp",c_omega,"Lp"))
aF(6, 5, "Rs="..c_omega.."^2*Lp^2*Rp/(Rp^2+"..c_omega.."^2*Lp^2)", U("Rs",c_omega,"Lp","Rp"))
aF(6, 5, "Ls=Rp^2*Lp/(Rp^2+"..c_omega.."^2*Lp^2)", U("Ls","Rp","Lp",c_omega))
aF(6, 5, "Rp=Rs*(1+Qs^2)", U("Rp","Rs","Qs"))
aF(6, 5, "Lp=Ls*(1+1/Qs^2)", U("Lp","Ls","Qs"))
aF(6, 5, "Rs=Rp/(1+Qp^2)", U("Rs","Rp","Qp"))
aF(6, 5, "Ls=Qp^2*Lp/(1+Qp^2)", U("Ls","Qp","Lp"))
addSubCat(6, 6, "RC Series-Parallel", "")
aF(6, 6, c_omega.."=2*"..c_Pi.."*f", U(c_omega,"f"))
aF(6, 6, "Qs=1/("..c_omega.."*Rs*Cs)", U("Qs",c_omega,"Rs","Cs"))
aF(6, 6, "Rp=Rs*(1+1/("..c_omega.."^2*Rs^2*Cs^2))", U("Rp","Rs",c_omega,"Cs"))
aF(6, 6, "Cp=Cs/(1+"..c_omega.."^2*Cs^2*Rs^2)", U("Cp","Cs",c_omega,"Rs"))
aF(6, 6, "Qp="..c_omega.."*Rp*Cp", U("Qp",c_omega,"Rp","Cp"))
aF(6, 6, "Rs=Rp/(1+"..c_omega.."^2*Rp^2*Cp^2)", U("Rs","Rp",c_omega,"Cp"))
aF(6, 6, "Cs=(1+"..c_omega.."^2*Rp^2*Cp^2)/("..c_omega.."^2*Rp^2*Cp)", U("Cs",c_omega,"Rp","Cp"))
aF(6, 6, "Rp=Rs*(1+Qs^2)", U("Rp","Rs","Qs"))
aF(6, 6, "Cp=Cs/(1+1/Qs^2)", U("Cp","Cs","Qs"))
aF(6, 6, "Rs=Rp/(1+Qp^2)", U("Rs","Rp","Qp"))
aF(6, 6, "Cs=Cp*(1+Qp^2)/Qp^2", U("Cs","Cp","Qp"))
addCat(7, "RLC Circuits", "Compute the impedance, admittance, natural response and\ntransient behavior of RLC circuits")
addCatVar(7, c_alpha, "Neper\'s frequency", "rad/s") --alpha, apostrophe
addCatVar(7, "A1", "Constant", "V")
addCatVar(7, "A2", "Constant", "V")
addCatVar(7, "B", "Susceptance", "S")
addCatVar(7, "B1", "Constant", "V")
addCatVar(7, "B2", "Constant", "V")
addCatVar(7, "BC", "Capacitive susceptance", "S")
addCatVar(7, "BL", "Inductive susceptance", "S")
addCatVar(7, "C", "Capacitance", "F")
addCatVar(7, "D1", "Constant", "V/s")
addCatVar(7, "D2", "Constant", "V")
addCatVar(7, "f", "Frequency", "Hz")
addCatVar(7, "G", "Conductance", "S")
addCatVar(7, "I0", "Initial inductor current", "A")
addCatVar(7, "L", "Inductance", "H")
addCatVar(7, c_theta, "Phase angle", "rad") --theta
addCatVar(7, "R", "Resistance", c_CAPomega)
addCatVar(7, "s1", "Characteristic frequency", "rad/s")
addCatVar(7, "s2", "Characteristic frequency", "rad/s")
addCatVar(7, "s1i", "Characteristic frequency (imaginary)", "rad/s")
addCatVar(7, "s1r", "Characteristic frequency (real)", "rad/s")
addCatVar(7, "s2i", "Characteristic frequency (imaginary)", "rad/s")
addCatVar(7, "s2r", "Characteristic frequency (real)", "rad/s")
addCatVar(7, "t", "Time", "s")
addCatVar(7, "v", "Capacitor voltage", "V")
addCatVar(7, "V0", "Initial capacitor voltage", "V")
addCatVar(7, c_omega, "Radian Frequency", "rad/s") -- lowercase omega
addCatVar(7, c_omega.."d", "Damped radian frequency", "rad/s")
addCatVar(7, c_omega.."0", "Classical radian frequency", "rad/s")
addCatVar(7, "X", "Reactance", c_CAPomega)
addCatVar(7, "XXC", "Capacitive reactance", c_CAPomega)
addCatVar(7, "XL", "Inductive reactance", c_CAPomega)
addCatVar(7, "Ym", "Admittance "..utf8(8211).." magnitude", "S")
addCatVar(7, "Zm", "Impedance "..utf8(8211).." magnitude", "S")
addSubCat(7, 1, "Series Impedance", "")
aF(7, 1, "abs(Zm)^2=R^2+X^2", U("Zm","R","X"))
aF(7, 1, c_theta.."=arctan(X/R)", U(c_theta,"X","R"))
aF(7, 1, "X=XL+XXC", U("X","XL","XXC"))
aF(7, 1, "XL="..c_omega.."*L", U("XL",c_omega,"L"))
aF(7, 1, "XXC=-1/("..c_omega.."*C)", U("XXC",c_omega,"C"))
aF(7, 1, c_omega.."=2*"..c_Pi.."*f", U(c_omega,"f"))
addSubCat(7, 2, "Parallel Admittance", "")
aF(7, 2, "abs(Ym)^2=G^2+B^2", U("Ym","G","B"))
aF(7, 2, c_theta.."=arctan(G/B)", U(c_theta,"G","B"))
aF(7, 2, "G=1/R", U("G","R"))
aF(7, 2, "B=BL+BC", U("B","BL","BC"))
aF(7, 2, "BL=-1/("..c_omega.."*L)", U("BL",c_omega,"L"))
aF(7, 2, "BC="..c_omega.."*C", U("BC",c_omega,"C"))
aF(7, 2, c_omega.."=2*"..c_Pi.."*f", U(c_omega,"f"))
addSubCat(7, 3, "RLC Natural Response", "")
aF(7, 3, "s1r=real(-"..c_alpha.."+sqrt("..c_alpha.."^2-"..c_omega.."0^2))", U("s1r",c_alpha,c_omega.."0"))
aF(7, 3, "s1i=imag(-"..c_alpha.."+sqrt("..c_alpha.."^2-"..c_omega.."0^2))", U("s1i",c_alpha,c_omega.."0"))
aF(7, 3, "s2r=real(-"..c_alpha.."-sqrt("..c_alpha.."^2-"..c_omega.."0^2))", U("s2r",c_alpha,c_omega.."0"))
aF(7, 3, "s2i=imag(-"..c_alpha.."-sqrt("..c_alpha.."^2-"..c_omega.."0^2))", U("s2i",c_alpha,c_omega.."0"))
aF(7, 3, c_omega.."0=sqrt(1/(L*C))", U(c_omega.."0","L","C"))
aF(7, 3, c_alpha.."=1/(2*R*C)", U(c_alpha,"R","C"))
addSubCat(7, 4, "Underdamped Transient Case", "")
aF(7, 4, c_omega.."0=sqrt(1/(L*C))", U(c_omega.."0","L","C"))
aF(7, 4, c_alpha.."=1/(2*R*C)", U(c_alpha,"R","C"))
aF(7, 4, c_omega.."d=sqrt("..c_omega.."0^2-"..c_alpha.."^2)", U(c_omega.."d",c_omega.."0",c_alpha))
aF(7, 4, "v=B1*exp(-"..c_alpha.."*t)*cos("..c_omega.."d*t)+B2*exp(-"..c_alpha.."*t)*sin("..c_omega.."d*t)", U("v","B1",c_alpha,"t",c_omega.."d","B2"))
aF(7, 4, "B1=V0", U("B1","V0"))
aF(7, 4, "B2=-"..c_alpha.."/"..c_omega.."d*(V0-2R*I0)", U("B2",c_alpha,c_omega.."d","V0","R","I0"))
addSubCat(7, 5, "Critically-Damped Transient Case", "")
aF(7, 5, c_alpha.."=1/(2*R*C)", U(c_alpha,"R","C"))
aF(7, 5, c_omega.."0=sqrt(1/(L*C))", U(c_omega.."0","L","C"))
aF(7, 5, "v=D1*t*exp(-"..c_alpha.."*t)+D2*exp(-"..c_alpha.."*t)", U("v","D1","t",c_alpha,"D2"))
aF(7, 5, "D1=I0/C+"..c_alpha.."*V0", U("D1","I0","C",c_alpha,"V0"))
aF(7, 5, "D2=V0", U("D2","V0"))
addSubCat(7, 6, "Overdamped Transient Case", "")
aF(7, 6, "s1=-"..c_alpha.."+sqrt("..c_alpha.."^2-"..c_omega.."0^2)", U("s1",c_alpha,c_omega.."0"))
aF(7, 6, "s2=-"..c_alpha.."-sqrt("..c_alpha.."^2-"..c_omega.."0^2)", U("s2",c_alpha,c_omega.."0"))
aF(7, 6, c_omega.."0=1/sqrt(L*C)", U(c_omega.."0","L","C"))
aF(7, 6, c_alpha.."=1/(2*R*C)", U(c_alpha,"R","C"))
aF(7, 6, "v=A1*exp(s1*t)+A2*exp(s2*t)", U("v","A1","s1","t","A2","s2"))
aF(7, 6, "A1=(V0*s2+1/C*(V0/R+I0))/(s2-s1)", U("A1","V0","s2","C","R","I0","s1"))
aF(7, 6, "A2=-(V0*s1+1/C*(V0/R+I0))/(s2-s1)", U("A2","V0","s1","C","R","I0","s2"))
addCat(8, "AC Circuits", "Calculate properties of AC circuits")
addCatVar(8, "C", "Capacitance", "F")
addCatVar(8, "f", "Frequency", "Hz")
addCatVar(8, "I", "Instantaneous current", "A")
addCatVar(8, "Im", "Current amplitude", "A")
addCatVar(8, "L", "Inductance", "H")
addCatVar(8, c_theta, "Impedance phase angle", "rad")
addCatVar(8, c_theta.."1", "Phase angle 1", "rad")
addCatVar(8, c_theta.."2", "Phase angle 2", "rad")
addCatVar(8, "R", "Resistance", c_CAPomega)
addCatVar(8, "RR1", "Resistance 1", c_CAPomega)
addCatVar(8, "RR2", "Resistance 2", c_CAPomega)
addCatVar(8, "t", "Time", "s")
addCatVar(8, "V", "Total voltage", "V")
addCatVar(8, "VC", "Voltage across capacitor", "V")
addCatVar(8, "VL", "Voltage across inductor", "V")
addCatVar(8, "Vm", "Maximum voltage", "V")
addCatVar(8, "VR", "Voltage across resistor", "V")
addCatVar(8, c_omega, "Radian frequency", "rad/s")
addCatVar(8, "X", "Reactance", c_CAPomega)
addCatVar(8, "XX1", "Reactance 1", c_CAPomega)
addCatVar(8, "XX2", "Reactance 2", c_CAPomega)
addCatVar(8, "Yc", "Admittance", "S")
addCatVar(8, "Z1m", "Impedance 1 magnitude", c_CAPomega)
addCatVar(8, "Z2m", "Impedance 2 magnitude", c_CAPomega)
addCatVar(8, "Zc", "Complex impedance", c_CAPomega)
addCatVar(8, "Zm", "Impedance magnitude", c_CAPomega)
addSubCat(8, 1, "RL Series Impedance", "")
aF(8, 1, "I=Im*sin("..c_omega.."*t)", U("I","Im",c_omega,"t"))
aF(8, 1, "abs(Zm)^2=R^2+"..c_omega.."^2*L^2", U("Zm","R",c_omega,"L"))
aF(8, 1, "VR=Zm*Im*sin("..c_omega.."*t)*cos("..c_theta..")", U("VR","Zm","Im",c_omega,"t",c_theta))
aF(8, 1, "VL=Zm*Im*cos("..c_omega.."*t)*sin("..c_theta..")", U("VL","Zm","Im",c_omega,"t",c_theta))
aF(8, 1, "V=VR+VL", U("V","VR","VL"))
aF(8, 1, "Vm=Im*Zm", U("Vm","Im","Zm"))
aF(8, 1, c_theta.."=arctan("..c_omega.."*L/R)", U(c_theta,c_omega,"L","R"))
aF(8, 1, c_omega.."=2*"..c_Pi.."*f", U(c_omega,"f"))
addSubCat(8, 2, "RC Series Impedance", "")
aF(8, 2, "I=Im*sin("..c_omega.."*t)", U("I","Im",c_omega,"t"))
aF(8, 2, "abs(Zm)^2=R^2+1/("..c_omega.."*C)^2", U("Zm","R",c_omega,"C"))
aF(8, 2, "VR=Zm*Im*sin("..c_omega.."*t)*cos("..c_theta..")", U("VR","Zm","Im",c_omega,"t",c_theta))
aF(8, 2, "VC=Zm*Im*cos("..c_omega.."*t)*sin("..c_theta..")", U("VC","Zm","Im",c_omega,"t",c_theta))
aF(8, 2, "V=VR+VC", U("V","VR","VC"))
aF(8, 2, "Vm=Im*Zm", U("Vm","Im","Zm"))
aF(8, 2, c_theta.."=arctan(-1/("..c_omega.."*C*R))", U(c_theta,c_omega,"C","R"))
aF(8, 2, c_omega.."=2*"..c_Pi.."*f", U(c_omega,"f"))
addSubCat(8, 3, "Impedance <-> Admittance", "")
aF(8, 3, "Yc=1/Zc", U("Yc", "Zc"))
addSubCat(8, 4, "Two Impedances in Series", "")
aF(8, 4, "abs(Zm)^2=R^2+X^2", U("Zm","R","X"))
aF(8, 4, c_theta.."=arctan(X/R)", U(c_theta,"X","R"))
aF(8, 4, "R=RR1+RR2", U("R","RR1","RR2"))
aF(8, 4, "X=XX1+XX2", U("X","XX1","XX2"))
aF(8, 4, "abs(Z1m)^2=RR1^2+XX1^2", U("Z1m","RR1","XX1"))
aF(8, 4, "abs(Z2m)^2=RR2^2+XX2^2", U("Z2m","RR2","XX2"))
aF(8, 4, c_theta.."1=arctan(XX1/RR1)", U(c_theta.."1","XX1","RR1"))
aF(8, 4, c_theta.."2=arctan(XX2/RR2)", U(c_theta.."2","XX2","RR2"))
addSubCat(8, 5, "Two Impedances in Parallel", "")
aF(8, 5, "abs(Zm)^2=((RR1*RR2-XX1*XX2)^2+(RR1*XX2+RR2*XX1)^2)/((RR1+RR2)^2+(XX1+XX2)^2)", U("Zm","RR1","RR2","XX1","XX2"))
aF(8, 5, c_theta.."=arctan((XX1*RR2+RR1*XX2)/(RR1*RR2-XX1*XX2))-arctan((XX1+XX2)/(RR1+RR2))", U(c_theta,"XX1","RR2","RR1","XX2"))
aF(8, 5, "R=Zm*cos("..c_theta..")", U("R","Zm",c_theta))
aF(8, 5, "X=Zm*sin("..c_theta..")", U("X","Zm",c_theta))
aF(8, 5, "abs(Z1m)^2=RR1^2+XX1^2", U("Z1m","RR1","XX1"))
aF(8, 5, "abs(Z2m)^2=RR2^2+XX2^2", U("Z2m","RR2","XX2"))
aF(8, 5, c_theta.."1=arctan(XX1/RR1)", U(c_theta.."1","XX1","RR1"))
aF(8, 5, c_theta.."2=arctan(XX2/RR2)", U(c_theta.."2","XX2","RR2"))
addCat(9, "Polyphase Circuits", "")
addCatVar(9, "IL", "Line current", "A")
addCatVar(9, "Ip", "Phase current", "A")
addCatVar(9, "P", "Power per phase", "W")
addCatVar(9, "PT", "Total power", "W")
addCatVar(9, c_theta, "Impedance angle", "rad")
addCatVar(9, "VL", "Line voltage", "V")
addCatVar(9, "Vp", "Phase voltage", "V")
addCatVar(9, "W1", "Wattmeter 1", "W")
addCatVar(9, "W2", "Wattmeter 2", "W")
addSubCat(9, 1, "Balanced Delta Network", "")
aF(9, 1, "VL=Vp", U("VL","Vp"))
aF(9, 1, "IL=sqrt(3)*Ip", U("IL","Ip"))
aF(9, 1, "P=Vp*Ip*cos("..c_theta..")", U("P","Vp","Ip",c_theta))
aF(9, 1, "PT=3*Vp*Ip*cos("..c_theta..")", U("PT","Vp","Ip",c_theta))
aF(9, 1, "PT=sqrt(3)*VL*IL*cos("..c_theta..")", U("PT","VL","IL",c_theta))
addSubCat(9, 2, "Balanced Wye Network", "")
aF(9, 2, "VL=sqrt(3)*Vp", U("VL","Vp"))
aF(9, 2, "IL=Ip", U("IL","Ip"))
aF(9, 2, "P=Vp*Ip*cos("..c_theta..")", U("P","Vp","Ip",c_theta))
aF(9, 2, "PT=3*Vp*Ip*cos("..c_theta..")", U("PT","Vp","Ip",c_theta))
aF(9, 2, "PT=sqrt(3)*VL*IL*cos("..c_theta..")", U("PT","VL","IL",c_theta))
addSubCat(9, 3, "Power Measurements", "")
aF(9, 3, "W1=VL*IL*cos("..c_theta.."+"..c_Pi.."/6)", U("W1","VL","IL",c_theta,c_Pi))
aF(9, 3, "W2=VL*IL*cos("..c_theta.."-"..c_Pi.."/6)", U("W2","VL","IL",c_theta,c_Pi))
aF(9, 3, "PT=sqrt(3)*VL*IL*cos("..c_theta..")", U("PT","VL","IL",c_theta))
addCat(10, "Electrical Resonance", "")
addCatVar(10, c_alpha, "Damping coefficient", "rad/s")
addCatVar(10, c_beta, "Bandwidth", "rad/s")
addCatVar(10, "C", "Capacitance", "F")
addCatVar(10, "Im", "Current", "A")
addCatVar(10, "L", "Inductance", "H")
addCatVar(10, c_theta, "Phase angle", "rad")
addCatVar(10, "Q", "Quality factor", "unitless")
addCatVar(10, "R", "Resistance", c_CAPomega)
addCatVar(10, "Rg", "Generator resistance", c_CAPomega)
addCatVar(10, "Vm", "Maximum voltage", "V")
addCatVar(10, c_omega, "Radian frequency", "rad/s")
addCatVar(10, c_omega.."0", "Resonant frequency", "rad/s")
addCatVar(10, c_omega.."1", "Lower cutoff frequency", "rad/s")
addCatVar(10, c_omega.."2", "Upper cutoff frequency", "rad/s")
addCatVar(10, c_omega.."d", "Damped resonant frequency", "rad/s")
addCatVar(10, c_omega.."m", "Frequency for maximum amplitude", "rad/s")
addCatVar(10, "Yres", "Admittance at resonance", "S")
addCatVar(10, "Z", "Impedance", c_CAPomega)
addCatVar(10, "Zres", "Impedance at resonance", c_CAPomega)
addSubCat(10, 1, "Parallel Resonance I", "")
aF(10, 1, "Vm=Im/sqrt(1/R^2+("..c_omega.."*C-1/("..c_omega.."*L))^2)", U("Vm","Im","R",c_omega,"C","L"))
aF(10, 1, c_theta.."=arctan(("..c_omega.."*C-1/("..c_omega.."*L))*R)", U(c_theta,c_omega,"C","L","R"))
aF(10, 1, c_omega.."0=1/sqrt(L*C)", U(c_omega.."0","L","C"))
aF(10, 1, c_omega.."1=-1/(2*R*C)+sqrt(1/(2*R*C)^2+1/(L*C))", U(c_omega.."1","R","C","L"))
aF(10, 1, c_omega.."2= 1/(2*R*C)+sqrt(1/(2*R*C)^2+1/(L*C))", U(c_omega.."2","R","C","L"))
aF(10, 1, c_beta.."="..c_omega.."2-"..c_omega.."1", U(c_beta,c_omega.."2",c_omega.."1"))
aF(10, 1, "Q="..c_omega.."0/"..c_beta, U("Q",c_omega.."0",c_beta))
aF(10, 1, "Q=R*sqrt(C/L)", U("Q","R","C","L"))
aF(10, 1, "Q="..c_omega.."0*R*C", U("Q",c_omega.."0","R","C"))
addSubCat(10, 2, "Parallel Resonance II", "")
aF(10, 2, "Q="..c_omega.."0/"..c_beta, U("Q",c_omega.."0",c_beta))
aF(10, 2, c_omega.."1="..c_omega.."0*(-1/(2*Q)+sqrt(1/(2*Q)^2+1))", U(c_omega.."1",c_omega.."0","Q"))
aF(10, 2, c_omega.."2="..c_omega.."0*( 1/(2*Q)+sqrt(1/(2*Q)^2+1))", U(c_omega.."2",c_omega.."0","Q"))
aF(10, 2, c_alpha.."=1/(2*R*C)", U(c_alpha,"R","C"))
aF(10, 2, c_alpha.."="..c_omega.."0/(2*Q)", U(c_alpha,c_omega.."0","Q"))
aF(10, 2, c_omega.."d=sqrt("..c_omega.."0^2-"..c_alpha.."^2)", U(c_omega.."d",c_omega.."0",c_alpha))
aF(10, 2, c_omega.."d="..c_omega.."0*sqrt(1-1/(4*Q^2))", U(c_omega.."d",c_omega.."0","Q"))
addSubCat(10, 3, "Resonance in a Lossy Inductor", "")
aF(10, 3, c_omega.."0=sqrt(1/(L*C)-(R/L)^2)", U(c_omega.."0","L","C","R"))
aF(10, 3, "Yres=(L+Rg*R*C)/(L*Rg)", U("Yres","L","Rg","R","C"))
aF(10, 3, "Zres=1/Yres", U("Zres","Yres"))
aF(10, 3, c_omega.."m=sqrt(sqrt((1/(L*C))^2*(1+2*R/Rg)+(R/L)^2*(2/(L*C)))-(R/L)^2)", U(c_omega.."m","L","C","R","Rg"))
addSubCat(10, 4, "Series Resonance", "")
aF(10, 4, c_omega.."0=(1/sqrt(L*C))", U(c_omega.."0","L","C"))
aF(10, 4, "Z=sqrt(R^2+("..c_omega.."*L-1/("..c_omega.."*C))^2)", U("Z","R",c_omega,"L","C"))
aF(10, 4, c_theta.."=arctan(("..c_omega.."*L-1/("..c_omega.."*C))/R)", U(c_theta,c_omega,"L","C","R"))
aF(10, 4, c_omega.."1=-R/(2*L)+sqrt((R/(2*L))^2+1/(L*C))", U(c_omega.."1","R","L","C"))
aF(10, 4, c_omega.."2=R/(2*L)+sqrt((R/(2*L))^2+1/(L*C))", U(c_omega.."2","R","L","C"))
aF(10, 4, c_beta.."="..c_omega.."2-"..c_omega.."1", U(c_beta,c_omega.."2",c_omega.."1"))
aF(10, 4, c_beta.."=R/L", U(c_beta,"R","L"))
aF(10, 4, "Q="..c_omega.."0*L/R", U("Q",c_omega.."0","L","R"))
aF(10, 4, "Q=1/R*sqrt(L/C)", U("Q","R","L","C"))
addCat(11, "OpAmp Circuits", "")
addCatVar(11, "Acc", "Common Mode current gain", "unitless", "")
addCatVar(11, "Aco", "Common Mode gain from real OpAmp", "unitless")
addCatVar(11, "Ad", "Differential mode gain", "unitless")
addCatVar(11, "Agc", "Transconductance", "S")
addCatVar(11, "Aic", "Current gain", "unitless")
addCatVar(11, "Av", "Voltage gain", "unitless")
addCatVar(11, "CC1", "Input capacitor", "F")
addCatVar(11, "Cf", "Feedback capacitor", "F")
addCatVar(11, "CMRR", "CM rejection ratio", "unitless")
addCatVar(11, "Cp", "Bypass capacitor", "F")
addCatVar(11, "fcp", "3dB bandwidth, circuit", "Hz")
addCatVar(11, "fd", "Characteristic frequency", "Hz")
addCatVar(11, "f0", "Passband, geometric center", "Hz")
addCatVar(11, "fop", "3dB bandwidth, OpAmp", "Hz")
addCatVar(11, "IIf", "Maximum current through Rf", "A")
addCatVar(11, "RR1", "Input resistor", c_CAPomega)
addCatVar(11, "RR2", "Current stabilizor", c_CAPomega)
addCatVar(11, "RR3", "Feedback resistor", c_CAPomega)
addCatVar(11, "RR4", "Resistor", c_CAPomega)
addCatVar(11, "Rf", "Feedback resistor", c_CAPomega)
addCatVar(11, "Rin", "Input resistance", c_CAPomega)
addCatVar(11, "Rl", "Load resistance", c_CAPomega)
addCatVar(11, "Ro", "Output resistance, OpAmp", c_CAPomega)
addCatVar(11, "Rout", "Output resistance", c_CAPomega)
addCatVar(11, "Rp", "Bias current resistor", c_CAPomega)
addCatVar(11, "Rs", "Voltage divide resistor", c_CAPomega)
addCatVar(11, "tr", "10-90% rise time", "s")
addCatVar(11, "dVH", "Hysteresis", "V")
addCatVar(11, "VL", "Detection threshold, low", "V")
addCatVar(11, "Vomax", "Maximum circuit output", "V")
addCatVar(11, "VR", "Reference voltage", "V")
addCatVar(11, "Vrate", "Maximum voltage rate", "V/s")
addCatVar(11, "VU", "Detection threshold, high", "V")
addCatVar(11, "Vz1", "Zener breakdown 1", "V")
addCatVar(11, "Vz2", "Zener breakdown 2", "V")
addSubCat(11, 1, "Basic Inverter", "")
aF(11, 1, "Av=-Rf/RR1", U("Av","Rf","RR1"))
aF(11, 1, "Rp=RR1*Rf/(RR1+Rf)", U("Rp","RR1","Rf"))
aF(11, 1, "fcp=fop*Av*(RR1/Rf)", U("fcp","fop","Av","RR1","Rf"))
aF(11, 1, "tr=0.35*Rf/(fop*Av*RR1)", U("tr","Rf","fop","Av","RR1"))
addSubCat(11, 2, "Non-Inverting Amplifier", "")
aF(11, 2, "Av=1+Rf/RR1", U("Av","Rf","RR1"))
aF(11, 2, "Rp=RR1*Rf/(RR1+Rf)", U("Rp","RR1","Rf"))
addSubCat(11, 3, "Current Amplifier", "")
aF(11, 3, "Aic=(Rs+Rf)*Av/(Rl+Ro+Rs*(1+Av))", U("Aic","Rs","Rf","Av","Rl","Ro"))
aF(11, 3, "Rin=Rf/(1+Av)", U("Rin","Rf","Av"))
aF(11, 3, "Rout=Rs*(1+Av)", U("Rout","Rs","Av"))
addSubCat(11, 4, "Transconductance Amplifier", "")
aF(11, 4, "Agc=1/Rs", U("Agc","Rs"))
aF(11, 4, "Rout=Rs*(1+Av)", U("Rout","Rs","Av"))
addSubCat(11, 5, "Level Detector (Inverting)", "")
aF(11, 5, "RR1=Rp*Rf/(Rp+Rf)", U("RR1","Rp","Rf"))
aF(11, 5, "dVH=(Vz1+Vz2)*Rp/(Rp+Rf)", U("dVH","Vz1","Vz2","Rp","Rf"))
aF(11, 5, "VU=(VR*Rf+Rp*Vz1)/(Rf+Rp)", U("VU","VR","Rf","Rp","Vz1"))
aF(11, 5, "VL=(VR*Rf-Rp*Vz2)/(Rf+Rp)", U("VL","VR","Rf","Rp","Vz2"))
addSubCat(11, 6, "Level Detector (Non-inverting)", "")
aF(11, 6, "RR1=Rp*Rf/(Rp+Rf)", U("RR1","Rp","Rf"))
aF(11, 6, "dVH=(Vz1+Vz2)*Rp/(Rp+Rf)", U("dVH","Vz1","Vz2","Rp","Rf"))
aF(11, 6, "VU=(VR*(Rf+Rp)+Rp*Vz2)/Rf", U("VU","VR","Rf","Rp","Vz2"))
aF(11, 6, "VL=(VR*(Rp+Rf)-Rp*Vz1)/Rf", U("VL","VR","Rp","Rf","Vz1"))
addSubCat(11, 7, "Differentiator", "")
aF(11, 7, "Rf=Vomax/IIf", U("Rf","Vomax","IIf"))
aF(11, 7, "Rp=Rf", U("Rp","Rf"))
aF(11, 7, "CC1=Vomax/(Rf*Vrate)", U("CC1","Vomax","Rf","Vrate"))
aF(11, 7, "RR1=1/(2*"..c_Pi.."*fd*CC1)", U("RR1","fd","CC1"))
aF(11, 7, "fd=1/(2*"..c_Pi.."*Rf*CC1)", U("fd","Rf","CC1"))
aF(11, 7, "Cp=10/(2*"..c_Pi.."*f0*Rp)", U("Cp","f0","Rp"))
aF(11, 7, "Cf=1/(4*"..c_Pi.."*f0*Rf)", U("Cf","f0","Rf"))
addSubCat(11, 8, "Differential Amplifier", "")
aF(11, 8, "Ad=RR3/RR1", U("Ad","RR3","RR1"))
aF(11, 8, "Aco=RR3^2/(RR1*(RR1+RR3)*CMRR)", U("Aco","RR3","RR1","CMRR"))
aF(11, 8, "Ad=(Av*RR3)/sqrt(RR1^2*Av^2+RR3^2)", U("Ad","Av","RR3","RR1"))
aF(11, 8, "Acc=(RR4*RR1-RR2*RR3)/(RR1*(RR2+RR4))", U("Acc","RR4","RR1","RR2","RR3"))
addCat(12, "Solid State Devices", "")
addCatVar(12, c_alpha, "CB current gain", "unitless")
addCatVar(12, "aLGJ", "Linearly graded junction parameter", "1/m4")
addCatVar(12, "A", "Area", "m2")
addCatVar(12, "A1", "EB junction area", "m2")
addCatVar(12, "A2", "CB junction area", "m2")
addCatVar(12, c_alpha.."f", "Forward "..c_alpha, "unitless")
addCatVar(12, "Aj", "Junction area", "m2")
addCatVar(12, c_alpha.."r", "Reverse "..c_alpha, "unitless")
addCatVar(12, c_beta, "CE current gain", "unitless")
addCatVar(12, "b", "Channel width", "m")
addCatVar(12, c_beta.."f", "Forward "..c_beta, "unitless")
addCatVar(12, c_beta.."r", "Reverse "..c_beta, "unitless")
addCatVar(12, "Cj", "Junction capacitance", "F")
addCatVar(12, "CL", "Load capacitance", "F")
addCatVar(12, "Cox", "Oxide capacitance per unit area", "F/m2")
addCatVar(12, "D", "Diffusion coefficient", "m2/s")
addCatVar(12, "DB", "Base diffusion coefficient", "m2/s")
addCatVar(12, "DC", "Collector diffusion coefficient", "m2/s")
addCatVar(12, "DE", "Emitter diffusion coefficient", "m2/s")
addCatVar(12, "Dn", "n diffusion coefficient", "m2/s")
addCatVar(12, "Dp", "p diffusion coefficient", "m2/s")
addCatVar(12, c_epsilon.."ox", "Oxide permittivity", "unitless")
addCatVar(12, c_epsilon.."s", "Silicon Permittivity", "unitless")
addCatVar(12, "Ec", "Conduction band", "J")
addCatVar(12, "EF", "Fermi level", "J")
addCatVar(12, "Ei", "Intrinsic Fermi level", "J")
addCatVar(12, "Ev", "Valence band", "J")
addCatVar(12, "ffmax", "Maximum frequency", "Hz")
addCatVar(12, utf8(947), "Body coefficient", "V5")
addCatVar(12, "gd", "Drain conductance", "S")
addCatVar(12, "gm", "Transconductance", "S")
addCatVar(12, "gmL", "Transconductance, load device", "S")
addCatVar(12, "Go", "Conductance", "S")
addCatVar(12, "I", "Junction current", "A")
addCatVar(12, "I0", "Saturation current", "A")
addCatVar(12, "IB", "Base current", "A")
addCatVar(12, "IC", "Collector current", "A")
addCatVar(12, "ICB0", "CB leakage, E open", "A")
addCatVar(12, "ICE0", "CE leakage, B open", "A")
addCatVar(12, "ICsat", "Collector I at saturation edge", "A")
addCatVar(12, "ID", "Drain current", "A")
addCatVar(12, "IDmod", "Channel modulation drain current", "A")
addCatVar(12, "ID0", "Drain current at zero bias", "A")
addCatVar(12, "IDsat", "Drain saturation current", "A")
addCatVar(12, "IE", "Emitter current", "A")
addCatVar(12, "IIf", "Forward current", "A")
addCatVar(12, "Ir", "Reverse current", "A")
addCatVar(12, "Ir0", "E-M reverse current component", "A")
addCatVar(12, "IRG", "G-R current", "A")
addCatVar(12, "IRG0", "Zero bias G-R current", "A")
addCatVar(12, "Is", "Saturation current", "A")
addCatVar(12, utf8(955), "Modulation parameter", "1/V")
addCatVar(12, "Is", "Saturation current", "A")
addCatVar(12, "kD", "MOS constant, driver", "A/V2")
addCatVar(12, "kL", "MOS constant, load", "A/V2")
addCatVar(12, "kn", "MOS constant", "A/V2")
addCatVar(12, "kn1", "MOS process constant", "A/V2")
addCatVar(12, "kN", "MOS constant, n channel", "A/V2")
addCatVar(12, "kP", "MOS constant, p channel", "A/V2")
addCatVar(12, "KR", "Ratio", "unitless")
addCatVar(12, "L", "Transistor length", "m")
addCatVar(12, "LC", "Diffusion length, collector", "m")
addCatVar(12, "LD", "Drive transistor length", "m")
addCatVar(12, "LE", "Diffusion length, emitter", "m")
addCatVar(12, "LL", "Load transistor length", "m")
addCatVar(12, "LLn", "Diffusion length, n", "m")
addCatVar(12, "lNN", "n-channel length", "m")
addCatVar(12, "Lp", "Diffusion length, p", "m")
addCatVar(12, "lP", "p-channel length", "m")
addCatVar(12, c_mu.."n", "n (electron) mobility", "m2/(V*s)")
addCatVar(12, c_mu.."p", "p (positive charge) mobility", "m2/(V*s)")
addCatVar(12, "mn", "n effective mass", "unitless")
addCatVar(12, "mp", "p effective mass", "unitless")
addCatVar(12, "N", "Doping concentration", "1/m3")
addCatVar(12, "Na", "Acceptor density", "1/m3")
addCatVar(12, "nC", "n density, collector", "1/m3")
addCatVar(12, "Nd", "Donor density", "1/m3")
addCatVar(12, "nE", "n density, emitter", "1/m3")
addCatVar(12, "ni", "Intrinsic density", "1/m3")
addCatVar(12, "N0", "Surface concentration", "1/m3")
addCatVar(12, "npo", "n density in p material", "1/m3")
addCatVar(12, "p", "p density", "1/m3")
addCatVar(12, "pB", "p density, base", "1/m3")
addCatVar(12, c_phi.."F", "Fermi potential", "V")
addCatVar(12, c_phi.."GC", "Work function potential", "V")
addCatVar(12, "pno", "p density in n material", "1/m3")
addCatVar(12, "Qtot", "Total surface impurities", "unitless")
addCatVar(12, "Qb", "Bulk charge at bias", "C/m2")
addCatVar(12, "Qb0", "Bulk charge at 0 bias", "C/m2")
addCatVar(12, "Qox", "Oxide charge density", "C/m2")
addCatVar(12, "Qsat", "Base Q, transition edge", "C")
addCatVar(12, c_rho.."n", "n resistivity", c_CAPomega.."*m")
addCatVar(12, c_rho.."p", "p resistivity", c_CAPomega.."*m")
addCatVar(12, "Rl", "Load resistance", c_CAPomega)
addCatVar(12, c_tau.."B", "lifetime in base", "s")
addCatVar(12, c_tau.."D", "Time constant", "s")
addCatVar(12, c_tau.."L", "Time constant", "s")
addCatVar(12, c_tau.."o", "Lifetime", "s")
addCatVar(12, c_tau.."p", "Minority carrier lifetime", "s")
addCatVar(12, c_tau.."t", "Base transit time", "s")
addCatVar(12, "t", "Time", "s")
addCatVar(12, "TT", "Temperature", "K")
addCatVar(12, "tch", "Charging time", "s")
addCatVar(12, "tdis", "Discharge time", "s")
addCatVar(12, "tox", "Gate oxide thickness", "m")
addCatVar(12, "tr", "Collector current rise time", "s")
addCatVar(12, "ts", "Charge storage time", "s")
addCatVar(12, "tsd1", "Storage delay, turn off", "s")
addCatVar(12, "tsd2", "Storage delay, turn off", "s")
addCatVar(12, "Ttr", "Transit time", "s")
addCatVar(12, "V1", "Input voltage", "V")
addCatVar(12, "Va", "Applied voltage", "V")
addCatVar(12, "Vbi", "Built-in voltage", "V")
addCatVar(12, "VBE", "BE bias voltage", "V")
addCatVar(12, "VCB", "CB bias voltage", "V")
addCatVar(12, "VCC", "Collector supply voltage", "V")
addCatVar(12, "VCEs", "CE saturation voltage", "V")
addCatVar(12, "VDD", "Drain supply voltage", "V")
addCatVar(12, "VDS", "Drain voltage", "V")
addCatVar(12, "VDsat", "Drain saturation voltage", "V")
addCatVar(12, "VEB", "EB bias voltage", "V")
addCatVar(12, "VG", "Gate voltage", "V")
addCatVar(12, "VGS", "Gate to source voltage", "V")
addCatVar(12, "VIH", "Input high", "V")
addCatVar(12, "Vin", "Input voltage", "V")
addCatVar(12, "VIL", "Input low voltage", "V")
addCatVar(12, "VL", "Load voltage", "V")
addCatVar(12, "VM", "Midpoint voltage", "V")
addCatVar(12, "VOH", "Output high", "V")
addCatVar(12, "VOL", "Output low", "V")
addCatVar(12, "Vo", "Output voltage", "V")
addCatVar(12, "Vp", "Pinchoff voltage", "V")
addCatVar(12, "VSB", "Substrate bias", "V")
addCatVar(12, "VT", "Threshold voltage", "V")
addCatVar(12, "VT0", "Threshold voltage at 0 bias", "V")
addCatVar(12, "VTD", "Depletion transistor threshold", "V")
addCatVar(12, "VTL", "Load transistor threshold", "V")
addCatVar(12, "VTL0", "Load transistor threshold", "V")
addCatVar(12, "VTN", "n channel threshold", "V")
addCatVar(12, "VTP", "p channel threshold", "V")
addCatVar(12, "W", "MOS transistor width", "m")
addCatVar(12, "WB", "Base width", "m")
addCatVar(12, "WD", "Drive transistor width", "m")
addCatVar(12, "WL", "Load transistor width", "m")
addCatVar(12, "WN", "n-channel width", "m")
addCatVar(12, "WP", "p-channel width", "m")
addCatVar(12, "x", "Depth from surface", "m")
addCatVar(12, "xd", "Depletion layer width", "m")
addCatVar(12, "xn", "Depletion width, n side", "m")
addCatVar(12, "xp", "Depletion width, p side", "m")
addCatVar(12, "Z", "JFET width", "m")
addSubCat(12, 1, "Semiconductor Basics", "")
aF(12, 1, c_rho.."n=1/(q*"..c_mu.."n*Nd)", U(c_rho.."n","q",c_mu.."n","Nd"))
aF(12, 1, c_rho.."p=1/(q*"..c_mu.."p*Na)", U(c_rho.."p","q",c_mu.."p","Na"))
aF(12, 1, "Dn=((k*TT)/q)*"..c_mu.."n", U("Dn","k","TT","q",c_mu.."n"))
aF(12, 1, "Dp=((k*TT)/q)*"..c_mu.."p", U("Dp","k","TT","q",c_mu.."p"))
aF(12, 1, "Ei=EF+(k*TT*ln(Na/ni(TT)))", U("Ei","EF","k","TT","Na"))
aF(12, 1, "EF=Ei+(k*TT*ln(Nd/ni(TT)))", U("EF","Ei","k","TT","Nd"))
aF(12, 1, "Ei=(Ec+Ev)/2+3/4*(k*TT)*ln(mp/mn)", U("Ei","Ec","Ev","k","TT","mp","mn"))
aF(12, 1, "N/N0=erfc(x/(2*sqrt(D*t)))", U("N","N0","x","D","t"))
aF(12, 1, "N=Qtot/(A*sqrt("..c_Pi.."*D*t))*exp(-x^2/(4*D*t))", U("N","Qtot","A","D","t","x"))
addSubCat(12, 2, "PN Junctions", "")
aF(12, 2, "Vbi=k*TT/q*ln(Nd*Na/ni(TT)^2)", U("Vbi","k","TT","q","Nd","Na"))
aF(12, 2, "xn=sqrt(2*"..c_epsilon.."s*"..c_epsilon.."0*abs(Vbi-Va)*Na/(q*Nd*(Na+Nd)))", U("xn",c_epsilon.."s",c_epsilon.."0","Vbi","Va","Na","q","Nd"))
aF(12, 2, "xp=(Nd/Na)*xn", U("xp","Nd","Na","xn"))
aF(12, 2, "xd=xn+xp", U("xd","xn","xp"))
aF(12, 2, "Cj="..c_epsilon.."s*"..c_epsilon.."0*Aj/xd", U("Cj",c_epsilon.."s",c_epsilon.."0","Aj","xd"))
aF(12, 2, "Vbi=2*k*TT/q*ln(aLGJ*xd/(2*ni(TT)))", U("Vbi","k","TT","q","aLGJ","xd"))
aF(12, 2, "xd=(12*"..c_epsilon.."s*"..c_epsilon.."0/(q*aLGJ)*abs(Vbi-Va))^(1/3)", U("xd",c_epsilon.."s",c_epsilon.."0","q","aLGJ","Vbi","Va"))