# Circuit Theory/Simultaneous Equations/Example 2

Find all unknown voltages and currents.

### Label

The goal is to label the unknowns and knowns. The original problem has already created the symbols $I1,R1{\text{ and }}R2$ and given them values. They appear to be knowns. The unknowns labeled at this point are $V_{1},i_{R1}{\text{ and }}i_{R2}$.

### Loops

There are two trivial loops in this circuit. There are two components in each loop that share the same voltage $V_{1}$. In fact all three components in the circuit (2 resistors and current source) share the same voltage. Any equations written would have to give each component a separate voltage symbol and then say they equal each other.
Next the + and - associated with the voltage is put near the voltage symbol, even though all three devices share the same polarity.

### Junctions

There are two junctions in the circuit. One bottom junction was labeled with ground. The top was labeled $J_{1}$.
The two current directions were chosen so that the current goes into the + side of passive devices and reactive devices (resistors, capacitors and inductors).
It never matters what the polarity of the voltage is across the current source, since the current source varies the voltage to maintain a constant current.
It is important to remember that the current directions and voltage polarities at this point are capturing the circuit configuration. They are not guesses of the polarity of the final values.

### Count Eq

The first step is to list the variables and whether they are knowns or unknowns. $I_{1}=1amp$ $R_{1}=100ohm$ $R_{2}=50ohm$ $V_{1}=?volt$ $i_{R1}=?amp$ $i_{R2}=?amp$
So there are three unknowns requiring three equations.

### Terminal Eq

There are two devices that terminal equations can be written for: $TR1:v_{1}=i_{R1}*R_{1}$ $TR2:v_{1}=i_{R2}*R_{2}$
There is no terminal equation for a power supply.

### Loop Eq

There are no loops, therefore there are no loop equations. If one wanted to count the three trivial loops, there would be three voltages: one across each of the components (the two resistors and the supply). At this point three trivial equations would have to be written saying they all equaled each other (depending upon direction).

### Junction Eq

There is one junction equation: $J1:{\text{ }}I_{1}-i_{R1}-i_{R2}=0$
The source current is positive the rule "current into the node is positive, current leaving is negative" was used. We could have arrived at the same formula using the opposite logic. Both capture the circuit topology the same way.

### Solve the Equations

The three equations are: ${\begin{cases}TR1:{\text{ }}v_{1}=i_{R1}*R_{1}\\TR2:{\text{ }}v_{1}=i_{R2*}R_{2}\\J1:{\text{ }}I_{1}-i_{R1}-i_{R2}=0\end{cases}}$

#### Algebra

Outline of the solution:
* Solve TR:1 and TR:2 for currents, substitute into L1:, solve for unknown $V_{1}$:
* Substitute current solution into TR:1 and TR:2, solve for unknowns $i_{R1}i_{R2}$
* Substitute known values in for symbols to get numeric solution
Symbolic solution from algebra:
* $v_{1}={\frac {I_{1}}{{\frac {1}{R_{1}}}+{\frac {1}{R_{2}}}}}$
* $i_{R1}={\frac {I_{1}*{\frac {1}{R_{1}}}}{{\frac {1}{R_{1}}}+{\frac {1}{R_{2}}}}}$
* $i_{R1}={\frac {I_{1}*{\frac {1}{R_{2}}}}{{\frac {1}{R_{1}}}+{\frac {1}{R_{2}}}}}$
Numeric solution from algebra:
* $v_{1}={\frac {1}{{\frac {1}{100}}+{\frac {1}{50}}}}={\frac {100}{3}}=33.3volts$
* $i_{R1}={\frac {1*{\frac {1}{100}}}{{\frac {1}{100}}+{\frac {1}{50}}}}={\frac {1}{3}}=0.333amps$
* $i_{R1}={\frac {1*{\frac {1}{50}}}{{\frac {1}{100}}+{\frac {1}{50}}}}={\frac {2}{3}}=0.667amps$
This is a simple problem. But the goal is to practice all of our mathematical tools. One or more of these tools are going to fail us in the future. The goal is to experience success with each of them now, so we know what failure looks like.

#### Differential Equations

There are none in this problem, but three quarters of this course is going over circuits this complex with capacitors and inductors instead of resistors and looking at the differential equations.

#### Symbolic Computations
##### Wolfram Alpha

Click on the above link, and go to the wolfram site, look at the syntax of what was entered and look at the answer. Notice the following:
* Wolfram alpha can not handle 'i', probably thinks it is an imaginary number. Had to switch to k.
* Wolfram alpha can not handle the double subscript, switched from R1 to 2 and R2 to 3.
What is the point of a natural language, symbolic interpreter that can not interpret our symbols? Fortunately MuPad works. In fact it follows the outline of this solution.

