The picture is the result of a a couple of resistance calculations and some plotting with it.

The second picture is of an incredibly powerful calculator, for its day, but not a resistance calculator. It is called the Difference Engine. You can read about it at: http://en.wikipedia.org/wiki/Difference_engine The calculator here for resistance is Python based ( a variant called SageMath ) and is made of software not hardware.

First Picture Calculated with the Resistance calculator, second picture is from: http://commons.wikimedia.org/wiki/File:Difference_engine.JPG

## Step 1: Tools and Materials

The calculator is written in a version of Python, but you do not need Python to run it, the whole computer environment is available for free on the web. What you will need is:The image for this step is from: http://xkcd.com/353/

## Step 2: Electrical Theory

I will not go into the basic electrical theory here but just use the results. Wikipedia has a good discussion of the basic theory:Lets first deal with just resistance ( no capacitance, C, or Inductance, L ). If you have a single resistor with resistance r1 there are two ways you can connect another resistor, r2, either in series or parallel . If you do either one some basic formulas allow you compute the effective resistance of the pair, this is the resistance you would have if you replaced the pair with a single resistor. LRC carries out the calcuation.

Now that the value of LRC is equivalent to one resistor you can repeat the addition of a new resistor.

The methods we have in LRC to do this are called add_serises_r() and add_parallel_r().

What if it is not a resistor but a capacitor? First if we assume a sine wave for the voltage ( which we almost always do ) the resistance depends on the frequency. Second we use complex numbers to represent the resistance ( and if we are careful call it the impedance ). Once we have the complex impedance we can use the same formulas as for resistors. Again this is what LRC does.

In the "real world" physical values are not complex so to interpret the results we often use only the real part or the absolute value, LRC also does this as appropriate. The whole theory is pretty cool, consider learning if if you are not already familiar with it.

The picture is from wikipedia, Maxwell's equations, the basic equations of electromagnetism.

## Step 3: The Two Basic Circuits: Series and Parallel

These 2 circuits are not the most interesting, but they are a good place to start.

To use the calculator you type into an "notebook". This is a bit like a word processor where you can type what you want. The difference is that rather than paragraphs it is divided into "cells". When you are finished with a cell you can "execute" it and its output appears just below the cell. Below that you can have another cell. A cell can be modified and then executed again perhaps with slightly different content. The notebook can be saved as a file.

This may seem a bit cumbersome but is really useful as you always have a record of what you have done, and can copy and paste from old work or sample work. You can also add comments to document your work. I will show you the contents of a cell with lots of comments ( so the explanation is inside the cell ) and then show you the cell output. Note that when you do your calculations you need not be nearly so verbose. ( Lines that begin with "#" are just comments for you and do nothing in the calculator. I will actually write some of this instructable using the comments in the code, please read them. Only 4 of the lines actually do the calculation, the rest are explanation. )

Here goes

-------------------- begin code -------------------- # For the first calculation we will get the total resistance for a resistor # of 1 K ohms in series with one of 10 K ohms # ( and yes I know if you know much electronics you can do this in your head ) print "First Calculation - Add 1K resistor to 10K resistor in series:" print # Step 1 # make a resistor which is the calculator, LRC stands for Inductance, Resistance, # Capacitance, and is # used because the calculator can do all of them. # I will use the long name "aResistor" to remind you what it stands for, # but you could use just "r" # This next line creates a "aResistor" of no value ( technically with a value of None ) # Step 1 aResistor = LRC() print "ignore the print out about frequency, this is only used in more advanced calculations" # Step 2 # we now add a new resistance to our "resistor" aResistor.add_series_r( 1000 ) # add a 1 k ohm resistor # this will cause a output that tells what we did # Step 3 # now add the second resistance, in series with the first aResistor.add_series_r( 10000 ) # 10000 = 10K # this again will cause a output that tells what we did # Step 4 # get the final value for the resistance ( note that z is a general symbol for resistance ) print print "Final value of combined resistance = ", aResistor.get_z( ) # shows the current value for the resistance, just the sum of resistances # final comment suppresses default print at end of cell -------------------- begin output -------------------- First Calculation - Add 1K resistor to 10K resistor in series: LRC() using internal frequency lrc_freq in Hz ignore the print out about frequency, this is only used in more advanced calculations LRC.add_series_r() 1000 LRC.add_series_r() 10000 Final value of combined resistance = 11000 -------------------- end output --------------------We can do the same sort of thing for 2 resistors in parallel we will use 1K and 10K again, here goes:

-------------------- start code -------------------------------- print "Second Calculation - Add 1K resistor to 10K resistor in parallel:" print # ----- # make a "aResistor" which is the calculator aResistor = LRC() # ----- # we now add a resistance to our "resistor" aResistor.add_parallel_r( 1000 ) # this will cause a output that tells what we did, and the current # value for the impedance = resistance # ----- # now add the second resistance, in parallel with the first aResistor.add_parallel_r( 10000 ) # this again will cause a output that tells what we did, and the # ----- print print "Final value of combined resistance = ", aResistor.get_nz( ) # nz in function above pushes full numeric evaluation to a decimal value # thi comment suppress end of cell default print -------------------- start output -------------------------------- Second Calculation - Add 1K resistor to 10K resistor in parallel: LRC() using internal frequency lrc_freq in Hz LRC.add_parallel_r() 1000 LRC.add_parallel_r() 10000 Final value of combined resistance = 909.090909090909 -------------------- end output -------------------------------- A couple of notes on what is going on here.

## Step 4: A More Complicated Circuit

