# Thoughts on Numerical Integration (Part 23): The normalcdf function on TI calculators

I end this series about numerical integration by returning to the most common (if hidden) application of numerical integration in the secondary mathematics curriculum: finding the area under the normal curve. This is a critically important tool for problems in both probability and statistics; however, the antiderivative of $\displaystyle \frac{1}{\sqrt{2\pi}} e^{-x^2/2}$ cannot be expressed using finitely many elementary functions. Therefore, we must resort to numerical methods instead.

In days of old, of course, students relied on tables in the back of the textbook to find areas under the bell curve, and I suppose that such tables are still being printed. For students with access to modern scientific calculators, of course, there’s no need for tables because this is a built-in function on many calculators. For the line of TI calculators, the command is normalcdf.

Unfortunately, it’s a sad (but not well-known) fact of life that the TI-83 and TI-84 calculators are not terribly accurate at computing these areas. For example:

TI-84: $\displaystyle \int_0^1 \frac{e^{-x^2/2}}{\sqrt{2\pi}} \, dx \approx 0.3413447\underline{399}$

Correct answer, with Mathematica: $0.3413447\underline{467}\dots$

TI-84: $\displaystyle \int_1^2 \frac{e^{-x^2/2}}{\sqrt{2\pi}} \, dx \approx 0.1359051\underline{975}$

Correct answer, with Mathematica: $0.1359051\underline{219}\dots$

TI-84: $\displaystyle \int_2^3 \frac{e^{-x^2/2}}{\sqrt{2\pi}} \, dx \approx 0.021400\underline{0948}$

Correct answer, with Mathematica: $0.021400\underline{2339}\dots$

TI-84: $\displaystyle \int_3^4 \frac{e^{-x^2/2}}{\sqrt{2\pi}} \, dx \approx 0.0013182\underline{812}$

Correct answer, with Mathematica: $0.0013182\underline{267}\dots$

TI-84: $\displaystyle \int_4^5 \frac{e^{-x^2/2}}{\sqrt{2\pi}} \, dx \approx 0.0000313\underline{9892959}$

Correct answer, with Mathematica: $0.0000313\underline{84590261}\dots$

TI-84: $\displaystyle \int_5^6 \frac{e^{-x^2/2}}{\sqrt{2\pi}} \, dx \approx 2.8\underline{61148776} \times 10^{-7}$

Correct answer, with Mathematica: $2.8\underline{56649842}\dots \times 10^{-7}$

I don’t presume to know the proprietary algorithm used to implement normalcdf on TI-83 and TI-84 calculators. My honest if brutal assessment is that it’s probably not worth knowing: in the best case (when the endpoints are close to 0), the calculator provides an answer that is accurate to only 7 significant digits while presenting the illusion of a higher degree of accuracy. I can say that Simpson’s Rule with only $n = 26$ subintervals provides a better approximation to $\displaystyle \int_0^1 \frac{e^{-x^2/2}}{\sqrt{2\pi}} \, dx$ than the normalcdf function.

For what it’s worth, I also looked at the accuracy of the NORMSDIST function in Microsoft Excel. This is much better, almost always producing answers that are accurate to 11 or 12 significant digits, which is all that can be realistically expected in floating-point double-precision arithmetic (in which numbers are usually stored accurate to 13 significant digits prior to any computations).

# Engaging students: Probability and odds

