# A short problem

This math problem had me going for a bit. Looked at from a distance, it looked like one thing; and when I had the occasion to sit down and hash it out, it was quite another.

A student submitted a project that was of her game which was played with just two dice. If you roll a 2 or 12 you win; but if you roll any sum from 5 to 9 you lose; and if you roll a 3, a 4, a 10, or an 11, you survive to another round. You are limited to a maximum of three turns to roll a winning total.

It was not the normal Bernoulli trial, since this doesn’t just have the two states of success and failure; but it introduces a third state, which we will call “survival”. While you don’t “win” if you survive, you can still play again, but you can’t go past 3 turns. Three survivals in a row gets you nothing. You need to get a 2 or a 12 in three turns or less. $P(2 or 12) = \frac{1}{18}$, the probability of winning on your first try. Even though there are three states, we can still discuss wait time. In this context, it can be 0, 1, or 2. With a wait time of 1, $P(2 or 12) = P(3, 4, 10, or 11)\times (\frac{1}{18})=(\frac{5}{18})\times(\frac{1}{18}) \approx 0.015432$.

It means that to even make it to the second turn you can only get there with a 3, 4, 10, or 11. If you got 2 or 12 on the first try, there would be no need for a second turn. Similarly, to get to the third turn, you needed to survive twice and win the third time: $(\frac{5}{18})^2\times(\frac{1}{18}) \approx 0.00428669$.

It made sense, but I still wasn’t sure about this. What about the probability of losing completely? Those are the numbers from 5 to 9, which has a probability of $\frac{2}{3}$. Why wasn’t I making use of that information?

I don’t think it was necessary in computing the probabilities I did, since the winning conditions preclude rolling any sum between 5 and 9. But it can come in handy as a check. A good indicator that I am on the right track is to see if expectations of winning and losing for 1000 trials, add up to 1000. For winning, I need to add up the probabilities for all 3 wait times: $\frac{1}{18} + \frac{5}{324}+\frac{25}{5832} = \frac{439}{5832}\approx 0.0752743$. For 1000 games, the wait time of winning is: 75.2743 games.

The expectation of losing is similarly calculated, based on a single-turn probability of 2/3: $\frac{2}{3} + \frac{2}{3}\times \frac{5}{18} + \frac{2}{3}\times \left(\frac{5}{18}\right)^2 = \frac{439}{486}\approx 0.9033$. This means you will lose, on average 903 out of every 1000 games, or an expectation of 903.3. Notice that for 1000 games, the winning and losing conditions don’t add to 1000. What we didn’t add was survival until the third turn: $\left(\frac{5}{18}\right)^3 = \frac{125}{5832}\approx 0.02143$. This means that you will “survive” (but not win)21.43 out of every 1000 games. With enough decimal precision, we do indeed get 1000 games when we add all these numbers up, or at the very least add the expectation using the fractions: $1000 \times \left(\frac{439}{5832} + \frac{439}{486} + \frac{125}{5832}\right) = 1000 \times \left(\frac{439}{5832} + \frac{5268}{5832} + \frac{125}{5832}\right) = 1000$.

# A Look at Geometry in Grade 10: Circles From Handal, et al. (2013), a diagram which includes technological knowledge, also a consideration for math teachers, or any teacher using 21st century learning.

Pedagogical content knowledge is a type of knowledge that is unique to teachers, and is based on the manner in which teachers relate their pedagogical knowledge (what they know about teaching) to their subject matter knowledge (what they know about what they teach) (Cochran, Kathryn, 1997). This concern seems especially pertinent for math teachers. I attempt to show how subject matter knowledge and pedagogical knowledge are both essential in getting students to the point where they can be assessed on a circles problem in grade 10 academic math.

Teachers are reminded at the outset that while knowing the subject is one essential ingredient, so is knowing your students and your age group. Students must be known individually, to become familiar with how they see the concepts, in their own words. This means that in a normal class setting, students must be able to be able to express themselves without fear of judgement. The teacher also needs to be familiar student IEPs, the supports in their school (student success teacher, guidance counsellors, social workers, and so on).
The teacher is urged to also try some geometry problems on their own. More than informing one’s content knowledge, the teacher is also learning to anticipate problems that may arise that affect lesson planning. According to Aslan-Tutak and Adams (2015), a lack of content knowledge robs teachers of being able to properly assess students real needs and strengths in the classroom.

This article takes a look at geometry in grade 10 and is written to raise awareness of the possible connectedness of aspects of geometry to other parts of the math program, and to also discuss implications for the learner.

In the Analytic Geometry strand, the Ministry (2005) gives as two of its overall expectations for the course MPM2D (Academic 10 Math):

1. By the end of the course, students will model and solve problems involving the intersection of two straight lines;
2. By the end of the course, students will solve problems using analytic geometry involving properties of lines and line segments.

Addressing both circles and the activity here involving them, the specific expectations look like this:

1. By the end of the course, students will develop the formula for the midpoint of a line segment, and use this formula to solve problems.
2. By the end of the course, students will  develop the formula for the equation of a circle with centre (0, 0) and radius r, by applying the distance formula for the length of  a line segment, $d^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2$.
3. By the end of the course, students will determine the radius of a circle with centre (0, 0), given its equation; write the equation of a circle with centre (0, 0), given the radius; and sketch the circle, given the equation in the form $x^2 + y^2 = r^2$.

Grade 10 appears to be the first and last time circles are covered as a relation. I would also tell students about a circle centred at the point $(h, k)$, whose equation, $(x - h)^2 + (y - k)^2 = r^2$ is not that different from the distance formula shown above.

Student maturation. The chidren in this grade would generally be between 15-16 years old, and in most cases, maturationally ready to tackle math questions of some degree of complexity, even though impusivity is still an issue for most students at that age (Price, 2005). According to Price (2005), while impulsivity can be seen as a problem for adolescents of this age group regardless of their proficiency in math, she would also say that it can be regarded as an asset, that adolescent passion should be taken advantage of, and directed toward productive ends.

A task such as the three-point circle described below takes advatage of this passion, by subjecting a well-known property of circles to scrutiny. Beginning a rich task with a question starting with “Is it always true that three points always make a circle?” invites the student to try and make the idea fail. And of course, it does, sometimes. The student can then be asked, under what conditions does the idea fail, and can we re-state the conjecture that “three points make a circle” into something that is always true?

Big idea: Any three points can be used to form a circle if they are not on the same line. A rich task or rich assessment built on this will take with it a substatntial amount of the analytic geometry strand, and can wind up being among the last topics covered in a unit. The idea of three points making a circle is an old geometry problem. A much simpler, but less interesting, circle problem would be to have 3 points all some distance r from the origin to make a circle, which still loses none of the grade 10 content. Whenever I teach grade 10, I aim for a circle with an arbitrary centre, since so much of grade 10 math is embedded in it.

Rich problems such as this can be considered along the way as the result of a series of lessons. The sequence must be determined by the teacher

This can be either performed by the student using either geometry software, or using pencil and paper. It has been my experience that the latter option requires more time for the student, and more instructional time for the teacher, especially if the circle is not at the origin, which it likely won’t be given the prior requirement of “any three points”. This almost always requires the equation $(x - h)^2 + (y - k)^2 = r^2$, since the centre will be at some arbitrary point $(h, k)$ rather than the point $(0, 0)$.

It has been my experience that some learners take very well to this problem, while others are in need of assistance. If time is too tight, and students generally did well in the Quadratics strand, you might consider letting your students use Geometer’s Sketchpad to help solve the problem. Below, is a video where I demonstrate and discuss the use of Sketchpad for this problem.

Mostly, I will emphasize the benefits of a pencil-and-paper solution. And in the next video below, I demonstrate the use of an old fashioned geometry set and paper. The background music in this video is public domain, and there is no dialog, so feel free to turn off the volume (or turn it up). Since I was emphasizing technique in this video, I did not use graph paper.

A suggested lesson sequence to get to this point of the course (each of these could be one or more periods of lessons, covering other Big Ideas along the way):

1. Solving lines and linear systems — point of intersection: a) Solve by substitution; b) Solve by elimination (this could take several periods)
2. Midpoint of a line segment (can teach length of a line segment during this time to help confirm what we obtain from the formula $\left( \frac{x_2 - x_1}{2}, \frac{y_2 - y_1}{2}\right)$ is really the midpoint) (1-2 periods)
3. Solving quadratic systems (in Quadratic relations, the part on expansion of factors and solving is essential; however, the quadratic formula is not needed for this activity). (a couple of weeks)
4. The equation of a circle a) centred at the origin ( $x^2 + y^2 = r^2$) and b) centred at $(h, k)$: $(x - h)^2 + (y - k)^2 = r^2$. Remind students of some properties of circles. For example, the circle is a collection of all points which are the same distance r from a centre point. (this can be 2-3 periods)
5. A look at chords, along with major and minor arcs (optional, but is helpful in establishing a terminology for the three point/circle problem). Don’t spend a lot of time on this — it is not in the Ministry, but it is in some Ministry-approved grade 10 texts for the current curriculum.
6. Students would need to play with trying to get three arbitrary points to make a circle for about 1 period to agree on what steps they would need to confirm the point/circle problem. They would either use software such as Sketchpad or a geometry set, but the decision must be made for the whole class. Students consolidate on what the steps ought to be to solve this problem. If software is used, I would add to the problem: find the full equation for the circle, its radius, and the centre point. If pencil and paper is used, after students have struggled, and an algorithm is decided upon, you might consider demonstrating a complete solution either on the board or using a document camera.
7. Once the class agrees to an algorithm, 1-2 periods would be spent on a rich task (possibly a summative). If pencil and paper is used, the question is still do-able by grade 10 students, but I find not everyone can identify the centre with algebra, and usually end up estimating the position of the centre from the graph drawn. Thus, the there would also be a loss of accuracy in computing radius. (I would give a level 4 for the algebra; level 3 for estimating).

For the latter topic, that is, the algebraic solution to finding the centre from three points on a circle, I would suggest a PDF I wrote for my students, which demonstrated a sample calculation as they were working on their problem, given to them, or demonstrated the some days before the assessment, especially if anyone is having problems. Not all steps are shown in this handout, and the student is advised to perform the steps themselves. They would also be given a worksheet to practice on. It is from the PDF above mentioned that students began to point out the resemblance between the general circle equation and the distance formula, because both are used in the activity.

Supporting the teaching and learning of mathematics.

Going though with the pencil-and-paper method teaches students several things which would not be seen on a computer system:

• Students see that there is now a broader use for expanding and solving quadratics, that isn’t part of the strand on quadratic relations, but uses techniques that are not foreign to it.
• It is one opportunity to prepare students for the kind of math they may encounter in grade 11 Functions, grade 12 Advanced Functions, and Calculus and Vectors.
• This is the last treatment students get with circle relations before university. It is no longer covered in grades 11 and 12, but such relations (and much more) are covered in first-year university texts.
• Students see that there are parallels that can now be drawn between solving for a linear system and solving for a quadratic system — you still need two equations with the same two unknowns, for one thing.
• What has preceeded shows that the unit must be very carefully planned to do this activity. But once done, the reward is an activity that captures a substantial part of grade 10 academic math.

Supporting high teacher efficacy.

In this page, I have covered most of the high points of this sort of lesson, and described in some detail much of the most difficult parts of it through videos and external documents.

In this page, I have told teachers how to prepare themselves and their students with suitable content knowledge, as well as what pertinent expectations are covered in the analytic geometry strand, as well as informing teachers of the maturational readiness of students, and how impusivity, re-directed as passion, can be used as an asset to student learning.

What I have not mentioned is that it is crucial that teachers must constantly assess their students in the “for” and “as” learning phases, through observations, conversations, as well as products. Most periods should not end without some kind of assessment of this nature. This is because, with this math, finding out where your students are in their learning is critical to understand next steps for planning. The consolidation phase could be a math congress where students share their findings, ask each other questions, and, with some guiding questions and information from the teacher, come to an agreement as to their general findings.

For teachers to be successful  in this strand, they would be best off with problem-based learning (PBL), using problems of varying degrees of open-endedness. This would be done for all or most lesson on the way to this one. PBL should be in the “Action” part of the 3-part lesson. Each lesson should not go without a consolidation phase (Ministry, 2010), where students share and explain their work, while answering questions.

