7
$\begingroup$

I'm working with a number of students who have an interest in programming, and who represent a wide range of numeracy skills. I aim to exploit their interest in programming in order to 'trick' them into some mathematical thinking, with the specific hope that lessons can be learned which are relevant to their own mathematical skill set and academic troubles.

I have a few exercises that I've had success with, which I will share as an answer later, but I'm sure that there will be some good suggestions.

$\endgroup$
3
  • $\begingroup$ great question! posted some suggestions below $\endgroup$
    – celeriko
    Nov 28, 2014 at 15:28
  • 2
    $\begingroup$ Project Euler. 'nuff said. :) $\endgroup$
    – apnorton
    Nov 28, 2014 at 19:58
  • $\begingroup$ Project Euler is great, but (if memory serves) it quickly moves past the technical level that these kids are at. I'm also looking for problems that speak directly to the curriculum of the age bracket. $\endgroup$
    – NiloCK
    Nov 29, 2014 at 1:06

2 Answers 2

6
$\begingroup$

a few suggestions

1) have them practice what i call "function deconstruction and reconstruction" in which they are given a mathematical function (conversion between Fahrenheit and Celcius, quadratic formula, etc) and have them code a seperate function for each individual step of calculating the equation. Then in their main function (whichever language it may be) have them attempt to combine all of their functions so that the program actually performs the desired output. It is also useful to have them play around with the order of function calls etc. to explore the order of operations and how it effects the output

2) give them code (preferably one that calculates/evaluates something as per your learning goal) which has some redundancies in it and ask them to "optimize" it, i.e. take out the redundancies. This will require them to not only understand the code and how it relates to the math, but then to analyze where the math is being extraneous

3) give them the challenge to come up with as many ways as possible to calculate the fibonacci sequence, great way to get students thinking about sequences, recursive definitions, iteration, and multiple approaches to the same problem. once they do it you can have them seed their functions with different numbers to see how the sequences will differ

4) give them code that is calculates an equation/formula and have them "decode" the program and come up with what equation/formula it calculates, great way to promote "thinking backwards" and also practice translating between code and maths

5) have them diagram a program by showing functions/blocks as boxes that are linked with arrows representing function calls/input/output, at first this sounds not math related but i have found that it not only gives them a better understanding of the functional aspect of coding but it also lets them practice diagramming skills which are incredibly helpful when solving math problems, especially word problems

these are just a few that i have tried/thought about trying. if i come up with more i will definitely edit my answer, i hope these help!

$\endgroup$
2
$\begingroup$

(1) The Collatz conjecture, a.k.a. the $3n+1$ problem, is easy to code, fascinating to explore, and amazing that it is an unsolved problem.

(2) Generating the prime numbers upto $n$ is a good programming exercise, with many possible solutions. Maybe they'll discover prime sieves?

(3) Generating strings of $2n$ balanced parentheses is more challenging, but can be explored recursively, e.g., with this code.

def pargen(left,right,string):
    if(left==0 and right==0):
        print string;
    if(left>0):
        pargen(left-1,right+1,string+'(');
    if(right>0):
        pargen(left,right-1,string+')');
pargen(3,0,'');

Eventually they may discover the Catalan numbers. E.g., there are $5$ strings with $n=3$ left parens.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.