In my capstone class for future secondary math teachers, I ask my students to come up with ideas for engaging their students with different topics in the secondary mathematics curriculum. In other words, the point of the assignment was not to devise a full-blown lesson plan on this topic. Instead, I asked my students to think about three different ways of getting their students interested in the topic in the first place. I plan to share some of the best of these ideas on this blog (after asking my students’ permission, of course). This student submission again comes from my former student Angelica Albarracin. Her topic, from Pre-Algebra: probability and odds. How can this topic be used in your students’ future courses in mathematics or science? Probability is a topic that commonly appears in biology in the study of sexual reproduction. Both in freshman and college level biology, students are required to learn how to create and use Punnett squares. Punnett Squares are used to determine the likelihood certain alleles will appear in the offspring of 2 organisms. These alleles can do anything from determining eye color, to determining whether or not an organism will have a hereditary disease such as hemophilia. Though statistics is not a required mathematics class for high schoolers in the state of Texas, many students will end up encountering this class in high school and/or college as it pertains directly to many fields of study such as math, biology, chemistry, and physics. One of the most important concepts in statistics is the idea of statistical significance. Using the scientific method and other techniques for conducting a survey or experiment, it is easy to analyze, and record data. However, a major component of statistics is being able to interpret the implications of any given data. One of the biggest indicators that an experiment or survey that was conducted holds real implications is its statistical significance, which is essentially a measure of the probability of observing results as extreme as what was observed. How has this topic appeared in pop culture (movies, TV, current music, video games, etc.)? Speed running is a category of gaming that has become hugely popular over the years in which highly skilled and knowledgeable players compete amongst each other to complete a game as fast as possible. One of the most popular of these games in this scene is Minecraft and due to Minecraft’s popularity, speed runners of this game often come within seconds of world records, meaning every small optimization could be the difference between 1st and 2nd place on the leaderboards. Minecraft is a highly open and adventurous game primarily because each “world” is randomly generated, meaning that no two playthroughs are alike. This randomness not only encompasses world generation, but also factors into the availability of resources in the form of animals, enemies, and even ores used for building and crafting items. The most notorious section of the game where random generation plays a huge role in the speed run is in the collection of an essential item known as the ender pearl. In order to reach the final stage of the game, a minimum of 12 ender pearls are required, which can only be obtained from Endermen, a type of enemy in the game. Though ender pearls are considered an essential item for the completion of the game, it is theoretically possible to complete the game in its entirety without ever obtaining a single pearl.  This is due to a unique mechanic the game uses to allow the player into its final stages. Ender pearls are used in combination with a material called Blaze Powder to make a new item known as an Eye of Ender. Eyes of Ender are used to both locate a special portal to allow players into the “End” and to activate said portal. This portal (known as the End Portal) can only be activated with 12 eyes, but this is where the game’s inherent randomness plays an important factor. For each of the 12 slots in the portal dedicated to the placement of the eyes, there is a 10% chance that there will already be one inside, meaning the player would not need to provide one of their own. It is also important to note that while Eyes of Ender are used to locate this portal, it is completely possible to find this portal on your own, it is simply faster to use the Eye of Ender as a guide (and being faster is in the interest of speed runners). With this being said, the probability a player can complete the game without the usage of a single ender pearl is about 1 in 1 trillion! So, what’s the big deal? Speed runners can simply obtain the required pearls and ignore this possibility, right? Normally this would be the easy answer, but it becomes a bit more complex when we consider the nature of ender pearls. As mentioned earlier, ender pearls can only be obtained from endermen, and while their exact spawn rates are unknown, they are considered to be uncommon. In addition, each endermen has only a 50% chance of dropping an ender pearl upon defeat. If you consider this with the fact that enemies primarily spawn during the night cycle of the game, it is easy to see how obtaining these pearls can take a lot of time, something a speed runner wants to avoid at all costs. Consequently, runners are often put into a scenario in which they must balance their risk and reward. Though the probability a runner will encounter an End portal with all 12 eyes built in is near impossible, the likelihood that 2 or even 3 eyes would be there is not so low. Should a speed runner devote more time to finding ender pearls, though some of their effort maybe be for nothing, or should a runner find most of the pearls, and hope the rest are at the portal waiting? In a category of gaming where every second counts, probability can be used to figure out the most optimal answer to this question, and lead hopefuls to new world records. How can technology (YouTube, Khan Academy [khanacademy.org], Vi Hart, Geometers Sketchpad, graphing calculators, etc.) be used to effectively engage students with this topic? An important concept in probability is the Law of Large Numbers which states that “the relative frequency of an outcome approaches the actual probability of that outcome, as the number of repetitions gets larger” (see link below). This law can be easily observed through repeatedly tossing a coin or rolling a die, however, as the law suggests, this must be done a large amount of times. Tossing a coin 500 times in the classroom, while helpful to demonstrate this law in action, is time consuming and tedious. As a remedy to this, Texas Instruments developed an app for TI-84 graphing calculators called Probability Simulation. In this free app, students can choose from a variety of actions to simulate such as tossing coins, rolling dice, picking marbles, and drawing cards. In the image above, the calculator is simulating the results of rolling two die. There are many useful features and settings within this app but two of the best ones are the ability to perform an action 50 at a time (indicated by +50) and a graph to keep track of the results of all previous actions. Having the ability to perform each action quickly and in large quantity makes this a much less time consuming and material intensive activity. In addition, having a graph documenting each result from previous actions also helps tremendously in demonstrating the Law of Large Numbers as it acts as a visual aid. In the picture above, the rough formation of a bell curve can be seen after 501 rolls. References: https://education.ti.com/en/building-concepts/activities/statistics/sequence1/law-of-large-numbers https://www.minecraftseeds.co/stronghold-with-end-portal/ https://www.speedrun.com/mc/full_game#Any_Glitchless