Another aspect of geometry is covered by another video I did, one on quadrilaterals, with the question being: “Is it always true that midpoints on a quadrilateral make a parallellogram?” To see the answer, you have to accept rectangles and squares as special cases of parallellograms:

Bibliography/Resources

Aslan-Tutak, Fatma, and Thomasenia Adams. “A Study Of Geometry Content Knowledge Of Elementary Preservice Teachers.” International Electronic Journal Of Elementary Education, vol 7, no. 3, 2017, pp. 301-318.

Cochran, Kathryn (1997). Pedagogical Content Knowledge: Teachers’ Integration of Subject Matter, Pedagogy, Students, and Learning Environments [online] Available at: https://www.narst.org/publications/research/pck.cfm [Accessed 24 Jul. 2017].

Handal, Boris et al. (2013). “Technological Pedagogical Content Knowledge Of Secondary Mathematics Teachers – CITE Journal.” Citejournal.Org, http://www.citejournal.org/volume-13/issue-1-13/mathematics/technological-pedagogical-content-knowledge-of-secondary-mathematics-teachers/.

King, P. (2015). “Draw A Circle With Any Three Non-Collinear Points.” Youtube, 2015, https://youtu.be/ZdPQA6eSZD0.

King, P. (2017). “Grade 10 Academic – Is It Always True That 3 Noncollinear Points Make A Circle?” Youtube, 2017, https://www.youtube.com/watch?v=ZRoAbbhuwoU.

Ontario Ministry of Education, Office of the Secretariat. (2010). Communication in the Mathematics Classroom (Vol. 13, Capacity Building Series). Toronto, ON: Queen’s Printer.

Ontario Ministry of Education (2005). The Ontario Curriculum Grades 9 and 10 Mathematics (Revised, 2005). Toronto: Queen’s Printer, Ontario.

Price, L. F. (2005). The Biology of Risk-Taking. Educational Leadership, April(2005), 22-26. Retrieved July 22, 2017.

# Boolean expressions on the TI-84 for Piecewise functions

Here I will try to explain boolean expressions. Boolean expressions are expressions that evaluate to “true” or “false”. “True” is like a value of 1 and “false” is like a value of 0 (zero). Suppose you have $(x>-1.0881)$ as your boolean for Y1. If X is greater than $-1.0881$, the expression can be replaced with a “1”. In turn, $1 \times (1.5x + 3) = 1.5x + 3$, so a value of true causes Y1 to plot.

If X is equal to or less than $-1.0881$, this same expression can be replaced with a 0. $Y_1$ does not plot in that case. But since $X \leq -1.088$ falls in the domain of Y2, then it is Y2 that will plot instead.

Suppose now I have two functions on my graphing calculator: $Y_1 = (1.5x + 3)(x < -1.0881)$ $Y_2 = (2x^2 - 1)(x \geq -1.0881)$

I have written the two booleans in such a way that only one of the statements can be true at a time. Notice that if the boolean for Y1 us true, then the one for Y2 is not. That means for X values less than $-1.0881$, only Y1 will plot. For all other values, only Y2 will plot, because its boolean will now be true and Y1‘s false. Ultimately, we obtain the graph: This is produced by a piecewise function which can be expressed using the following standard notation: Others have used different techniques for piecewise functions. One which seems to possess certain advantages would have been to place all details on to $Y_1$ as the sum of both “pieces” where each “piece” is multiplied by the boolean of the restriction, as follows: $Y_1 = (1.5x + 3)(x < -1.0881) + (2x^2 - 1)(x \geq -1.0881)$

While being slightly unwieldy (being sure to run past the end of the display), it saves the user from having to flip between $Y_1$ and $Y_2$ using the $\uparrow$ key.

There was also a useful idea where you could disable plotting for Y1 and Y2; and, for a new function Y3, enter: Y1 + Y2 using the VARS key to obtain the Y variables. The result is a single function that does not require flipping between functions with the $\uparrow$ or $\downarrow$, and proving continuity is much easier. And, the function is more like a piecewise function rather than two separate functions.

# VIII: The Programmatic Side of Mathematica: Sampling With Replacement

Arrays. I can declare an array and return an arbitrary element from it:

S := {2,4,6,8,10}
S[]
6

I can also do the same things for an anonymous array:

{2,4,6,8,10}[]
6

