[Beginners] How to get better? Program your algebra homework.

posted in Retro Grade
Published February 28, 2013
Advertisement
Being an intermediate developer, getting better is a huge focus of mine. I read e-books, program constantly, and follow established programming rules (S.O.L.I.D.), however getting better is still hard. I've come to the conclusion that the only true way to get better is to program (following rules from books, however).

How can you program constantly? You run out of ideas, and you still aren't ready to embark on a big project. There has to be some way to get better at programming every day.

And there is.

Program your Algebra homework. Or, if you're out of Algebra, program the lesson's on Khan Academy.

"What?", you ask. "How does programming my Algebra homework help me at all?". "What does it even mean to 'Program your Algebra homework'?".

Well, it's simple. Algebra follows rules. Repetitive rules. And what are computers best at (If you don't know the answer to this question in less than a second, go read some more beginner books.)? Repetition. Procedural programming is focused on repetition. The idea that you can do the same code many times forms the base of Computer Science.

So, to get better, and learn far more about programming (Especially design), program your Algebra homework.

What do I mean? Put what you're learning to solve, or do, or simplify into a program. You'll quickly find yourself with a large library of Algebra programs.

Want an example?

The quadratic formula (and discriminates). Why did I choose this as an example? Because it's very easy, making it a great example. All you need to solve quadratic equations is to plug in a, b, and c (From standard form:)
550px-Derive-the-Quadratic-Formula-Step-1.jpg
into the quadratic formula:
Quadratic.formula.jpg
Do this every night, and you'll be a better programmer in no time.

(To see the example, download the file below. The code is in C++, however it should be easy to understand for programmers of all languages as it only uses basic conditional / loop statements, variables, and functions.)
3 likes 7 comments

Comments

Krohm

Uhm, I'm not sure.

Let's elaborate.

In algebra, people have set the rules. Coherent rules.

In programming, you need to write those rules.

In my experience, it does not really feel like algebra.

February 28, 2013 09:46 AM
blewisjr

Actually mathematics is a great way to improve your programming. A really good site for stretching your programming skills is Project Euler. Everything revolves around math. The site evaluates your solution and once you submit yours you can review the code others posted to compair. This comparison is great because it can really show you how you could have found a solution in a more efficient manner. Really good stuff.

February 28, 2013 02:29 PM
NEXUSKill

I think its a great way to get some practice for programming, though it might take a bit out of the practice of math itself.

For programming its a great thing, the rules are clear and you need to understand them very well to device an algorithmic solution to it that works for all cases. Though its kind of outside the realm of real world work experience since the rules are NEVER clear there :P

The problem is you can't take your programmed algorithm to class with you at the time of the final test, and good results in a final test usually require you to have done enough excersices to have the algorithm automated in your head. Also few professors would give you any credit beyond a pat on the head for presenting an algorithm to solve matrix determinant or derivate a function.

I would advice people still do both.

February 28, 2013 08:19 PM
Bedspa

It's one way but depending on the language it's not necessarily a great way.

As Krohm stated algebra has a set of rules and making a program that follows those rules and gives an answer (or answers) is a good start for programming as you have to start somewhere.

The user creating their own rules will come from the interface. How will they want the values entered? Is there a more efficient way? How do they want the values displayed?

For me in the 80s, a language like GW-Basic was great because it allowed near instant graphical representations of algebraic solutions and had a set of math instructions that closely followed what I was taught in grade school.

Within 6 months I had gone from "enter a series of numbers to see a series of numbers" to a graph that could be zoomed in and out upon, compared to different graphs and a different color palate used for imaginary numbers.

February 28, 2013 08:21 PM
Sergei Fedorov

Programming math for developing good skills is a great idea (if you don't do that at work).

But it's better to share your code than the compiled program with tons of useless stuff as precompiled headers, debug databases and build logs.

Another hint - always check your input.

February 28, 2013 08:23 PM
Bacterius

This is what I did back in high school actually, when I had to do algebra homework. It was extremely tedious and boring, so I eventually wrote a script to solve them all in one shot and printed out the results to copy back at lunchtime :)

For extra credit: implement complex arithmetic and write code to solve the quadratic equation on the complex plane!

That said, it really depends on the exercise and on the people involved. Learning is a very personal process, and not everyone will find implementing math useful (I personally did not, and preferred implementing simple games and proof-of-concept prototypes, small desktop utilities, etc..). I believe a formal math background is still desirable in addition to (or instead of) the exercise you propose.

March 05, 2013 10:39 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement