# Mathematics-IT as NewMath

NewMath:Mathematics-IT is a basic school version of the BodyandSoul university mathematics education reform program. The Swedish version is presented at Matematik-IT.

Mathematics-IT combines the language of mathematics with programming and the computational power of the computer into a new tool for simulation of real and imagined worlds, to be used to understand and handle these worlds. Mathematics-IT is constructive mathematics where all mathematical objects are constructed computationally.

All of this can be described as different forms of computer games, where the student both constructs/programs and plays the game, where computer game means interaction between player and mathematical model using the computational power of the computer.

The main questions are here: What can I construct? How do I do to construct such a thing? rather than the traditional questions: What am I supposed to do? How am I supposed to do that? The questions and answers are here connected so that How? influences What?.

The perspective is thus open towards a large variety of different constructive possibilities for different students, rather than closed as in traditional school mathematics towards few possibilities, the same for everybody. The question Why? has a different answer when possibilities are many, than when possibilities are few.

Mathematics-IT is below presented as a sequence of computer games in posts Game1, Game2, Game3,…, from the simplest to more complex, where the design and programming of the game is the main point.

We use Codea, which is a user friendly app for programming on the iPad for the iPad.

Mathematics-IT is supported by a set of apps on App Store illustrating different basic concepts and serving as inspiration for student work on programming apps for App Store and can be found searching for “new math”.

Take a look and see that these apps serving the basic school  version also represent central core of BodyandSoul for university.

NewMath: Mathematics-IT thus offers a mathematics education with a new uniformity over levels, where the basic questions are the same independent of level: What can be computed and how?

# Apps on App Store

Mathematics-IT is supported by a number of apps on App Store with the dual purpose of illustrating basic concepts of mathematics and programming and serving as inspiration for student work to create apps on App Store. Here are the icons of some of the apps:

# Constructive Mathematics – Programming

Mathematics-IT is constructive mathematics which means that all mathematical objects such as

• integer  and  rational numbers, irrational numbers $\sqrt{2}, \pi , e$ et cet
• geometrical figures,
• functions such as $x^r,\sqrt{x}, \exp(x), \log(x), \sin(x), \cos(x),$  et cet

are constructed through computer programs by the computer.

We start letting the computer construct the natural numbers from 0 by repeating the operation +1. We understand that the validity of laws such as the commutative law m + n = n + m, follows by construction. We represent natural numbers in different bases. We extend to multiplication, to integer numbers and to rational numbers as pairs m/n of natural numbers solving the equation n*x = m and then introduce division and understand the laws for counting with numbers, by construction.

We construct the elementary functions such as polynomials, exp, log, sin, cos, roots et cet by numerical solution of different elementary differential equations, by time stepping or iteration.

The programming starts with as few ready mades as possible, in particular we do not use the physics engine of Codea before the students have constructed their own physics engines from scratch. In addition to elementary arithmetics thus only the built in functions allowing input by screen touch and  tilt, are used to start with. Once that is done the power of the physics engine allows the student to design challenging games for endless learning experiences.

# Game1: Natural Numbers Base 10

We start constructing the natural numbers 1,2,3,…, by letting the computer perform the operationen +1 repeatedly starting from 0 through the assignment

n=n+1

with start n=0, at the same time making a first acquaintance with Codea. We print he result on the console and on the screen an d contemplate our construction.

Encouraged by the simplicity of the program (n=n+1) compared to the overwhelming output (nearly all natural numbers) , we continue with variants such as (a) n=n+2, (b) n=n+10, (c) n=n+0.01, (d) n=n+1, s=s +1/n, (e) n=n+1, s=s+1/n^2, with start s=0, et cet…

Codea Code Template:

function setup()

print(“Construct the Natural Numbers 1,2,3,…”)
print(“Print on Console and Screen Konsolen”)

n=0

end

function draw()

background(40, 40, 50)

n=n+1

print(n)

font(“AmericanTypewriter”)
fontSize(50)
text(n,300,500)