In both cases, I request the third element of the array in double square brackets, and Mathematica returns with the number 6. I can request a random element as was shown in previour posts, but it would be better to name the array:

S[[Random[Integer,{1,Length[S]}]]]

The above statement returns a random element from an array without needing to know the length of the array. I could include it in my bag of tricks, since it would resemble sampling, especially if I sample a certain number of times.

Sampling with replacement means picking an element e from a set S without removing it. With sets, that amounts to just choosing elements from a set while allowing repetition. We don’t even need numbers. What about letters? Let’s re-define the set S thusly:

S:={a,b,c,d,e,f,g,h,i,j,k,l}

Now, let’s define a function called “pick[n]” which chooses some quantity of letters from S by passing the number of choices to it as “n”:

pick[n_]:=Table[S[[Random[Integer,{1,Length[S]}]]],{n}]

That’s a lot of nested brackets. But recall that the Table[] function generated a set of size n by executing the function in the first parameter n times, and returning the result as an array. But here, the function is passed into the Random[] function, which determines the array index of the element chosen from S. So, two calls to pick returned these for me:

pick
{b,e,a,d}
pick
{h,g,h,d}

So, as you can see, we have repetition.

# Quote of the day

Every programming language has some kind of way of doing numbers and math. Do not worry, programmers lie frequently about being math geniuses when they really aren’t. If they were math geniuses, they would be doing math, not writing ads and social network games to steal people’s money.

— Zed Shaw (2012), Learn Python the Hard Way

# Doing math without “technology”

Math is a mental process. Basic math techniques should be, for those that are learning basic math, of the variety that you should either be able to do in your head, writing your thoughts on paper; or learn how to do so if you can’t yet. It is essentially a human skill. We acquire new math skills by building upon a foundation of what we have previously learned. In my opinion, there is nothing that modern computers can do to change this, although it might help us learn different things.

Math is a means of pure intellectual inquiry. How would you investigate the following:

A is 100 m to the north of B. A moves to the east at 3 m/s, while B moves to the west at 3 m/s. Show that the midpoint of the line AB is fixed under these conditions regardless of the position of A or B.

There are a number of ways to show this to yourself. I didn’t want to say “prove”, since I am avoiding a rigorous proof here. Just say that one rainy day, you simply asked yourself that question. You weren’t trying to be rigorous, just curious. There is no teacher in the room; no critical parents. Just you, a pencil and some paper. And maybe a ruler. And an eraser. How would you tackle it?

Some people would draw a diagram moving A and B apart in regular invervals, with $\overline{AB}$ lines drawn between them. Others would show that the areas of the two triangles described by the initial vertical line $\overline{AB}$ at time zero and their present position are the same area, which implies their hypoteneuses are equal. You can also show that the midpoint of the line $\overline{AB}$ at any time > 0 is the same midpoint as exists between the initial $\overline{AB}$ at time = 0.

# A used calculus textbook

I have advocated Mathematica and other technologies in previous posts, but I think it is high time to advocate for doing math with the absence of technology other than an pencil and paper.

I like this rather old text I acquired from a used dealer: “Calculus With Analytic Geometry: A First Course” by UC Berkeley professors Murray H. Protter and Charles B. Morrey, published way back in 1963, about 49 years ago.

There is something to be said about a math text that isn’t full of distracting bull regarding applications of “technology” in aiding the completion of math problems. A real math text should be one where, if you were out on a desert island with nothing more than a pencil and paper (read: no calculator, internet or PC), you could try the examples and exercises and learn the ins and outs of math for yourself. Using technology trivializes math, while the use of serious thought makes the learning stick.

Related rates, which is a dying question type in Calculus (covered more in university these days), when they appear in modern texts, seem to require the use of a calculator. A book made like Protter and Morrey — written before the days of calculators — will often compensate by having questions you can do with a little thought and some scribbling of side calculations, making the calculator un-necessary. In doing their Related Rates problems, I haven’t felt the need for even a slide rule, which would have been the “technology” current with the text.

Sometimes going “desert island style” means you need to do long division, and at other times, you will need to be handy with dealing with radicals. And a book like this would be written with the expectation that you rarely need decimal answers, so an answer like $5\sqrt{10}$ is just left that way. No need to calculate further.

