Pages created and updated by
Terry Sturtevant
Date Posted:
June 5, 2017
bash-4.1$ maxima Maxima 5.25.1 http://maxima.sourceforge.net using Lisp CLISP 2.49 (2010-07-07) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1)
(%i1) solve([-i_1*r_1+i_3*r_3=-v_1,
-i_2*r_2-i_3*r_3=-v_2,
-i_1+i_2-i_3=0
], [i_1,i_2,i_3]);
r_3 v_2 + (r_3 + r_2) v_1 r_3 v_2 + r_1 v_2 + r_3 v_1
(%o1) [[i_1 = -------------------------, i_2 = ---------------------------,
(r_2 + r_1) r_3 + r_1 r_2 (r_2 + r_1) r_3 + r_1 r_2
r_2 v_1 - r_1 v_2
i_3 = - -------------------------]]
(r_2 + r_1) r_3 + r_1 r_2
The solve command usually gives a set of
solutions to a single function, so by making the set of equations into a
vector, then the solution becomes a single vector.
r_3 v_2 + (r_3 + r_2) v_1 r_3 v_2 + r_1 v_2 + r_3 v_1
(%o1) [[i_1 = -------------------------, i_2 = ---------------------------,
(r_2 + r_1) r_3 + r_1 r_2 (r_2 + r_1) r_3 + r_1 r_2
r_2 v_1 - r_1 v_2
i_3 = - -------------------------]]
(r_2 + r_1) r_3 + r_1 r_2
(%i2) %o1[1];
r_3 v_2 + (r_3 + r_2) v_1 r_3 v_2 + r_1 v_2 + r_3 v_1
(%o2) [i_1 = -------------------------, i_2 = ---------------------------,
(r_2 + r_1) r_3 + r_1 r_2 (r_2 + r_1) r_3 + r_1 r_2
r_2 v_1 - r_1 v_2
i_3 = - -------------------------]
(r_2 + r_1) r_3 + r_1 r_2
This ability to recall previous results is very useful,
and we'll use it a lot.
r_3 v_2 + (r_3 + r_2) v_1 r_3 v_2 + r_1 v_2 + r_3 v_1
(%o2) [i_1 = -------------------------, i_2 = ---------------------------,
(r_2 + r_1) r_3 + r_1 r_2 (r_2 + r_1) r_3 + r_1 r_2
r_2 v_1 - r_1 v_2
i_3 = - -------------------------]
(r_2 + r_1) r_3 + r_1 r_2
(%i3) %o1[1][1];
r_3 v_2 + (r_3 + r_2) v_1
(%o3) i_1 = -------------------------
(r_2 + r_1) r_3 + r_1 r_2
(In other words, we're selecting the 1st element of the first
solution vector.)
(%i3) %o1[1][1]; r_3 v_2 + (r_3 + r_2) v_1 (%o3) i_1 = ------------------------- (r_2 + r_1) r_3 + r_1 r_2 (%i4) v_r1: %o3*r_1; r_1 (r_3 v_2 + (r_3 + r_2) v_1) (%o4) i_1 r_1 = ------------------------------- (r_2 + r_1) r_3 + r_1 r_2
(%i4) v_r1: %o3*r_1; r_1 (r_3 v_2 + (r_3 + r_2) v_1) (%o4) i_1 r_1 = ------------------------------- (r_2 + r_1) r_3 + r_1 r_2 (%i5) %o1,v_1=5,v_2=12,r_1=1000,r_2=2700,r_3=4300; 433 851 3 (%o5) [[i_1 = -----, i_2 = ------, i_3 = - -----]] 93050 186100 37220
(%i5) %o1,v_1=5,v_2=12,r_1=1000,r_2=2700,r_3=4300; 433 851 3 (%o5) [[i_1 = -----, i_2 = ------, i_3 = - -----]] 93050 186100 37220 (%i6) save("test",all); (%o6) /home/terry/maxima/test
(%o6) /home/terry/maxima/test
(%i7) quit();
bash-4.1$ maxima
Maxima 5.25.1 http://maxima.sourceforge.net
using Lisp CLISP 2.49 (2010-07-07)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) load("test");
(%o6) test
Notice that the statement number has jumped ahead; all of the
statements from the previous session have been included in
this one.
(%i1) load("test"); (%o6) test (%i7) %o1; r_3 v_2 + (r_3 + r_2) v_1 r_3 v_2 + r_1 v_2 + r_3 v_1 (%o7) [[i_1 = -------------------------, i_2 = ---------------------------, (r_2 + r_1) r_3 + r_1 r_2 (r_2 + r_1) r_3 + r_1 r_2 r_2 v_1 - r_1 v_2 i_3 = - -------------------------]] (r_2 + r_1) r_3 + r_1 r_2 (%i8) %o5; 433 851 3 (%o8) [[i_1 = -----, i_2 = ------, i_3 = - -----]] 93050 186100 37220
(%o8) [[i_1 = -----, i_2 = ------, i_3 = - -----]]
93050 186100 37220
(%i9) %o1, v_1=5, v_2=12, r_1=1e3, r_2=2.7e3, r_3=4.3e3;
(%o9) [[i_1 = .004653412144008598, i_2 = .004572810317033852,
i_3 = - 8.060182697474475E-5]]
(%o9) [[i_1 = .004653412144008598, i_2 = .004572810317033852,
i_3 = - 8.060182697474475E-5]]
(%i10) %o1, r_1=z_1, r_2=z_2, r_3=z_3;
v_1 (z_3 + z_2) + v_2 z_3 v_2 z_3 + v_1 z_3 + v_2 z_1
(%o10) [[i_1 = -------------------------, i_2 = ---------------------------,
(z_2 + z_1) z_3 + z_1 z_2 (z_2 + z_1) z_3 + z_1 z_2
v_1 z_2 - v_2 z_1
i_3 = - -------------------------]]
(z_2 + z_1) z_3 + z_1 z_2
v_1 (z_3 + z_2) + v_2 z_3 v_2 z_3 + v_1 z_3 + v_2 z_1
(%o10) [[i_1 = -------------------------, i_2 = ---------------------------,
(z_2 + z_1) z_3 + z_1 z_2 (z_2 + z_1) z_3 + z_1 z_2
v_1 z_2 - v_2 z_1
i_3 = - -------------------------]]
(z_2 + z_1) z_3 + z_1 z_2
(%i11) rhs(%o1[1][1]);
r_3 v_2 + (r_3 + r_2) v_1
(%o11) -------------------------
(r_2 + r_1) r_3 + r_1 r_2
r_3 v_2 + (r_3 + r_2) v_1
(%o3) i_1 = -------------------------
(r_2 + r_1) r_3 + r_1 r_2
(%i4) v_r1: %o3*r_1;
r_1 (r_3 v_2 + (r_3 + r_2) v_1)
(%o4) i_1 r_1 = -------------------------------
(r_2 + r_1) r_3 + r_1 r_2
so we can do this:
(%i12) %o4,v_1=5,v_2=12,r_1=1000,r_2=2700,r_3=4300;
8660
(%o12) 1000 i_1 = ----
1861
This may look odd at first, but realize that the right hand
side of the
equation gives the value of VR1.
(%i13) v_r1,v_1=5,v_2=12,r_1=1000,r_2=2700,r_3=4300;
8660
(%o13) 1000 i_1 = ----
1861
since we defined VR1 as a variable
in %i4.
Wilfrid Laurier University
© 2019 Wilfrid Laurier University