Python/Sage: Bisection Method


The Intermediate Value Theorem provides a theoretical basis for finding the roots of a continuous function. The Bisection Method starts with two x-values whose corresponding function values have a different sign (positive/negative or negative/positive). The Intermediate Value Theorem guarantees the existence of an x value between them with a function value of 0.  Guessing the midpoint of the interval either finds the root or, more likely, is either positive or negative. Depending on the sign the root will either be to the left (or right) of the midpoint. Each iteration reduces the length of the interval in which the root is by half. I've put together some Python code to work through the algorithm, it's posted on the Python/Sage page. Copying the code into a Sage Cell Server gives the output above.

Here are some issues that caught my eye:

  • The Washington Post has a piece about a, "mother, former teacher and full-time practicing attorney in New Jersey..." who is challenging a superintendent over opting out of Common Core. Get out of her way!
  • Common Core wasn't ready to be implemented in my state and that led to a lot of teachers scrambling to develop the resources to implement the standards. Apparently other teachers have experienced something similar--but they're getting a little more help. The Saint Louis Post-Dispatch reports that Representative Kurt Bahr doesn't want, "...educators, teachers and business leaders paying out-of-pocket to help develop Common Core replacement standards -- but to fix that, the state will have to shell out nearly $89,000 later this year."
  • The Daily Signal reports on the pushback against Common Core in Mississippi and Wisconsin. From the article, "But as the deadline for implementation loomed closer, states began to realize the costs of adopting Common Core, both financial and in terms of their educational decision-making autonomy. By June 2014— two months before the implementation date— 19 states had either withdrawn from the tests or paused implementation of the standards."
  • TechRadar gives Microsoft's Mathematics the thumbs up: "The program is a completely free complex calculator that has everything you'd expect on a small screened scientific calculator or graphical calculator just in a larger and more manageable screen without the tedious button combinations that have plagued regular plastic calculators."

Fractal World Generator


Fractals are are one of the more popular topics in mathematics because of all the interesting and unusual pictures they create. They also tie in with recursion and limits and some have unusual properties such as the Koch's Snowflake having finite area and infinite length perimeter. But it's also worth mentioning that nature can display fractal qualities as well; consider the list at Wikipedia. Fractal World Generator provides a more visual example: students can set a seed value, the percentage of water and ice, the type of map projection, color pallete, and other parameters and create their own fractal world graphic which can then be downloaded. Make sure you check out the "Animated Globe" map projection. I've added the link to the Fractal World Generator page. It's under the Mathematics links on the sidebar.

Here are some other recent events and changes:

  • In the last post I posted code for Riemann sum using the left hand rule. I've posted the code for right hand rule and midpoint rule to the Plotting with Sagetex page.
  • The 2015 Zurich Challenge is over and Nakamura has claimed yet another title, on an Armageddon playoff game versus Anand. Though officially second, Anand has to be happy for winning the Classical chess portion of the tournament. Chessbase has a good report here.
  • Education Next has an article on "competency-based learning" where students advance upon mastery. I like this idea but the concept would be less "radical" if schools would enforce a standard which would keep failing students from going on. If you've ever had to teach Algebra 2 to students who had trouble with arithmetic you know what I mean. Graduating from high school has to mean students have mastered "the basics".
  • Arizona has taken a step towards eliminating Common Core.
  • Here's a website with integral tables and other resources to download. They even have the tex files.

Plotting with Sagetex: Riemann sums


Using the power of Sage to handle graphing Riemann sums seems only logical. I managed to accomplish the task using the plotting template from an earlier post, so it's easy to add the grid or scale--just indicate the number of rectangles you want. The template is for using the left hand rule to determine the height; you can find the template on the Plotting with Sagetex page. The code for creating the rectangles was done through a for-loop. Clumsy, but I haven't seen a way around that yet.