Here is an example:

A point moves along the curve $y = \sqrt{x^2 + 1}$ in such a way that $dx/dt = 4$. Find $dy/dt$ when $x = 3$.

In this day and age, I would almost be made to feel like an inventor who had discovered the art of solving related rates problems by hand all by myself. Of course, far from being a trailblazer and breaker of new ground, I am really treading on paths that are well-worn by every first-year math student in the past several decades. This is by no means magical and neither you nor I would not be the first ones to master it. But that doesn’t take away from the joy of discovery and “getting it right”, at least not for me.

My solution, scribbled in ink on a blank, unruled sheet of paper, was thus:

$latex \frac{dy}{dt} = \frac{1}{2\sqrt{x^2 + 1}}\cdot 2x \frac{dx}{dt} \\ .\;\;\; = \frac{6(4)}{2\sqrt{10}} = \frac{12}{\sqrt{10}} = \frac{6\sqrt{10}}{5}$

I found writing an answer this way to be liberating. Over the past 30 years or so, we have come to expect to see all numbers in decimal form. Decimals are almost never exact, since not many rational numbers are nicely convertable into base 10. Base-10 is also not intuitive to computers, which thinks only in base-2, and require an arithmetic logic unit to make the conversions. Today’s faster processors and “textbook-style” calculators make this problem less visible, but it is always there, and will likely be there for some time to come.

Over the past 30 years, we have come to expect that all numbers are integers followed by decimals. Why should we be locked into this expectation? $\frac{6\sqrt{10}}{5}$ is also a number. And it is better than a decimal representation such as 3.795, because it is exact, no rounding necessary.

# The programmatic side of Mathematica I

I have been playing with Mathematica 5, and have a big thick book on it from Wolfram and even a Schaum’s Outline on the program. All of these books touch on all of the functions of the program as though that was all there was to know.

But of course you can make your own user-defined functions, but material on that is harder to find. I managed to get my hands on a book published in the early 90s by Gaylord, Kamin, and Wellin, entitled Introduction to Programming with Mathematica. It does not appear that any specific version number for this program is mentioned in the text. But the publication date of 1993 would suggest that the intended version would be 2.1 or 2.2. I have version 5.2, but so far in the first few pages, I haven’t run into any trouble.

In the old days when an operating system was nothing more than a BASIC command interpreter (anyone old enough to remember the Commodore 64? or the TRS-80?), you are by default placed into an immediate mode where you can issue commands, test out command syntax or run programs written in the same language as understood by your interpreter (for the Commodore or TRS-80, that language would be BASIC). In Mathematica, that is what is happening. You are in a sort of “immediate mode” where you can issue commands or run pre-defined functions or programs, load your own functions, and so on.

The Mathematica kernel seems to allow you to enter similar commands as in this discussion without the need to press “shift-enter” to execute it as you do in the so-called “Notebook” interface. Just the “enter” key will suffice. I needed to open the kernel from the Start menu of Windows. Then I tried to test it out:

In:= 39/7

39
Out= --
7

OK, the interpreter works, and it works the way it seems to in the “Notebook” interface. You can also get help from a command by placing a question mark before it:

In:= ?Plot
Plot[f, {x, xmin, xmax}] generates a plot of f as a function of x from xmin to xmax.
Plot[{f1, f2, ... }, {x, xmin, xmax}] plots several functions fi.

But the plotting of graphs  in kernel mode is a little … uh … different:

In:= Plot[Sin[x], {x,0,2Pi}]

#               ####
1#            ####  #####
#          ###         ###
#        ###             ###
#       ##                 ##
#     ###                   ##
0.5#    ##                      ##
#   ##                        ##
#  ##                          ###
# ##                             ##
###                               ##
### #  # # #  # # # #  # # #  # # ###  # # #  # # # #  # # #  # # # #  ###
############################################################################
#          1           2          3  ##       4          5           6##
#                                     ##                             ##
#                                      ##                          ###
#                                       ##                        ##
#                                        ##                      ##
-0.5#                                         ###                   ##
#                                           ##                ###
#                                            ###             ##
#                                              ###         ###
#                                                ####  #####
-1#                                                   ####

So, it’s probably better to use the Notebook mode for graphs…

