During my freshman year of college, I was running low on money and wanted to get a job that had flexible enough hours for me to focus on school. After an anthropomorphically-named company reached out to me and told me I was the kind of student they were looking for to tutor students in the Chicago area, I was instantly excited and ran to complete my profile. Weeks went by and I had yet to receive any offers despite all of the offers I had indicated I was interested in. Desperate for some sort of opportunity, I decided to write a blog post for the company to help boost my profile.
They didn’t publish it… until now.
15 months later.
I now have a job that has flexible hours and is able to support me getting groceries each month and the
occasional excessive Taco Bell. And guess what? That job is most definitely not from that company.
Why? Because Frog Tutoring is a scam ☕️
here’s that post:
Hacking Your Math Class with Computer Science – Programming the Quadratic Formula on Your Calculator!
Imagine this: you’re sitting in physics class with only one more question on your test. There’s only three minutes left on the clock, and you’re working on a killer kinematics problem. Just as the clock ticks down to the last minute, you simplify your equation to find the answer — well, almost. It turns out you’re left with a quadratic equation, perhaps one that says 5t2+17x-179. WHAT?! You have no time to factor the problem out or do the quadratic equation to find the t-value that makes logical sense. Just as you give up all hope, imagine that you pull out your calculator, enter three numbers, and have the answer computed instantaneously!
Intrigued? So was I when I first started exploring the amazing world of computer science. Most students from middle school even on to college have a Texas Instruments calculator used for calculating answers and occasionally graphing – but why have a great piece of technology without using it to its full potential? This is how I first fell in love with coding – by going on my calculator during long stretches of physics classes and messing around, and today, I am going to make your life easier by teaching you how to code the quadratic equation on your calculator easily!
First, the tools: 1) you’re going to need a Texas Instrument calculator (preferably a TI-83 series or TI-84 series) to code on and 2) a curiosity for how programs you use every day (such as the device you’re reading this on right now) work. Oh, and 3) a desire to make your life easier by never having to do the tedious calculation again.
Got your tools? Great! Let’s begin!
STEP 1 – Getting Started:
We’re going to want to start by making a new program on our calculator. To do this, turn the calculator on (hopefully you already know how to do this) and press the PRGM button. Here is a list of your programs on your calculator (which most likely will be blank) with three options at the time. Use the arrow keys to navigate to the NEW section and click enter to “Create New.” Now name your program something cool! I have mine named as “QUAD,” but you can name it “COOL,” “HACK,” or “ICECREAM” (if you really like ice cream a lot) with the alphabet keys in green above the normal function keys. Now you should have a blank canvas to create your program. Perfect!
STEP 2 – Programming Time:
The first thing we’re going to want to do is display the quadratic form for our user (just in case they forgot it). To do this, hit the PRGM button again, navigate to the right to I/O (which stands for input and output onto the screen) and then click the “Disp” command. Type the following right after the Disp command: “AX2+BX+C=0” (with the quotation marks!). Hint: the equals sign (‘=’) can be found by pressing the keys: 2nd->MATH. It should be the first key at the top of this page. Your calculator should look like this now:
If so, good job! You’re almost there. Let’s get on to the real stuff now (we’ll go a bit faster pace from now on).
We now want to have variables to compute the quadratic equation. The three numbers we actually need for the quadratic formula are A, B, and C (reference the picture below if that didn’t fully make sense to you).
We want the user to input these into the program, so we use the “Prompt” function. This is under PRGM -> I/O (same as the DISP function). From there, program three lines to input each variable: A, B, and C. Now you’re program should look like this:
Now we actually have to compute the quadratic equation. This part looks messy, but it isn’t that bad! First, let’s compute the radical part. By looking at the formula, we know that this is √((B)2-(4*A*C)) – parentheses are super important in mathematical computer programming (remember, computers aren’t as smart as us until we teach the computer to be smarter than us). We have the computation, but we’re not doing anything with it!
Well, let’s do something with it! Let’s assign it to a variable. For example, if we said x = “dogs” and I said: “I like to pet x,” what did I just say? I said “I like to pet dogs,” since the ‘x’ was just a variable that stood for “dogs.” We’re going to do the same thing here by assigning √((B)2-(4*A*C)) to the variable X. To do this in the calculator, we use the arrow key and then give it a letter to be the variable (I’ll use X for this but you can use any letter you want to as long as you remember which letter you chose for later steps). The arrow key is usually near the ON key and says STO-> (which is also right near the X character). Doing that, we now have the following program:
We’re almost there! Now that we have our radical part done, we can finish the rest of the quadratic equation. But remember, there’s a plus-or-minus sign before the radical, meaning we’re going to have to do the same computation twice. Have no fear, it’s simple! Try to figure out the next steps on your own.
Hint #1 – You do some math and assign it to a variable – and you do this twice.
Hint #2 – Remember that X is already assigned to the radical, so when you do the equation in the picture above, just use X instead of the mess of the radical.
Hint #3 – Use parentheses! Don’t scroll down if you want to try it on your own!
Did you get it? Here’s my code below:
We’re almost done! Now we have our two answers stored in the variables Y and Z. Even though we did the math, we’re missing something – displaying it to the user! We can’t just hide our answer – we want to share it with whoever is using the program. To do this, we use the ‘Disp’ key again (remember, this is under PRGM -> I/O) and code the following:
And that’s it! Congratulations! You just completed your first calculator program! Let’s test it out!
Press the keys: 2nd->MODE to quit your program (or just turn your calculator off and on again). Now you should be back on your normal screen (not the coding program screen anymore). Click the ‘PRGM’ and click enter when you find your ‘QUAD’ program (or whatever you named it). Enter in the numbers from the example I gave at the very beginning of this post and see if our screen give the right answers:
The last two number are our two solutions to the quadratic equation, but since we’re solving for time in this problem, the final answer is t=4.52 (remember, we can’t have negative time unless we’re in the Matrix or something like that)!
Now you have a complete program that solves the quadratic equation for you. Never do it again (unless you have to show your work on a test, in which case, still practice doing it by hand every now and then)! If that interested you, good! This means you might like computer programming. If that made you realize that you might never have to do math again in your life because you can just program your way through every equation – not good, but still, you might want to consider more computer programming!
The same skills we used today are used to build your favorite video games, your favorite applications, your computer’s software, and even the server that turns a bunch of 1’s and 0’s into the text you’re reading now. Computer science is super interesting (which is why I am a computer science major) and you’re guaranteed to love it, even if you only use it to hack your math class again.
Challenge yourself by doing this same process for another equation (make up a random one and program it) or for even extra challenge mode, try to allow imaginary numbers to work as answers to your quadratic program! It’s all a lot of fun, it just takes a little work to get started (which, by this time, you just did!).
If you have any more questions about calculator programming or computer science in general, feel free to email me at email@example.com [EDIT: advanced readers can try to figure that one out] and I will get back to you as soon as possible!
Even better, though, is if you would like me as a great tutor for you in math or science (which I also like studying when I’m not studying computer science and can definitely help you outin your schoolwork and homework), request me as a tutor and I will be glad to help you out!
I hope you learned something today and have a great day! Keep hacking your classes!
— Nathan Cooper Jones