Programming in math classes

Leave a comment

Starting next year, the new Swedish course plan will require the inclusion of programming in math classes. I know not all math teachers, especially for younger years, have a lot of experience with this and so I thought I would blog about three good tools.

All the tools I will talk about share two important features:

  1. They are free to use
  2. They can be used directly in any web browser


  • Recommended uses in Sweden: lågstadiet and mellanstadiet
  • Available in Swedish and other languages

The first, and probably the most important, is Scratch, a tool developed at MIT and the best introduction to programming out there.

Instead of writing code, students drag and drop ready commands. It is incredibly easy to use and get started with. They recommend a starting age of 8, but younger kids have used it as well (with more guidance). It is also available in Swedish (as well as something like 40 other languages).

Even if it is easy to get start with, Scratch is quite versatile and it is possible to do quit complicated programs.

I recommend moving away from Scratch in högstadiet, since it will be easier to integrate into your math teaching. However, I did want to give a good example of how it is possible to use Scratch even in 9th grade.

The following is an example of a possible assignment. A 9th grade student was asked to create a Scratch project that showed found the equation of a line from two points. This is what he came up with.

Note that this is also an excellent way to assess math skills outside of standard testing. This project required good knowledge of linear equations, basic algebra, fractions, scaling and Euclid’s algorithm for reducing fractions.

However, this would have been much easier using something like JavaScript instead (e.g. using jsFiddle).

Khan Academy Programming Course

  • Recommended uses in Sweden: högstadiet and gymnasiet
  • English only

Khan Academy has their own online programming course. They have created their own language that seems to be roughly based on JavaScript, but is optimized for graphics.

The advantage here is that they have ready made videos and instructions for students, so even inexperienced teachers can let the students work through the material at their own pace. The focus on graphics and animation tends to make it more fun for students to learn, however it can make some math class applications more annoying to implement. Likely easiest (at least initially) for geometry projects.

A nice feature of their online programming editor is that the code is run as you type it. This gives instant feedback on any changes, which can be helpful for students. Another nice feature is that a teacher can create a sample or template program in the editor and then give a link to it to the students. This can be really nice for specific programming/math projects you want them to work with.


  • Recommended uses in Sweden: högstadiet and gymnasiet
  • English only (as much as JavaScript and HTML are based on English)

jsFiddle is an online JavaScript editor. This allows you to create JavaScript programs without needing a website to host them on. Instructions in JavaScript (and basic HTML) will need to come from elsewhere. But this is a great site for trying out programs.

Another nice feature is that, like with Khan Academy, the teacher can create sample or template programs for the students to study or modify.

Once students have some proficiency in JavaScript, this is likely the most versatile for using in math related programming assignments.

Here is a simple example of using the Newton-Raphon method to find the square root of a number.




Practice rate problems program

Leave a comment

I just finished my most ambitious basic skill practice app – for practicing rate problems (hastighet). It has everything from very simple problems to very hard problems. However, I have not tests all the different problem types yet, so anyone reading this who wants to test them and get back to me with any errors they find would be very appreciated. Here is the link:

Basic Skills Practice

Leave a comment

Here is an updated list of some of the html5 apps I’ve made for practicing basic math skills. The first list has nice addresses:

These I haven’t made short addresses for:

A little chaotic in the listing, but I thought some of you might find some of them helpful. Nothing fancy, just a source of generating basic practice problems.

Math Apps

Leave a comment

I thought I might try posting again. I’ve been working on writing more online math apps for students to practice with in class (on iPads) and at home. I started with Google Apps Script, but the limitations there were just getting too annoying. Then I remembered that my home provider gave me a little space so I recently switched to normal JavaScript pages – much, much easier without the limitations.

I was really happy when I came up with a good way to practice finding area with an app. This was challenging since you can’t really hold a ruler up to your screen, but giving the measurements either makes the problem too easy or too hard. I finally figured out a way to simulate measurement in the app. That was nice. Of course, technology is still generally annoying, so I’m not entirely happy with the result. Some of the line drawing won’t work in some versions of Chrome apparently. And I wrote it initially as a Google Apps Script, which meant there was no hope to get it to work for touch devices (they don’t currently support touch events, only mouse events). I tried switching to normal JavaScript and adding touch support, but it was more complicated than I thought. The result is something half functional on an iPad. I’m considering making a real iPad app for this one. Seems useful enough.

Anyway, for those who are interested in testing some of them, here are links to some of the stuff I’ve done (some more recently than others). None of them have any “frills”. They are not pretty, but are hopefully useful: