Enabling Computational Thinking with Mathematica
 in Secondary Education

Stephen Alderton 
Mathematics and Numeracy Leader
Beechworth Secondary College
stephen.alderton@education.vic.gov.au

Who am I?

Bachelor of Engineering (Hons) - UTAS
Power Engineer 2005-2012 
Grad Dip Ed - Secondary 
Secondary Teacher - Maths and Physics (2013 - now)

Used Mathematica as CAS technology for VCE Mathematics since 2017.

Where does Mathematica fit in secondary schools?
VCE Mathematical Methods, Specialist Mathematics and General Mathematics, Years 7-10

Where is secondary maths at?

Computational thinking processes

Sample Tasks

1. Picking the Perfect Pet - Cat Ownership Model

2024 International Mathematical Modelling Challenge 
(Year 9 team)

Print["Property Size   ", "Small ",Slider[Dynamic[size],{50,1000, 100 }],"Large   Size in Square Metres:",Dynamic[size]]
Print["size is ",size]
Print["Curfew Laws   ", "0 hours ",Slider[Dynamic[curfew],{0,24, 8 }],"24 hours   Hours in Curfew:",Dynamic[curfew]]
Print["curfew hours is ",curfew]
Print["Going Away (Day-Night Trips)   ", " Rarely ",Slider[Dynamic[away],{0,90,  5}],"Often.   Days Away Per Year: ",Dynamic[away]]
Print["time away(trips) is ",away]
Print["Previous ownership   ", "No Previous Cats  ",Slider[Dynamic[experience],{0,5, 1 }],"Lots Of Previous Cats.   Previous cats is: ",Dynamic[experience]]
Print["previous cats is ",experience]
Print[" Availibilty of Necessities   ", "Closeby ",Slider[Dynamic[necessities],{0,12, 1 }],"Far away  . Hours away from necessities is: ",Dynamic[necessities]]
Print["Distance (Hours) from Necessities is ", necessities] 
Print["Vet Distance away   ", " Close ",Slider[Dynamic[vet],{0,12, 1 }],"far.  Hours from vet is: ",Dynamic[vet]]
Print["Vet distance (hours) is ",vet]
Print[" Current Cat Amount   ", " No Pets ",Slider[Dynamic[pets],{0,8, 1 }]," Lots Of Pets.  Current Cat Amount is: ",Dynamic[pets]]
Print["Cat Amount is ",pets]
Print[" Your Age ", " Young ",Slider[Dynamic[age],{0,100, 1 }]," Old .  Owner Age is: ",Dynamic[age]]
Print[" Age is ", age]
Print[" Time No One Home With Cat   ", " Rarely Home ",Slider[Dynamic[home],{4,24,  1}],"Often Home.  Time pet has people around (Hours) is: ",Dynamic[home]]
Print["Time pet has people around (Hours) is  ", home]
Print[" Urban Or Rural ", " Urban ",Slider[Dynamic[region],{1,2, 1 }]," Rural .  Urban Or Rural is: ",Dynamic[region]]
Print[" Urban (1) Or Rural (2) is ", region]

score = ((size/100))+ (10- (curfew/2.4))+ (15 - (away/6))+ (experience)+(10- (necessities/1.2))+(10- (vet/1.2))+(5- (0.625/pets))(home-4)+ (region*2)

2. Snowflake Model

Year 11 Unit 1/2 Mathematical Methods - Linear Coordinate Geometry

- Defining and representing the Snowflake

- Computing the Snowflake

- Discussing the Snowflake

Sample Solution

ga:=Plot[x,{x,-10,10},PlotRange->{{-20,20},{-20,20}}]
gb:=ContourPlot[x==0,{x,-15,15},{y,-15,15}]
gc:=Plot[-x,{x,-10,10}]
gd:=ContourPlot[y==0,{x,-15,15},{y,-15,15}]

ge:=Plot[x==7,{x,-10,-7}]
gf:=Plot[x==7,{x,10,7}]
gg:=Plot[x==-7,{x,10,7}]
gh:=Plot[x==-7,{x,-10,-7}]

<..shortened...>
pp:=Plot[x-6,{x,0,6}]
ppp:=Plot[x+6,{x,0,-6}]
ps:=Plot[-x-6,{x,0,-6}]
pl:=Plot[-x+6,{x,0,6}]

Show[ga,gb,gc,gd,ge,gf,gg,gh,gi,gj,gk,gl,gu,gv,gw,gx,gy,gz,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap,aq,ar,as,at,au,av,aw,pp,ppp,ps,pl,AspectRatio->1]

Midpoint[{{0,-4},{4,0}}]

Solve[y-(4)==1(x-0),y]

EuclideanDistance[{0,-4},{4,0}]

Another Sample Solution 😮