# My Favorite One-Liners: Part 122

Once in my probability class, a student asked a reasonable question — could I intuitively explain the difference between “uncorrelated” and “independent”? This is a very subtle question, as there are non-intuitive examples of random variables that are uncorrelated but are nevertheless dependent. For example, if $X$ is a random variable uniformly distributed on $\{-1,0,1\}$ and $Y= X^2$, then it’s straightforward to show that $E(X) = 0$ and $E(XY) = E(X^3) = E(X) = 0$, so that $\hbox{Cov}(X,Y) = E(XY) - E(X) E(Y) = 0$

and hence $X$ and $Y$ are uncorrelated.

However, in most practical examples that come up in real life, “uncorrelated” and “independent” are synonymous, including the important special case of a bivariate normal distribution.

This was my expert answer to my student: it’s like the difference between “mostly dead” and “all dead.”

# Coin flips and independence

A new illustration for when I teach independence in probability. The math quote begins at about the 47-second mark of the video.

I’m doing something that I should have done a long time ago: collecting a series of posts into one single post. The following links comprised my series on what I’m calling the Facebook birthday problem, a simple variant of the classic birthday problem in probability.

Part 1: Statement of the Facebook birthday problem.

Part 2: Solution for expected value.

Part 3: Finding the variance (a).

Part 4: Finding the variance (b).

Part 5: Finding the variance (c).

I’m doing something that I should have done a long time ago: collecting a series of posts into one single post. The following links comprised my series on the Wason Selection Task.

Part 1: Statement of the problem.

Part 2: Answer of the problem.

Part 3: Pedagogical thoughts about the problem, including variants.

# Engaging students: Probability and odds

In my capstone class for future secondary math teachers, I ask my students to come up with ideas for engaging their students with different topics in the secondary mathematics curriculum. In other words, the point of the assignment was not to devise a full-blown lesson plan on this topic. Instead, I asked my students to think about three different ways of getting their students interested in the topic in the first place.

I plan to share some of the best of these ideas on this blog (after asking my students’ permission, of course).

This student submission again comes from my former student Victor Acevedo. His topic, from Pre-Algebra: probability and odds. How can technology be used to effectively engage students with this topic?

There is an online interactive game in which students practice their knowledge on probability. The game is called “Beat the Odds” and it is on PBS’s learning media website. There are two game modes: training and competition. In training mode, students must answer questions about finding the probability of various events. (rolling a die, picking from a deck of cards, etc.) For each correct answer, students earn digital money and the questions scale in difficulty. After the students feel that they have earned enough money, they can switch over to competition mode. Competition mode allows students to bet money against other bot players to see who can answer questions the most accurately. Students are asked various questions and whoever is the closest to the correct answer wins the money in the “pot.”  Students can keep playing either until they lose all their money or until they decide to get out while they are ahead. How has this topic appeared in pop culture (movies, TV, current music, video games, etc.)?

Probability is an integral part to sports analysis. In baseball, batting averages are used to determine a player’s batting ability by dividing the number of successful hits by the number of at bats. This statistic can be used to determine the probability that a player may hit a ball during their next at bat. For example, a player that has a .400 would have roughly a 40% chance of hitting the ball during their next at bat. By using a player’s batting average and other stats, teams can decide how to set up their line up for going up to bat. Typically, the players with the highest batting averages take up the first 5 spots in the lineup. The first three players need to be able to make it on to a base, while the fourth player needs to be a heavy hitter than can possibly have everyone score runs. Coaches consider every players’ batting averages, as well as other stats, to help them determine their best lineup and chances of winning. How can this topic be used in your students’ future courses in mathematics or science?

