ClearAll["Global`*"] (* First side of Class #4 worksheet *)
R1=20.0;R2=30.0;R3=15.0;R4=25.0;R5=10.0;R6=20.0;
v0=10.0;i0=0.03;
vsize=4;  (* There are 4 unknown voltages? *)
(* In this example, the outputs are in this order: v1,v2,v3,v4,i1,i2,i3,i4,i5,i6,i7 *)
matrix1=(({{1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0}, {-1, 1, 0, 0, -R1, 0, 0, 0, 0, 0, 0}, {1, 0, 0, -1, 0, -R2, 0, 0, 0, 0, 0}, {0, -1, 1, 0, 0, 0, -R3, 0, 0, 0, 0}, {0, 0, -1, 1, 0, 0, 0, -R4, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0, -R5, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 0, -R6, 0}, {0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1}, {0, 0, 0, 0, -1, 0, 1, 0, -1, 0, 0}, {0, 0, 0, 0, 0, 0, -1, 1, 0, -1, -1}, {0, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0}}));constants=(({{v0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {i0}}));
results=Inverse[matrix1].constants//Flatten;
csize=Length[results]-vsize; (* Discovers that there are 7 unknown currents *)
v= Part[results, 1;;vsize]; (* extract 4 voltages *)
c = Part[results, vsize+1;;Length[results]]; (*extract remaining solved currents *)
Print["The Voltages v1, v2, v3, and v4 = ",v//MatrixForm] 
Print["The currents i1, i2, i3, i4, i5, i6, and i7 = ",c//MatrixForm ]