(*all lines until plotting are editable and directly change the snowflake*)
ea:=1x(*this and eb are a bit un-needed but i used them and cant be bothered changing them*)
eb:=0
r1:=1
r2:=7
r3:=1
r4:=9
r5:=1
r6:=9
r7:=1
r8:=7
r9:=1
r10:=6
r11:=5
r12:=8
r13:=9
r14:=14
b1:=RandomReal[{r13,r14}](*line length of all baselines*)
r13=r14=b1;
b2:=(Sqrt[((b1^2)/2)])(*calculates diagonal baselines*)
p1:=RandomReal[{r1,r2}](*origin point of lower branches on diagonal baselines*)
r1=r2=p1;
p2:=RandomReal[{r3,r4}](*origin point of lower branches on vert/horiz. baselines*)
r3=r4=p2;
p3:=RandomReal[{r5,r6}](*origin point of upper branches on vert/horiz. baselines*)
r5=r6=p3;
p4:=RandomReal[{r7,r8}](*origin point of upper branches on diagonal baselines*)
r7=r8=p4;
b3:=RandomReal[{r9,r10}](*line length of all lower branches*)
r9=r10=b3;
b5:=RandomReal[{r11,r12}](*line length of all upper branches*)
r11=r12=b5;
b4:=(Sqrt[((b3^2)/2)])(*calculates diagonal lower branches*)
b6:=(Sqrt[((b5^2)/2)])(*Calculates diagonal upper branches*)

(*everything past this is plotting*)

a:={Plot[ea, {x, b2, -b2}, PlotRange->{{-16,16},{-16,16}}, AspectRatio->1, Axes->False, Background->LightBlue],Plot[0, {x,b1, -b1}]}
b:={Plot[-ea, {x, b2, -b2}],ContourPlot[x==0, {x,b1, -b1}, {y,b1,-b1}]}
c:={Plot[ea+p2, {x, 0, b4}], Plot[-ea+p2, {x, 0, -b4}], Plot[ea-p2, {x, 0, -b4}], Plot[-ea-p2, {x, 0, b4}],Plot[ea-p2,{x,p2,(b4+p2)}], Plot[-ea+p2,{x,p2,(b4+p2)}], Plot[ea+p2,{x,-p2,-(b4+p2)}], Plot[-ea-p2,{x,-p2,-(b4+p2)}]}
d:={Plot[ea+p3, {x, 0, b6}], Plot[-ea+p3, {x, 0, -b6}], Plot[ea-p3, {x, 0, -b6}], Plot[-ea-p3, {x, 0, b6}],Plot[ea-p3,{x,p3,(b6+p3)}], Plot[-ea+p3,{x,p3,(b6+p3)}], Plot[ea+p3,{x,-p3,-(b6+p3)}], Plot[-ea-p3,{x,-p3,-(b6+p3)}]}
e:={ContourPlot[x==p1,{x,-10,10},{y,p1,(p1+b3)}],ContourPlot[x==p1,{x,-10,10},{y,-p1,(-p1-b3)}],ContourPlot[x==-p1,{x,-10,10},{y,p1,(p1+b3)}],ContourPlot[x==-p1,{x,-10,10},{y,-p1,(-p1-b3)}],ContourPlot[y==p1,{x,p1,(p1+b3)},{y,-10,10}],ContourPlot[y==p1,{x,-p1,(-p1-b3)},{y,-10,10}],ContourPlot[y==-p1,{x,p1,(p1+b3)},{y,-10,10}],ContourPlot[y==-p1,{x,-p1,(-p1-b3)},{y,-10,10}]}
f:={ContourPlot[x==p4,{x,-20,20},{y,p4,(p4+b5)}],ContourPlot[x==p4,{x,-20,20},{y,-p4,(-p4-b5)}],ContourPlot[x==-p4,{x,-20,20},{y,p4,(p4+b5)}],ContourPlot[x==-p4,{x,-20,20},{y,-p4,(-p4-b5)}],ContourPlot[y==p4,{x,p4,(p4+b5)},{y,-20,20}],ContourPlot[y==p4,{x,-p4,(-p4-b5)},{y,-20,20}],ContourPlot[y==-p4,{x,p4,(p4+b5)},{y,-20,20}],ContourPlot[y==-p4,{x,-p4,(-p4-b5)},{y,-20,20}]}
Show[a,b, c, d, e, f]

3. Cinema Screen Model

Year 11 Unit 1/2 Mathematical Methods - Investigation

Mathematically pretty simple. Computationally - a good challenge.

Considerations 
1) Where is the screen?
2) How “curvy” is the screen?
3) How far away? 
4) Can everyone see?

Sample Computations & Solution

(* v PARAMETERS v *)
maxGrad:=0.4(*the curves gradient at its end points*)
left:=2.5(*distance of screen from edge walls*)