end

# Game2: Natural Numbers Base 2

We continue with counting using binary representation, where we introduce a table bit[1],…,bit[N] which contains N numbers which are either 0 or 1, as representation in binary form  of 1=1, 2=10, 3=11, 4=100, 5=101, 6=110, 7=111, 8=1000, 9=1001, 10=1010, 11=1011, 12=1100, 13=1101, 14=1110 and 15= 1111, and so on, with decimal number to the left and binary to the right. We construct the natural numbers in binary representation, up to a certain size, by letting the computer repeat:

• bit[1]=bit[1]+1
• for n=1,N-1 do
•   if bit[n]==2 then
•     bit[n+1]=bit[n+1]+1
•     bit[n]=0
•   end
• end

Codea Code Template:

function setup()
print(“Binary Representation of Natural Numbers by table/list”)

bit={}
I=100
for i=1,I do
bit[i]=0
end

end

function draw()

background(40, 40, 50)

bit[1]=bit[1]+1
for i=1,I do
if bit[i]>1 then
bit[i+1]=bit[i+1]+1
bit[i]=0
end
end

font(“AmericanTypewriter”)
fontSize(50)
fill(238, 16, 46, 255)
for i=1,I do
text(bit[i],700-50*i,800)
end

end

# Game3: AngryMathBirds Easy

We write a first program for motion according to Newton’s equations (cf header picture):

• vx=vx +ax*dt
• vy =vy+ay*dt
• x=x+vx*dt
• y=y+vy*dt,

where ax=0, ay=-g=-gravitational constant, dt>0 is time step , x is horisontal coordinate, y vertical coordinate, vx horisontal velocity and vy vertical velocity. This is the mathematics behind the paths of birds in AngryBirds. We introduce initial position/velocity first directly in the program and then by touch on the screen. Look at AngryMathBirds Demo 1 illustrating:

1. motion according to Newton’s equations
2. touch to set intill values for position and velocity of Bird
3. hit if distance between Bird and Pig sufficiently small

Pictures are collected from the web and transferred to Codea via Dropbox.

Template 1:

function setup()

x=100
y=100
vx=10
vy=10
ax=0
ay=-1
dt=1

end

function draw()

vx=vx+ax*dt
vy=vy+ay*dt
x=x+vx*dt
y=y+vy*dt

background(255,255,255,255)
fill(255,0,0,255)
ellipse(x,y,20)

end

# Game4: Natural Numbers

Do 1: Write a computer program constructing the natural numbers and printing them on the console  (in base 10), by repetition of  x = x + 1 with start x = 0.

Do 2: Do the same in binary representation.

Do 3: Write a program for addition av naturl numbers in binary form using the addition table: 0+0=0, 1+0=1, 0+1=1, 1+1=10. (See Lego Computer DigiComp)

Do 4: Write a program generating the rational numbers of the form p/q with p and q natural  numbers  (q not 0) with p<q and printing them on the console in base 10.

Template 1  Do 1:

–Natural Numbers
function setup()
print(“Konstruktion av de hela talen genom upprepning av x=x+1 med start x=0.”)
n=0
end
function draw()

background(251, 251, 251, 255)

n=n+1

fontSize(200)
fill(0, 0, 0, 255)
text(n,300,500)

end

Template 2 Do 1:

funktion setup()
print(“Konstruktion av de hela talen genom upprepning av x=x+1 med start x=0.”)
n=0

end

function draw()

background(40, 40, 50)
n1=n
n=n+1

font(“AmericanTypewriter”)
fontSize(20)
fill(229, 232, 228, 255)

for m=1,n do
for k=1,m do
text(m..”=”,30,800-20*m)
text(“+1″,20*k+40,800-20*m)
end
end

fontSize(100)
fill(255, 0, 37, 255)
text(n..”=”..n1..”+1″,300,600)
fontSize(200)
fill(0, 1, 255, 255)

text(n,300,300)

end