Quantum theory is a branch of physics that focuses on studying the different properties of atoms and particles. The most famous application of probability in quantum theory is the concept of the wave-particle duality of light. A thought experiment with Schrodinger’s cat helps to illustrate this idea in terms that most can comprehend. A cat is trapped in a box with a poison gas that is randomly released. As an observer, you cannot tell whether that is dead or alive unless you open the box. Schrodinger theorized that until the box is open, the cat is neither dead nor alive but rather in between. The concept of wave-particle duality states that light and other quantum sized particles can behave as either waves or particles depending on the observer. Theoretical physicists have concluded that this idea of fluctuating realities is an underlying truth of all probabilities. Because of this, physicists believe that either we must accept this as truth and hold true the possibility of multiple universes, or that there may be something wrong with the theory as it currently stands.

References

Fell, A. (2013, February 5). Does probability come from quantum physics? Retrieved from https://www.ucdavis.edu/news/does-probability-come-quantum-physics/

Freudenrich, C., Ph.D. (2000, July 10). How Light Works. Retrieved from https://science.howstuffworks.com/light6.htm

# My Favorite One-Liners: Part 114

In this series, I’m compiling some of the quips and one-liners that I’ll use with my students to hopefully make my lessons more memorable for them.

I’ll use today’s one-liner whena step that’s usually necessary in a calculation isn’t needed for a particular example. For example, consider the following problem from probability:

Let $X$ be uniformly distributed on $\{-1,0,1\}$. Find $\hbox{Cov}(X,X^2)$.

The first step is to write $\hbox{Cov}(X,X^2) = E(X \cdot X^2) - E(X) E(X^2) = E(X^3) - E(X) E(X^2)$. Then we start computing the expectations. To begin, $E(X) = (-1) \cdot \displaystyle \frac{1}{3} + 0 \cdot \displaystyle \frac{1}{3} + 1 \cdot \displaystyle \frac{1}{3} = 0$.

Ordinarily, the next step would be computing $E(X^2)$. However, this computation is unnecessary since $E(X^2)$ will be multiplied by $E(X)$, which we just showed was equal to $0$. While I might calculate $E(X^2)$ if I thought my class needed the extra practice with computing expectations, the answer will not ultimately affect the final answer. Hence my one-liner:

To paraphrase the great philosopher The Rock, it doesn’t matter what $E(X^2)$ is.

P.S. This example illustrates that the covariance of two dependent random variables ( $X$ and $X^2$) can be zero. If two random variables are independent, then the covariance must be zero. But the reverse implication is false.

# Engaging students: Probability and odds

In my capstone class for future secondary math teachers, I ask my students to come up with ideas for engaging their students with different topics in the secondary mathematics curriculum. In other words, the point of the assignment was not to devise a full-blown lesson plan on this topic. Instead, I asked my students to think about three different ways of getting their students interested in the topic in the first place.

I plan to share some of the best of these ideas on this blog (after asking my students’ permission, of course).

This student submission again comes from my former student Trent Pope. His topic, from Pre-Algebra: probability and odds. What interesting (i.e., uncontrived) word problems using this topic can your students do now?

This website contains problems that would be great for odds. On the worksheet it has you solving problems about the chances of getting different gumballs from a gumball machine and chances of winning gift cards in a drawing. These worksheets would be great because there are real life applications with these examples. On the worksheet students are to solve what color gumballs they could draw from the machine. This will give them a visual representation of their odds. In order to find their odds they must know all the required information such as the number of total gumballs and the number of each color. Then the instructor can ask the students any question about what they can draw. The other problem is that there are gift cards, coupons, and free admission to a theme park that a student draws from a hat. This would be another great example of how students can find the odds of what they can draw.

http://www.algebra-class.com/odds-and-probability.html How could you as a teacher create an activity or project that involves your topic?

This project idea comes from the game show Deal or No Deal. The purpose of the project would be for students to see what the odds are of winning more money than the amount offered from the Banker. For instance, the banker will offer you $100,000 to leave the show without seeing what is in your briefcase. The contestant would then look to see how many briefcases are left that could contain an amount greater than$100,000. If there are five chances out of the twenty remaining briefcases, the student would have a 5/20 chance, or 25% chance, to win more money. So, the contestant might want to say no deal because there is a higher chance of winning more money should he/she stay in the game. Students could go multiple rounds of this and see if their chances increase as the game goes on. This would engage students and they would look forward to winning the game show.

http://www.teachforever.com/2008/02/lesson-idea-probability-using-deal-or.html How has this topic appeared in pop culture (movies, TV, current music, video games, etc.)?