(* v NON-EDITABLE v *)
right:=30-left
top:=2(*distance of screen from the front wall (must be 2, at least 2 away from wall, at least 18 from centre of viewing area(10)*)


(*blank arc equation*)
arc[x_]:=(Sqrt[(r^2)-(((x-h))^2)])+(k^2)

(*solving for the left and right edges being the maxGrad, giving us what r (the radius/curve) and x (the height) must be*)
(*r affect k, so we cant find k at the same time*)
findCurve:=Solve[{arc'[right]==-maxGrad,arc'[left]==maxGrad},{r,h}][[2]]

(*substituting the new r and h values into the equation*)
(*the if statement is to keep numbers real. if k must be negative, but we square it, then the only way to move the circle down is an imaginary number. If makes it take if it is going to be negative, and add if it will be positive*)
curve[x_]:=If[30-top>(r/.findCurve),(Sqrt[(((r/.findCurve))^2)-(((x-(h/.findCurve)))^2)])+(k^2),(Sqrt[(((r/.findCurve))^2)-(((x-(h/.findCurve)))^2)])-((k^2))]

(*finding k, our last variable, which give us the full equation of our screen*)
findScreen:=Solve[curve[15]==(30-top),k][[2]]

(*make equation, same if statement to make sure it adds or subtracts correctly*)
screen[x_]=If[30-top>(r/.findCurve),(Sqrt[(((r/.findCurve))^2)-(((x-(h/.findCurve)))^2)])+(((k/.findScreen))^2),(Sqrt[(((r/.findCurve))^2)-(((x-(h/.findCurve)))^2)])-(((k/.findScreen))^2)]

I break the code here, as if I left it as it currently is, screen would reevaluate all of the working out each time. setting it definitively to the result printed above helps with run-time.

screen[x_]:=-5.65728004459065`+(Sqrt[1132.8125` -(((-15.`+x))^2)])

(*show screen, with normals at each end displayed in dashed black*)
Show[Plot[{screen[x]&&left<x<right,(-1/screen'[left])(x-left)+screen[left]&&left<x<15,(-1/screen'[right])(x-right)+screen[right]&&15<x<right},{x,0,30},PlotRange->{{0,40},{0,40}},AspectRatio->1],
Graphics[{Line[{{5,0},{5,20},{25,20},{25,0}}],Line[{{0,0},{0,30},{30,30},{30,0}}]}]]

(*Display information, to show if the Graph fits within the requirements.*)
Print["Distance from top:",top,"  --  Distance from sides:",left, "  --  Distance from closest audience: ",EuclideanDistance[{5,20},{x/.Solve[-1/screen'[x](5-x)+screen[x]==20,x],screen[x/.Solve[-1/screen'[x](5-x)+screen[x]==20,x]]}]]
Print["Stationary point: {",15,",",screen[15],"}, gradient: ",screen'[15]]
Print["Screen Span: ",EuclideanDistance[{left,screen[left]},{right,screen[right]}]]
Print["Maximum/Minimum Gradient: ",maxGrad,", ",-maxGrad]
Print["Max/Min from center of viewing area: ",Max[EuclideanDistance[{15,10},{15,screen[15]}],EuclideanDistance[{15,10},{left,screen[left]}]],", ",Min[EuclideanDistance[{15,10},{15,screen[15]}],EuclideanDistance[{15,10},{left,screen[left]}]]]
Print["Percentage of GoodViewingSeats™: ",100-(((-1/screen'[left](5-left)+screen[left])*((x/.Solve[-1/screen'[left](x-left)+screen[left]==0])-5))/400*100)[[1]],"%"]

4. Trapezium Rule

Unit 3/4 Mathematical Methods, VIC

Pseudocode

Trapezium Rule Tool

This is a sample of a similar algorithm implemented in Wolfram Language.

f[x_]:=-(x^2)+16                        (*define the function to find the area*)
a:=0                                               (*lower boundary / lower terminal of integration*)
b:=4                                               (*upper boundary / upper terminal of integration*)
n:=6                                               (*number of trapeziums to use*)
h:=((b-a)/n)                                       (*calculation of the value of h for the trapezium formula*)
area:=0                                         (*define the starting area*)
Print["Strip width, h = ",h]                                     (*Tell us what the strip width is*)
x:=a
Do[ 
strip:=0.5×(f[x]+f[(x+h)])× h;                          (*calculate the nth strip area*)    
area+=strip;                                                                           (*add the nth strip area to the toal*)
Print["Strip ",i," = ",strip,"   Cumulative total = " ,area];        
x+=h,                                                                                (*increment x by h for the next strip*)
                                                               
{i,1,n}]                                                                          (*repeat n times*)
       
Print["Total area of trapeziums is:",area]
Show[Plot[f[x],{x,b-n*h,b},PlotRange->Full],
ListPlot[Table[{k,N[f[k]]},{k,b-n*h,b,h}],Filling->Axis]]
ClearAll[f,a,b,h,area,x,n]

6. Data Tasks

Develop a question

Source some data

Consider how to analyse the data

Computations (mean, median, IQR, boxplots, linear regression, residuals etc)

Communicate

Data sets

Life Expectancy

CountryData["Europe","LifeExpectancy"]

Victorian Cities

TableForm[{CityData[{All, "Victoria", "Australia"}],CityData[#,"Population"]&/@CityData[{All, "Victoria", "Australia"}]},TableDirections->Row]

({{(Entity["Melbourne", Entity["City",{"Melbourne","Victoria","Australia"}], "Entity[\"City\", {\"Melbourne\", \"Victoria\", \"Australia\"}]", "city"]), (Quantity[4529500, "people", people, "People"])}, {(Entity["Geelong", Entity["City",{"Geelong","Victoria","Australia"}], "Entity[\"City\", {\"Geelong\", \"Victoria\", \"Australia\"}]", "city"]), (Quantity[172300, "people", people, "People"])}, {(Entity["Ballarat", Entity["City",{"Ballarat","Victoria","Australia"}], "Entity[\"City\", {\"Ballarat\", \"Victoria\", \"Australia\"}]", "city"]), (Quantity[91787, "people", people, "People"])}, {(Entity["Bendigo", Entity["City",{"Bendigo","Victoria","Australia"}], "Entity[\"City\", {\"Bendigo\", \"Victoria\", \"Australia\"}]", "city"]), (Quantity[89666, "people", people, "People"])}, {(Entity["Shepparton\[Hyphen]Mooroopna", Entity["City",{"SheppartonMooroopna","Victoria","Australia"}], "Entity[\"City\", {\"SheppartonMooroopna\", \"Victoria\", \"Australia\"}]", "city"]), (Quantity[38773, "people", people, "People"])}})

Population density

TableForm[{CountryData["Oceania"],CountryData["Oceania","Area"],CountryData["Oceania","Population"],CountryData["Oceania","Population"]/CountryData["Oceania","Area"]},TableDirections->Row]

({{(Entity["American Samoa", Entity["Country","AmericanSamoa"], "Entity[\"Country\", \"AmericanSamoa\"]", "country"]), (Quantity[199.`, (("km")^2), kilometers squared, (("Kilometers")^2)]), (Quantity[44099, "people", people, "People"]), (Quantity[221.60301507537687`, "people""/"(("km")^2), people per kilometer squared, (("People")/(("Kilometers")^2))])}, {(Entity["Australia", Entity["Country","Australia"], "Entity[\"Country\", \"Australia\"]", "country"]), (Quantity[7.74122`*^6, (("km")^2), kilometers squared, (("Kilometers")^2)]), (Quantity[26400000, "people", people, "People"]), (Quantity[3.4103151699602905`, "people""/"(("km")^2), people per kilometer squared, (("People")/(("Kilometers")^2))])}, {(Entity["Cook Islands", Entity["Country","CookIslands"], "Entity[\"Country\", \"CookIslands\"]", "country"]), (Quantity[236.`, (("km")^2), kilometers squared, (("Kilometers")^2)]), (Quantity[17032, "people", people, "People"]), (Quantity[72.16949152542372`, "people""/"(("km")^2), people per kilometer squared, (("People")/(("Kilometers")^2))])}, {(Entity["Fiji", Entity["Country","Fiji"], "Entity[\"Country\", \"Fiji\"]", "country"]), (Quantity[18274.`, (("km")^2), kilometers squared, (("Kilometers")^2)]), (Quantity[900000, "people", people, "People"]), (Quantity[49.25030097406151`, "people""/"(("km")^2), people per kilometer squared, (("People")/(("Kilometers")^2))])}, {(Entity["French Polynesia", Entity["Country","FrenchPolynesia"], "Entity[\"Country\", \"FrenchPolynesia\"]", "country"]), (Quantity[4167.`, (("km")^2), kilometers squared, (("Kilometers")^2)]), (Quantity[300000, "people", people, "People"]), (Quantity[71.99424046076314`, "people""/"(("km")^2), people per kilometer squared, (("People")/(("Kilometers")^2))])}})

Gotta Compute ‘Em All!

strongPokemon=EntityClass["Pokemon",{"Attack"->TakeLargest[5]}]//EntityList

EntityValue[strongPokemon,{"Attack","Image"},"Dataset"]

Engagement

Assessment

“The Future is Computational....”

More tasks, more teachers

Further tasks that involve Wolfram Alpha data sets

Chat-enabled notebooks

Innovation in mathematics teaching for the 21st century needs to be in computation

Research

Questions