Here are some issues that caught my eye:

  • Common Core testing is happening this week. As I mentioned in previous posts (here and here) there were known issues using the computer to enter the math. It seems utterly irresponsible to have the test results of a subject dependent on working the clumsy math keyboard. Not all states will use the computer but US News tells us what the experience is like for the third grade level.
  • At higher levels, the input of math answers, since it can involve square roots and other operations not on the keyboard, can be more complicated. The Wall Street Journal notes, "“If you don’t have that access to keyboarding, you’re just not going to do as well,” said Pete Just, chief technology officer for Metropolitan School District of Wayne Township, where computers are used for some testing, on the west side of Indianapolis.....State officials say there has been a wide range of responses to keyboarding preparation. Los Angeles, the second-largest district in the country, offers typing classes as they are requested by schools.".
  • has more specifics for the local population: "They are longer, taken mostly on computer, and are based on new expectations (standards) of what kids should know and do at each grade..... Each student in Ohio between third and ninth grade will take about 10 hours of tests spread over eight or nine days -- or even more.". With respect to computer testing, "Some districts have complained that they do not have enough computers or Internet capability to give the tests online. Several superintendents recently told the Senate Education Committee that online tests won't accurately measure what a child knows in the tested subject, and scores will also depend on a kid's computer proficiency.....Mentor Superintendent Matthew Miller had a very different report for the Senate Education Committee about the technology. He outlined several glitches with the programs, including kids not being able to log on, being booted off the computers and seeing questions disappear from the screen. Miller declared that Ohio is not ready for online testing."
  • Breitbart reports that the California bill for Common Core is over 1 billion dollars every year setting up Common Core, "In 2013, California coughed up a whopping $1.25 billion to districts to facilitate Common Core training, instructional materials, and computers. Moreover, last year they gave an additional $26.7 million for high-speed internet. This year $100 million was allocated to school districts for internet needs. Daniels asserted that’s not going to be enough to satisfy Common Core requirements."

Odds and Ends, February 12, 2015


  1. I've added another math article template to the LaTeX page. This one uses the Classic Thesis style.
  2. Three chess packages were added to the LaTeX page.
  3. The Problem page has another problem, due to Leibniz; he demonstrated that \sqrt{6}=\sqrt{1+\sqrt{-3}}+\sqrt{1-\sqrt{-3}}.
  4. Carlsen tied with Naiditsch at the Grenke Chess classic with Magnus winning on tiebreaks. Chessbase has the report here.
  5. Have you ever gotten tired of keeping your students off the portable distraction devices. It might be addiction! If you saw the recent viral photo of someone checking their cell phone while missing the giant humpback whale nearby or saw the report on Japanese teenage girls spending 7 hours on their phones you will have no trouble believing Science Daily's article on the use of mobile technology by children. "The authors question whether heavy device use during young childhood could interfere with development of empathy, social and problem solving skills that are typically obtained by exploring, unstructured play and interacting with peers....."'Until more is known about its impact on child development quality family time is encouraged, either through unplugged family time, or a designated family hour," added Radesky."
  6. Voice of America asks, "Is America in a Math Crisis?". Well known mathematician and author Albert Posamentier asserts, “Elementary school teachers in this country, and Europe as well, are part of that general population and consequently they bring that dislike of mathematics subconsciously, sometimes consciously at other times, to the classroom and as a result the teaching mathematics at the elementary school level lacks motivation, lacks enthusiasm.  The enthusiasm of the teacher  is extremely important in turning kids on to the subject matter". Let's also remember that 1/3 of high school math teachers don't have a degree in mathematics. The problems aren't just limited to elementary school.
  7. A 10 year old Chinese girl made the Wuhan Evening News for her poem on the tortures of math: “Math is the root of death and it makes life like hell. It wears out children and worries parents. It expels the vitality of school and slowly takes away life.”. Needless to say, I disagree.
  8. An 8th grader who through the American flag out of a classroom window is now in serious trouble: From the article, "The principal called the school resource officer with Rio Arriba County, but because it is a federal offense they referred him to the FBI. “I want to report it to them because it is a federal law, so it’s in their hands,” Archuleta said. Last week, he suspended the 14-year-old last week for 10 days, but he is recommending long-term suspension or expulsion."

Handouts: Stern-Brocot/listing rationals


In earlier posts I mentioned the Stern-Brocot sequence and how it can be used to create another sequence that lists the positive rationals in lowest form exactly one time each. There was a lot of information on the subject so I put together a PDF containing that information plus a little bit more--it's posted on the Handouts page.  In addition to the Numberphile, the link to the Caulkin, Wilf paper, the tree of rationals, and Sage Code I've included an algorithm along with a dry run (shown above) along with some other information from the Caulkin-Wilf paper and some sample questions/tasks that can help flesh out a lesson to your class:


The "Fact" box above as well as the box containing the Sage Code below were created using the tcolorbox package.


So, if you plan on using the Stern-Brocot sequence there is now 1 resource containing all the components of the Stern-Brocot sequence.

