# 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).

# 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.)?