forked from tedyapo/maxima-circuits
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircuitsLH.mac
56 lines (33 loc) · 1.13 KB
/
circuitsLH.mac
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
/* [wxMaxima: input start ] */
load("circuits.mac")$
/* [wxMaxima: input end ] */
/* [wxMaxima: comment start ]
Add arbitary length list of resistances together.
[wxMaxima: comment end ] */
/* [wxMaxima: input start ] */
rT([x]) := lsum(i,i,x) $
/* [wxMaxima: input end ] */
/* [wxMaxima: comment start ]
Current through resistor
[wxMaxima: comment end ] */
/* [wxMaxima: input start ] */
rI(v, r) := v/r$
/* [wxMaxima: input end ] */
/* [wxMaxima: comment start ]
Voltage across resistor
[wxMaxima: comment end ] */
/* [wxMaxima: input start ] */
rV(i,r) := i*r$
/* [wxMaxima: input end ] */
/* [wxMaxima: comment start ]
Voltage across a single resistor in a divider.
[wxMaxima: comment end ] */
/* [wxMaxima: input start ] */
vDiv(v,rt,r) := rV( rI(v ,rt), r)$
/* [wxMaxima: input end ] */
/* [wxMaxima: comment start ]
Voltage across each resistor in a divider consisting of an arbitary length list of resistors.
[wxMaxima: comment end ] */
/* [wxMaxima: input start ] */
vDivm(v,[r]) := map( lambda([r1],vDiv(v, apply(rT,r), r1)),r)$
/* [wxMaxima: input end ] */