Here are a few things that caught my eye recently:

  • The Grenke Chess Classic 2015 has one round to go with Carlsen and Naiditsch tied for first and several others in striking distance. In the even of a tie there will be blitz games to decide the winner of the tournament. The games stream here. (Click "Live")
  • In the last post there was an item about the shift in the debate over Common Core. Rather than deal with constant criticism the new approach is to say Common Core is about standards, not content. That's misleading from my experience because standards drive content. So schools look to buy Common Core aligned material which help set the level of difficulty and subject matter. The problem of 4 ways to subtract caused a backlash because it was showing up in the textbooks. And as RT notes in this video,  Common Core has legible handwriting taught in kindergarten and first grade only. This skill, no longer being required at higher levels is replaced with other content. As a result, many schools have stopped teaching cursive. The result are kids who can't read or write cursive. It's a piece with a lot of interesting arguments.

Python/Sage: Stern-Brocot sequence


In the last post I mentioned Numberphile's excellent video on the Stern-Brocot sequence. The explanation of how the sequence is formed is clear enough but extra time will be needed to make sure students know how the sequence is formed. That would mean discussing the algorithm for how the sequence is formed, using the algorithm to create the sequence and then getting them to calculate some terms of the sequence on their own. I put together a quick Python program to create some terms of the sequence and then show the sequence of positive rational numbers. Having a list of both sequences will help to catch any mistakes you might make from, say, getting distracted/interrupted fielding questions along the way. The code is posted on the Python/Sage page.

Here are some other events that caught my eye recently.

1. The 13th Tradewise Gibraltar Masters tournament has ended with Hikaru Nakamura in clear first place followed by David Howell second and a big tie for 3-11. Now all eyes are on Grenke which will continue with round 4. You can follow the game here. (Click Video)

2. I stumbled onto a PhD Dissertation on "Students' Errors in Graphing Calculator Based Precalculus Classes". It's worth looking at some of the misconceptions and examples that caused students to struggle.

3. Politifact weighs in on the Texas governor's claim, "it takes "more than a minute" to teach a student "how to add nine plus six."". Lost in the claims and counter claims (Common Core is standards not content) is the fact that the new materials which are aligned to common core have this bizarre new math. Remember, for example, the 4 methods of subtraction? It's in the books that teachers have to teach out of and wasn't in books before Common Core.

4. An excellent web page on Using Writing in Mathematics.


Counting the Rationals


In The Most Important Lesson of High School Math I mentioned that I thought the goal of the high school math curriculum should be to get students to the point that the rational numbers have measure zero (while avoiding such technical speak). The video I linked to (How Big is Infinity) took students through Cantor's diagonal argument that the positive rational numbers can be listed. That list, however, has different forms of the same number (4/2=2/1=8/4=...). But I frecently found a post by Numberphile on the Stern-Brocot sequence. This sequence has a nice property: take the ratio of consecutive terms  \frac{a_n}{a_{n+1}} to create another sequence which lists every positive rational in lowest terms exactly once. A brief paper by Caulkin and Wilf has more of the mathematics. I've put together a tree diagram that was used to explain how the rational numbers are created. You can find the PDF and tex file on the Graphics page. The Stern-Brocot sequence and the rational sequence resulting from the ratio of consecutive terms would be a good example to put into your coverage of sequences.

Some other points of interest:

  • I found a minor mistake in the code for the last post. If you look at the screen shot I've got y_coords and y1_coords used in the same IF statement. I've fixed the file and uploaded it.
  • I've started a list of LaTeX packages that are important/useful to me when I'm using LaTeX; it's on the LaTeX page. There's been a big increase in packages over the years and I'm finding new packages that weren't around years ago. Since I can't keep always remember the package or the commands, I'm listing the packages which are linked to the CTAN documentation.
  • The Gibraltar tournament is into round 7 of 9 and Nakamura is in the lead. Meanwhile, the Grenke Chess Classic 2015 has started. It's got Carlsen, Anand and many other top players. You can follow the games by clicking on the link and then pressing the "Video" tab.
  • CBS MoneyWatch has an article on "Teacher Pensions: the Math Adds Up to a Crisis". From the article, "Teacher pension plans across the country are staggering from a half-trillion dollars in debt. Put in perspective, that's more than $10,000 worth of debt for every student in the nation's primary and secondary schools.".
  • The Houston Chronicle tells us: "Teachers would be able to use deadly force against students, and would be safe from prosecution, under legislation filed last week in the state House. The Teacher’s Protection Act by Rep. Dan Flynn, R-Van, would allow educators to use force or deadly force  if they feel they need to protect themselves against a student or anyone else on school grounds.". The article references, "The bill was filed just days before a video of a New Jersey physics teacher being body slammed by his 9th grade student went viral. In the video, it’s clear the teacher is avoiding fighting back or touching the student." Check out the video of the teacher being slammed; he's remarkably calm during the attack. But is giving a teacher the right to use deadly force a solution?