Being a math program, you can create your own lists or generate new lists from Mathematica’s “Range” function:

Range[min,max,increment]

A “List” function can generate arbitrary lists:

In:= List[1,2,3,-4,dog, cat, Sin, "Hello World!", {a, b}, Pi, {}]

Out= {1, 2, 3, -4, dog, cat, Sin, Hello World!, {a, b}, Pi, {}}

In:= Range[-12,15,7]

Out= {-12, -5, 2, 9}

Notice the last output was for a Range command I inputted. The command asked for every 7th number between -12 and 15, including -12.

It doesn’t have loops in the pascal sense, but it has iterators, which are more compact. Here, I generate 50 random numbers:

In:= Table[Random[],{50}]

Out= {0.384617, 0.0481281, 0.278996, 0.161237, 0.880606, 0.587204, 0.996814, 0.0335705, 0.367147, 0.730021,

>    0.195816, 0.707583, 0.316029, 0.030375, 0.971311, 0.607889, 0.172245, 0.461959, 0.511372, 0.001557, 0.830695,

>    0.517233, 0.716287, 0.984279, 0.446078, 0.469105, 0.437292, 0.823042, 0.565472, 0.881901, 0.440478, 0.789472,

>    0.198325, 0.151881, 0.244661, 0.0818886, 0.882296, 0.121506, 0.27335, 0.474, 0.71005, 0.659546, 0.761978,

>    0.472443, 0.879355, 0.142313, 0.0456913, 0.488163, 0.433277, 0.673208}

{50} refers to the number of times the Random[] command must be repeated. Trouble is, the output looks a bit messy. You can clean this up by dividing the {50} into two dimensions, then tacking on a //TableForm modifier to the end of the whole command:

In:= Table[Random[],{10},{5}]//TableForm
Out//TableForm= 0.503921    0.225364   0.462814   0.985969   0.276704
0.613243    0.320156   0.961345   0.836671   0.519041
0.827408    0.256483   0.473772   0.283214   0.222593
0.39894     0.308651   0.763449   0.460018   0.900552
0.908033    0.286537   0.931285   0.096198   0.404112
0.0611721   0.468471   0.110229   0.127408   0.447929
0.148315    0.148884   0.290737   0.928888   0.320907
0.8924      0.816965   0.645673   0.098314   0.493461
0.508314    0.882225   0.638296   0.592909   0.600281
0.595688    0.707011   0.496711   0.196169   0.534516

This looks a bit better. {10},{5} specifies 10 rows and 5 columns. But of course you can have counters:

In:= Table[i*j, {i, 1, 8}, {j, i, 8}]//TableForm
Out//TableForm= 1    2    3    4    5    6    7    8
4    6    8    10   12   14   16
9    12   15   18   21   24
16   20   24   28   32
25   30   35   40
36   42   48
49   56
64

Here are the equivalent of two nested loops. You can think of “i” as the outer loop, and “j” as the inner loop, and I think the whole thing will make sense. And the loop syntax will accept a fourth parameter for loop increment:

In:= Table[i*j, {i, 1, 8}, {j, i, 8, 2}]//TableForm
Out//TableForm= 1    3    5    7
4    8    12   16
9    15   21
16   24   32
25   35
36   48
49
64

This one causes j to go to every second number. Note the change in the output. With a few more number operations, I can have 100 dice rolls in table format:

In:= Table[IntegerPart[Random[]*6]+1, {10},{10}]//TableForm
Out//TableForm= 6   3   6   6   4   4   5   2   5   1
5   5   3   2   3   1   2   1   5   6
2   2   6   1   2   5   6   2   4   2
2   1   6   1   3   2   3   5   6   2
1   5   2   2   6   4   3   1   5   5
3   6   1   3   1   6   1   3   4   4
5   4   4   3   4   6   3   2   4   3
6   1   6   4   4   2   6   1   3   3
5   5   6   6   6   1   2   3   3   2
6   2   5   6   6   1   5   2   2   5

IntegerPart[] takes the place of Trunc[] in many languages, returning the integer part of a number containing decimals. The chopping, or truncation of decimals is necessary to guarantee a dice roll between 1 and 6. Round[] is also available if you wish to experiment with it. It will round, but you will be rolling some zeroes as a result.