Template Do 3:

number1 = {}
number2 = {}
sum = {}

for i=1,20 do
number1[i]=0
number2[i]=0
sum[i]=0
end

number1[1]=1

function setup()

fontSize(50)
fill(11, 0, 255, 255)
print(“Construction of Natural Numbers”)
print(“1”)
print(“1+1 = 10”)
print(“1+1+1 = 10+1 = 11”)
print(“1+1+1+1 = 11+1 = 100”)
print(“Binary numbers: digits 0 and 1”)
print(“0+0=0,0+1=1,1+0=1,1+1=10,”)

end

local carry={}
for i=1,20 do
sum[i]=0
carry[i]=0
end
for i =1,20 do
sum[i] = number1[i] + number2[i]+carry[i]
if sum[i] == 2 then
carry[i+1] = 1
sum[i]=0
end
if sum[i] == 3 then
carry[i+1] = 1
sum[i] = 1
end
end
return sum

end

function example()

for i=1,9 do
number1[i]=math.random(0,1)
number2[i]=math.random(0,1)
end

end

example()

function draw()
background(40, 40, 50)

font(“AmericanTypewriter”)
fontSize(50)
for j=1,10 do
text(number1[j],500-40*j,800)
text(“+”, 50,750)
text(number2[j],500-40*j,750)
text(“=”,50,650)
text(sum[j],500-40*j,650)
end
end

# Game5: Elementary Functions

Exponential growth: The number of coins doubles from one pile to the nex.

Do 1: Write a program for construction of linear velocity v and quadratic position x by repetition of the assignment/iteration:

• x = x + v*dt
• v=v+a*dt

with a=1, och plot on the screen. Note that the iteration can be formally be written dv/dt=a, dx/dt=v.

Do 2: Write a program for construction of the exponential function by the iteration

• x = x + v*dt

with v=x, and plot on screen. Note that the iteration can be written kan dx/dt=x. Reflect over dt=dx/x.

Do 3: Write a program for  construction av polynomial functions  by the iteration:

• x[n] = x[n] + x[n-1]*dt

for n=2,…,10, with x[1]=1,  and plot on screens. Note that the iteration can be written dx[n]/dt = x[n-1].

Do 4: Write a program for construction of trigonometric functions by the iteration:

• x = x + y*dt
• y = y – x*dt

and plot on screen kärmen. Note that dx/dt=y and dy/dt=-x.

Do 5: Write a  program for a computer game building on elementary functions.

Get inspiration from Calculus1 and Calculus2: NewMath on App Store.

# Game6: 2d Geometry

Do 1: Get familiar with the 2d vektorn vec2() in Codea and its use in computer games such as Angry(Math)Birds.

# Game7: Flight Simulator Easy

Do 1: Program a first flight simulator where the airplane is controlled by horizontal force  Fx and vertical force Fy through  two parameter-slides on the screen by time stepping Newton’s equations of motion:

• x = x + vx*dt
• y = y + vy*dt
• vx = vx + ax*dt
• vy = vy + ay*dt
• ax = Fx
• ay = Fy.

Template 1: (Follow the pilot’s change of force by the jet engine.)

function setup()

parameter.number(“vx”, -100, 100, 0)
parameter.number(“vy”, -100, 100, 0)
parameter.number(“Fx”, -100, 100, 0)
parameter.number(“Fy”, -100, 100, 0)
dt = 0.01
x=WIDTH/2
y=HEIGHT/2
ax=0
ay=0

end

function draw()

background(40, 40, 50)

ax=Fx
ay=Fy
vx=vx+ax*dt
vy=vy+ay*dt
x=x+vx*dt
y=y+vy*dt

sprite(“SpaceCute:Beetle Ship”,x,y,50)

stroke(251, 255, 0, 255)
strokeWidth(5)
strokeWidth(10)
line(x,y,x-ax,y-ay)
end

function touched(touch)

if touch.state == ENDED then
x = touch.x
y= touch.y
end

end