Plotting with Sagetex: scaled axes



The latest additions to this site include a link (What are TeX and its Friends?) to the LaTeX page and the latest in sagetex plotting (added to the Plotting with Sagetex page). That plotting template solves the problem of scaled axes. It doesn't work with the Altermundus packages. My experimentation with using Sage as the plotting engine has demonstrated:

  • For best results use sagetex with pgfplots
  • \sagestr should be used to insert the entire tikzpicture environment into the LaTeX document (rather than inserting some plot data into an already defined tikzpicture environment)

The latest template combines the look and feel of the template here along with ability to scale the axes--see that post for a little more information about the plotting parameters. You can see in the screenshot that the y axis has been compressed to half its normal length. In this latest template I've used Sage to plot the function, calculate it's derivative at a point and use that derivative in plotting the tangent. The template can be downloaded on the Plotting with Sagetex page.

Sage Interact: Tangent Line Approximation


I've added a Sage Interact on secant line approximations to the tangent line to the Python/Sage page as well as the Sage in the Classrom page. Presenting the concept in Interact form (as opposed to animated gifs) means there 3 functions bundled into 1 example and you can talk through the theory and change the figure when you're ready.

Here are some things that caught my eye recently:

1. The Tata Steel Masters tournament is over: it was a "nothing special" win by Carlsen. He didn't play the best but it was good enough to win. Chessbase has a video interview with Carlsen here. Hou Yifan performance was up to her rating, but was a little disappointing from my perspective. Although she showed the talent to cause problems to some of the best players she was only able to win one game. Aronian and Jobava had very poor tournaments.

2. The Gibraltar Chess Festival started. It's an open tournament with a lot of top players: Topalov, Nakamura, Hou Yifan, and Svidler to name a few. The games along with commentary can be found here.

3. John Whitehead has horrifying statistics in a must read article: "Handcuffs, Leg Shackles, and Tasers: The New Face of Punishment in Public Schools". From the article, "Roughly 1500 kids are tied up or locked down every day by school officials in the United States.

At least 500 students are locked up in some form of solitary confinement every day, whether it be a padded room, a closet or a duffel bag. In many cases, parents are rarely notified when such methods are used.". And, as he says, these tactics are legal. Make sure you click on the link to this older Pro Publica article.

4. Teacherweb has  a nice PDF on using graphing calculators in the science classroom. Although this resource only discusses TI-81, 82, 83 and Casio-fx 7700GE calculators, it's worth adapting the content to your specific calculator.

Odds and Ends: Jan 23, 2015


  1. I've posted two more derivative problems on the Sagetex:Derivatives page; one problem is finding the slope of the tangent line at a particular point on an ellipse (screenshot above) and the other is finding the equation of a tangent line of a rational function at a particular point.
  2. In the last post I mentioned the OpenTextBookStore. They have a good selection of math textbooks. I've posted the link to their catalogue on the sidebar.
  3. Ten rounds are done in the Tata Steel Masters tournament. ChessBase has the report on round 10 here. Carlsen leads with 3 rounds to go but he faces MVL next round. Hou Yifan has played competitive games with Carlsen, Aronian, and Caruana but was the victim of a miniature against VanWely in round 10. She faces the tournament cellar-dweller Jobava tomorrow. This will give her a decent chance to notch her first win if his poor performance holds up for another game. The games stream here.
  4. Infowars reports that Illinois has a new law that will bring criminal charges against any student suspected of cyberbullying who refuses to give his/her social media passwords to school administrators.
  5. Infowars reports that students at high schools in Texas were accused of racism after chanting "USA! USA!" after winning a girls basketball game. From the article, "Slaton Superintendent Julee Becker argued that the chant was used in a divisive and offensive manner.“The chant USA should be for all of us, it should be inclusive,” Becker said. “We are making other people aware of what that behavior by just a few, what impact it had on us, us as a tiger nation and family.”.........
    Although Idalou students denied claims that the chant had racist overtones, Waller stated that his district would no longer permit the use of “USA!” at sporting events."