Probability with Swift

Probability with Swift

I have recently remixed and reworked a mathematics investigation which was originally written for Scratch with my ex-colleague Jan Honnens .  The main purpose of this activity was to showcase the capabilities of Swift Playgrounds and how to bring new life into old resources with multi-touch interactivity to give students the necessary feedback to engage with course material.

The coursework itself looks at random number generation as the case for enquiry about probability.  Students are encouraged generate random numbers, flip coins and roll dice to generate relevant data for performing observations and critical analysis.

Once given the context, students are then stepped through the necessary mathematical operators and control flows necessary to perform the same simulations using the Swift programming language.  Students quickly realise that they can create larger test cases, more quickly by using code rather then manually rolling dice.

Level of Difficulty

The unit of study is suitable for beginners and teaches the basic mathematical operates required for understanding of probability algorithms, however, it is assumed that students have had some prior exposure to coding beforehand so the knowledge is scaffolded.

Australian Curriculum

This unit of study give students a taste for the relevance of coding in a modern world and also meets the following Australian Curriculum touch points for the Mathematics in Year 8.

  • Numbers and Algebra
    • Using index notation with numbers to establish the index laws with positive integral indices and the zero index (ACMNA182)
    • Carry out the four operations with rational numbers and integers, using efficient mental and written strategies and appropriate digital technologies (ACMNA183)
  • Real Numbers
    • Solve problems involving the use of percentages, including percentage increase and decreases (ACMNA186)
  • Data representation and interpretation
    • Investigate techniques for collecting data, including census, sampling and observation (ACMSP284)
    • Explore the practicalities and implications of obtaining data through sampling using a variety of investigative processes (ACMSP206)
    • Explore the variation of means and proportions of random samples drawn from the same population. (ACMSP293)
    • Investigate the effects of individual data values, including outliers, on the mean and median. (ACMSP207)
  • Linear and non-linear relationships
    • Plot linear relationships on the Cartesian plan (ACMNA193)

Accessing the Materials

All of the materials for this unit of work are available through iTunes U and are publicly available under Creative Commons should you wish to re-use them for your own lessons or courses.  I appreciate and encourage any feedback and constructive criticism so I can improve the courses.

Opportunities for Further Learning

Once students have completed this unit of work I would recommend that they looks that at completing the Geometry with Swift Playgrounds course.  This course covers lots of the material which is outlined in the geometry unit of the AC Mathematics curriculum.  The following article explains more about the course and its contents.


Geometry with Swift Playgrounds

Geometry with Swift Playgrounds