# Circuit Theory/Simultaneous Equations/Example 1

Find all unknown voltages and currents.

### Label

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

### Loops

There is one loop in this circuit. It is drawn CW, an arrow head put on the line and the symbol $L_{1}$ given to the loop. This symbol will be the name of the loop equation that comes from this arrow.
Next the + and - associated with the voltages are put on the resistors, to indicate the polarity relationships in the circuit (which started with the loop drawn).
It is important to remember that at this point, the + and - along with the loop are capturing circuit topology information. They are not a "guess" of the polarity of the final numeric answers.

### Junctions

There are no junctions in this circuit. There are three trivial junctions, but all three have the same current through them. The current direction was chosen at this point.
The current direction was chosen at this point. Now is when the arrow head indicating direction is put on the drawing. It is not arbitrary. Current has to enter the + of the components and leave the -.
It never matters whether the current leaves or enters the + of the voltage supply, since a voltage supply varies its current depending upon the rest of the circuit.

### Count Eq

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

### Terminal Eq

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

### Loop Eq

There is one loop equation: $L1:v_{R1}+v_{R2}-V_{1}=0$
The source voltage is negative because the loop direction enters the minus terminal of the voltage supply.

### Junction Eq

There are no junctions, therefore there are no junction equations. If one wanted to count the three trivial junctions, there would be three currents: one going through 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). The next example will explore junctions.

### Solve the Equations

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

#### Algebra

Outline of the solution:
* Substitute TR:1 and TR:2 into L1:, solve for unknown $i_{1}$:
* Substitute current solution into TR:1 and TR:2, solve for unknown $v_{R1}v_{R2}$
* Substitute known values in for symbols to get numeric solution
Symbolic solution from algebra:
* $i_{1}={\frac {V_{1}}{R_{1}+R_{2}}}$
* $v_{R1}={\frac {V_{1}*R_{1}}{R_{1}+R_{2}}}$
* $v_{R2}={\frac {V_{1}*R_{2}}{R_{1}+R_{2}}}$
Numeric solution from algebra:
* $i_{1}={\frac {1}{100+100}}={\frac {1}{200}}=0.005amp$
* $v_{R1}={\frac {1*100}{100+100}}={\frac {100}{200}}={\frac {1}{2}}=0.5volt$
* $v_{R2}={\frac {1*100}{100+100}}={\frac {100}{200}}={\frac {1}{2}}=0.5volt$
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? If we have to map our symbols to symbols it understands, why not just use MatLab matrices (linear algebra)?

##### Mathematica

Mathematica is related to Wolfram Alpha (Alpha means first very, rough draft). It works. But look at the solution:
* Had to learn another markup language
* Still has problems with the subscripts
The real question is what can be done with the fewest keystrokes, fewest errors, fewest organizing or mapping of symbols?
Mathematica should be given credit for attempting this type of symbol interpretation and computation. Other packages such as the discontinued "Derive from TI" supported no subscripts. But MathWorks symbol (MuPAD) and numeric (MatLab) provide the best combination at the moment. Wolfram Alpha lowers the starting point for students to begin symbolic computation. The goal here is to figure out where it falls apart. This text will focus on MathWorks products.

##### MuPad

MatLab has a symbolic package that adds symbol support. Start MatLab and then type "MuPad". The above equations can be typed into MuPad and then the equations can be solved with variable symbols, with exact constants, and then with a numeric approximation (decimal places).

#### Numeric Solution

Steps to set up the solution:
* Substitute known values into the equations:
${\begin{cases}TR1:{\text{ }}v_{R1}=100*i_{1}\\TR2:{\text{ }}v_{R2}=100*i_{1}\\L1:{\text{ }}v_{R1}+v_{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_{R1}+0-100*i_{1}=0\\TR2:{\text{ }}0+v_{R2}-100*i_{1}=0\\L1:{\text{ }}v_{R1}+v_{R2}+0=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_{R1}&v_{R2}&i_{1}&=\\\hline 1&0&-100&0\\0&1&-100&0\\1&1&0&1\\\end{array}}$ | $\Rightarrow$ | ${\begin{bmatrix}1&0&-100\\0&1&-100\\1&1&0\end{bmatrix}}$ | $\bullet$ | ${\begin{bmatrix}V_{R1}\\V_{R2}\\i_{1}\end{bmatrix}}$ | = | ${\begin{bmatrix}0\\0\\1\end{bmatrix}}$ |
* enter the matrices into MatLab or similar program
| ${\begin{bmatrix}V_{R1}\\V_{R2}\\i_{1}\end{bmatrix}}$ | = | ${\begin{bmatrix}0.5\\0.5\\0.005\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 is 5ma as predicted. Notice the sign of the current. It changes between - and + 5 ma. It looks positive when entering the top (A) of the resistors where the voltage is positive. This makes the current positive.
Voltages are relative to ground. The voltage at the top of the power supply and top of the resistor are the same because they are part of the same trivial junction. The voltage is 1 volt because it is the voltage across both resistors. The voltage across the bottom resistor is half of this as predicted.
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. Current coming out of the + terminal of anything is negative.
Power Calculation:
Voltage and current are constant.
* $P=i*v$
* $P_{source}+P_{R1}+P_{R2}=0$
* $(-.005)*1+(.005)*.5+(.005)*.5=0$

### Build Intuition

This is a simple circuit demonstrating concepts covered in physics.
* Resistors of equal value in series split the voltage across them.
* Resistors divide up the voltage in series.
* Resistors in series add.