This BASIC code could be modified for pretty much any repetitive formula that crunches four numbers together. The only real pain is keeping track of parenthesis.
I’m sure similar code has been written thousands of times to do the exact same task, but I thought I’d share mine. As it stands, this calculates the “Elasticity Coefficient” of a good or service from one price/quantity point to another price/quantity point. Google can help one find websites that do these calculations, but Google is generally not allowed to be used on tests. The formula used here is the ‘midpoint formula’ of supply or demand elasticity.
Platforms this works on:
- Your web browser.
- TI-83 and perhaps other TI- calculators that use BASIC.
- Android phones.
- Probably a bunch of other things, too. If you port it to something else and it works, please let me know!
Microeconomics Formulas this works for:
- Elasticity Coefficient of Demand
- Elasticity Coefficient of Supply
- Cross-Elasticity of Demand
- Income-Elasticity of Demand
I just added a few lines so that it also spits out the slope of the line at that segment.
It just spits out the numbers, it is up to you to interpret it.
IN YOUR WEB BROWSER
Click here to run elastcal in your web browser. Requires Java. I have not done extensive testing on this version, and it looks like crap. It should still work, though. If you run into errors, please inform me and include as many details as possible.
Once it pops up, click “run” to start.
Point your smartphone’s barcode scanner at the below image to be directed to the website if you wish to attempt to use it on your smartphone.
TI-83s are very crummy computers and BASIC itself is a very crummy language, but that’s the most advanced thing I’m allowed to use on tests in my Economics class.
On your TI-83 press “PRGM” and arrow over to “NEW”. Give it a name, and you should then be faced with a screen containing a “:” in the upper left corner under “Program:”.
Enter these lines of code. For “Disp” or “Input”, you enter that by pressing “PRGM”, arrowing over to “I/O”, selecting either “Disp” or “Input” and hitting enter. Make sure you keep track of parenthesis!
Disp "ELASTCAL V1.0"
Disp "BY C.T. MASON"
Disp "PUBLIC DOMAIN"
Disp " "
Input "OLD QUANT-",A
Input "NEW QUANT-",B
Input "OLD PRICE-",C
Input "NEW PRICE-",D
Disp " "
Disp "SLOPE AT THAT"
I did a simple port to BASIC as implemented on the $0 Android app called “BASIC! + SQL” that you can find in the Android Marketplace. All three methods below work equally well at installing elastcal, pick the one that seems easiest to you.
Method 1 to install:
Install “BASIC! + SQL” on your Android phone from the Android Marketplace, plug your Android phone into your computer click here to download elastcal, and save it to “rfo-basic -> source” on your Android’s MicroSD chip.
Method 2 to install:
If you don’t want to do all that, point your Android phone’s barcode scanner at this, and install it, to get the BASIC interpreter app:
Point your barcode scanner at this for the app I wrote, and download it to the rfo-basic/source folder on your phone’s SD card:
Method 3 to install:
Install the “BASIC! + SQL” app, and enter the source code manually:
print "elastcal v1.0"
print "by C.T. Mason"
print "Released to Public Domain"
input "old quant",a
input "new quant",b
input "old price",c
input "new price",d
print " "
print "elasticity coefficient:"
print "slope of that segment:"
Putting the Icon on your Home Screen:
Long-tap on the home screen to bring up the “Add to Home Screen” dialog.
Select “Launcher Shortcuts” with the telescope icon.
For “Program File Name”, enter “elastcal.bas”.
Leave “Icon File Name” blank.
For “Shortcut Name” enter “elastcal”
Hit “OK”. Hit “OK” again.
Elastcal for cellular phones relies on a piece of Free and Open Source Software covered under the very ethical and reasonable terms of the GNU General Public License, and as such it is not compatible and will never be compatible with the Terms of Service of the Apple App Store unless Apple’s ToS are altered significantly.
The copyright license of the software that makes elastcal work is the GNU GPL v3, and it says this:
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License.
The App Store’s various terms and conditions place significant restrictions on recipients’ rights that are not compatible with the section in bold above. If you would like to see elastcal and “BASIC! + SQL” available natively on Apple devices, please e-mail Steve Jobs ( firstname.lastname@example.org ) and ask him to modify the Terms of Service of the App Store to be more inclusive and open to people with different ethical codes than his own.
If iPhone and iPad web browsers are standards-compliant, then the web based version above should work for you. If not, there isn’t much I can do about the situation.