##### MuPad

MuPad starts off setting internal symbols equal to presentation symbols. Then it is asked to solve a set of linear equations in terms of a list of unknowns. This gives the solution in variable terms.
MuPAD is then given the values of the constants and asked to re-evaluate the linear equations. This generates the symbolic solution in terms of fractions and symbols like $\pi$.
Finally MuPAD is told to find the numeric answer rather than the symbolic answer. The manuals say this takes longer than doing the equivalent in MatLab.

#### Numeric Solution

Steps to setup the solution:
* Substitute known values into the equations:
${\begin{cases}TR1:{\text{ }}v_{1}=100*i_{R1}\\TR2:{\text{ }}v_{1}=50*i_{R2}\\L1:{\text{ }}1-i_{R1}-i_{R2}-1=0\end{cases}}$
* Organize the equations so that unknowns are in columns, numbers to the right of the equal sign:
${\begin{cases}TR1:{\text{ }}v_{1}-100*i_{R1}+0=0\\TR2:{\text{ }}v_{1}+0-50*i_{R2}=0\\L1:{\text{ }}0+i_{R1}+i_{R2}=1\end{cases}}$
* Create two matrices, one square and the other a column with the numbers that are on the right of the equal sign
| ${\begin{array}{|c|c|c||c|}v_{1}&i_{R1}&i_{R2}&=\\\hline 1&-100&0&0\\1&0&-50&0\\0&1&1&1\\\end{array}}$ | $\Rightarrow$ | ${\begin{bmatrix}1&-100&0\\1&0&-50\\0&1&1\end{bmatrix}}$ | $\bullet$ | ${\begin{bmatrix}v_{1}\\i_{R1}\\i_{R2}\end{bmatrix}}$ | = | ${\begin{bmatrix}0\\0\\1\end{bmatrix}}$ |
* enter the matrices into MatLab or similar program
| ${\begin{bmatrix}v_{1}\\i_{R1}\\i_{R2}\end{bmatrix}}$ | = | ${\begin{bmatrix}33.3\\0.333\\0.667\end{bmatrix}}$ |

### Simulate

The goal is to simulate in www.circuitlab.com. Click on this link and click on the simulate button at the bottom. Move the pen over and around the circuit.
Resistors: The current going into the top (positive) of the 100 ohm and 50 ohm resistors is positive and has the values predicted. The voltage is the value predicted.
Voltages are relative to ground. The voltage at the top of the power supply and top of the resistors is the same because they are all in parallel.
Power Supply: The opposite is true of the power supply. Current is going out of the top (A) of the power supply and is labeled negative, even though the symbol arrow is going up. This is because current coming out of the power supply + terminal (opposite of the resistors). This means the power supply is dumping energy into the circuit.
Power Calculation:
Voltage and current are constant.
* $P=i*v$
* $P_{source}+P_{R1}+P_{R2}=0$
* $(-1)*33.3+(.333)*33.3+(.667)*33.3=0$

### Build Intuition

Resistors don't add in series. They add in this funny manner called "one over one over". Look at the algebra and see this term repeated in the solutions:
${\frac {1}{{\frac {1}{R_{1}}}+{\frac {1}{R_{2}}}}}$
MuPad and Wolfram Alpha do a cross multiplication, and translate it into this. Think of this as an intermediary step in the algebra.
${\frac {R_{1}*R_{2}}{R_{1}+R_{2}}}$
The thing is that if there were three resistors in parallel, the above equation gets complicated. But the "one over one over equation" doesn't. It just expands to this:
${\frac {1}{{\frac {1}{R_{1}}}+{\frac {1}{R_{2}}}+{\frac {1}{R_{3}}}}}$
This is why the concept "resistors add ... one over one over ... for parallel circuits" becomes almost the corollary to "resistors add ... in series ... for series circuits."
Before computers, when all math was done by hand, the "one over one over" concept lead to mistakes. Instead there was another whole layer of circuit analysis that involved another whole set of symbols, units, terminal equations and concepts for parallel circuits called "Admitance. What we are doing instead is the half called "Impedance. And instead of learning another whole layer of circuit analysis, we are spending our time learning to use MatLab and MuPad. The artifact of "one over one over" slips into the vacancy left when "Admitance" is not covered.
The circuit analysis that is not be covered involved using something like a slide ruler as a calculation aid called a "smith chart." As one went through a circuit, one would combine series by adding. To combine in parallel, plot a point on the smith chart, measure the distance to the center, draw a straight line through the center, draw a circle around the center, and where the two lines met, read off the numeric answer. It was a dance. It had a rhythm very different than this one. But it took a lot longer, left a lot more room for mistakes. Smith Charts during WWII were piled up on the floor, scribbled on and then thrown away many times during analysis of a single circuit.