Lets put 3 1.5 K resistors in parallel, then 2 more in series with it.Here is the quick description of the calculation:

here is the code and response.

-------------------- start code -------------------------------- # A More Complicated Circuit # I will give the schematic in ascii characters -- not part of the calculation, # just to help you understand # lots of print statements, not necessary, just to help explain what is going on # print "Third Calculation - example of series and parallel resistor combination:" print print "Calculate resistance from x to x" print print " |-----------1.5K-------------|" print " | |" print "x---|-----------1.5K-----==------|------1.5k------- 1.5K------x" print " | |" print " |-----------1.5K-------------|" print # make the resistor calculator print "Begin..." aResistor = LRC( ) print print "Do the parallel resistors..." print print " |-----------1.5K-------------|" print " | |" print "x---|-----------1.5K-----==------|--" print " | |" print " |-----------1.5K-------------|" print aResistor.add_parallel_r( 1.5e3 ) # 1.5e3 is scientific notation, a shorter way of writing 1500 aResistor.add_parallel_r( 1.5e3 ) aResistor.add_parallel_r( 1.5e3 ) print "and now the two series reisistors " print print " |----------1.5k----------1.5K------|" print print aResistor.add_series_r( 1.5e3 ) aResistor.add_series_r( 1.5e3 ) print # done but a final step using n() print "Final value of combined resistance = ", aResistor.get_nz( ) # suppress end of cell default print -------------------- end code, start output -------------------- Third Calculation - example of series and parallel resistor combination: Calculate resistance from x to x |-----------1.5K-------------| | | x---|-----------1.5K-----==------|------1.5k------- 1.5K------x | | |-----------1.5K-------------| Begin... LRC() using internal frequency lrc_freq in Hz Do the parallel resistors... |-----------1.5K-------------| | | x---|-----------1.5K-----==------|-- | | |-----------1.5K-------------| LRC.add_parallel_r() 1500.00000000000 LRC.add_parallel_r() 1500.00000000000 LRC.add_parallel_r() 1500.00000000000 and now the two series reisistors |----------1.5k----------1.5K------| LRC.add_series_r() 1500.00000000000 LRC.add_series_r() 1500.00000000000 Final value of combined resistance = 3500.00000000000 -------------------- end output --------------------------------

More on What is Going On

The calculator is running in a Python environment called Sage, so the lines you are typing are actually part of an interactive program. You can run this over the web by logging into a free web server at: http://www.sagenb.org/ You will need to register.

Since you are running in Python, all the rules of Python apply; a few to note here to keep you out of trouble:

Python is one of the best current languages, well worth learing.

## Step 5: An Advanced Application

In this application we will show how the calculator can work with algebra as well as numbers, this can be used to find the standard equations for series and parallel circuits or even more complex formulas. The code and output will be the only explanation here, use online resources if you need more info.----------------- start code ----------------- print "Repeat and extend symbolic calculation -- solve for r sub 1" print "Again without much explanation get the formula for 2 resistors in parallel" print # when we do things symbolically we need to define our symbols var("r1") # symbol for resistor 1 var("r2") # symbol for resistor 2 var("r3") # symbol for resistor 3 the combination lrc = LRC() lrc.add_parallel_r( r1 ) lrc.add_parallel_r( r2 ) print print "so the two in parllel are: ", lrc.get_z() print print "Now do some algebra and turn the calculation into an equation for r3" print "then solves for r1 in terms of r3 and r2" # I am not explaining this, but it is just SageMath, look in web references equation = ( r3 == lrc.get_z() ) print equation print print "solving..." solution = equation.solve( r1 ) print( solution ) # show( solution ) gives nicer output, try it ----------------- start output ----------------- Repeat and extend symbolic calculation -- solve for r sub 1 Again without much explanation get the formula for 2 resistors in parallel LRC() using internal frequency lrc_freq in Hz LRC.add_parallel_r() r1 LRC.add_parallel_r() r2 so the two in parllel are: 1/(1/r1 + 1/r2) Now do some algebra and turn the calculation into an equation for r3 then solves for r1 in terms of r3 and r2 r3 == (1/(1/r1 + 1/r2)) solving... [ r1 == r2*r3/(r2 - r3) ] ----------------- end output -----------------

## Step 6: Setting yourself up with the Calculator

Download the file from this instructable ( called "LRC Instructable Files.zip", but the insturctable system may rename it ). It is a zip file with several different worksheets in it. You do not have to unzip it, Sage will do that for you.Go to http://www.sagenb.org/ use" Select an OpenID provider" for a site where you have an account, to log into the notebook. You will be taken to your new account on the notebook server.

Select , and browse to select the file you have saved "LRC Instructable Files.zip" press up "upload".

You will see the worksheet files in the notebok. Click on one to run it, explore the sage environment and the LRC calculator.

Each worksheet is a separate environment but you can run several at once, To make a new worksheet for LRC calculations either copy one then save it under a new name, then you are free to change it. Or make a new blank worksheet and copy the LRC cell from one of the existing worksheets and execute it in the new worksheet.

I have included PDF versions of the worksheets, these cannot calculate, so I would urge you to try the real thing using the Sage Notebook.

LRC Instructable Files.zip69 KB LRC - Instructable -- Sage.pdf140 KB LRC - Examples -- Sage.pdf236 KB

## Step 7: Going Farther

There is much more you can do with this calculator, this instructable is just the real basics. Some of the attached files are effectively instructables on these other features. If you do not want to go to the trouble of running SageMath you can see the input and output of the files in the attached pdf's. Without much explanation you can:I may extend this object to do more in the future. What would you like to see it do? Comment below or email me.