# Sagetex: Derivatives page and problem

I've started a page for derivatives using SageTex and posted the first problem. The link to the page is located on the sidebar or you can click here. The first problem is taking the derivative of a polynomial to an integral power, using the Chain Rule. You can see a screen shot above.

Here are some things which caught my eye recently:

• ABC news reports that students in Florida were caught running a high school prostitution ring. You can read the lurid details here.
• The NYPost reports that East Side Community HS ran a 2 day course on how students should deal with police officers. The article states, "Principal Mark Federman said he brought in the NYCLU because students told teachers they had bad experiences with being stopped by police. He said the training also was relevant to history classes studying the Ferguson, Mo., shooting.".
• Learning LaTeX?  Dickimaw Books has a  free book "LaTeX for Complete Novices" which can be downloaded here.

# Problem: Combinatorics

I've added another problem to the Problems page: How many triangles have vertices using the points above?

Here are some things which caught my eye:

# Sagetex: Random pictures

In an earlier post I experimented with random bipartite graphs. With a little more practice under my belt, I've incorporated the same basic idea to create a random picture that is used in the latest addition to the Sagetex:Combinatorics/Probability page; problem 14. There are actually 3 problem variations here, depending on how deep you want to go into the classic problem of finding the number of shortest paths in a grid. There are several random aspects of the problem: the number of vertical lines in the grid, the number of horizontal lines in the grid, and the placement of the point M in the grid that all "special" paths must go through.

The basic idea for these problems is that your LaTeX file is a string and a part of the string will be created in sagesilent and then inserted into your latex document with a statement like \sagestr{output}. By creating the string in the sagesilent environment you're getting the power of Python and Sage commands. LaTeX was made for typesetting, so it's computational skills are limited. By tapping into Sage's calculating power combined with Python commands (for loops, strings) the sagetex package vastly increases the power of what can be accomplished in LaTeX.

The latest problem has you determine:

• the number of shortest paths from A to Z (bottom left to top right)
• the number of shortest paths from A to Z that go through M
• the probability that a randomly chosen shortest path goes through M

Here is the sagesilent code from the latest problem. Note that the blog has destroyed the indentation which is necessary in Python. You should download the template (problem 14 on Sagetex: Combinatorics/Probability) for correct formatting.

\begin{sagesilent}
k = Integer(randint(6,9))
n = Integer(randint(5,6))
m2 = Integer(randint(n-4,n-2))
m1 = Integer(randint(k-5,k-2))
output = r""
output += r"\begin{tikzpicture}[scale=.7]"
for i in range(0,n+1):
output += r"\draw (0,%s)--(%s,%s);"%(i,k,i)
for i in range(0,k+1):
output += r"\draw (%s,0)--(%s,%s);"%(i,i,n)
output += r"\draw [fill] (0,0) circle [radius=2pt];"
output += r"\node [left] at (0,0) {$A$};"
output += r"\draw [fill] (%s,%s) circle [radius=2pt];"%(k,n)
output += r"\node [right] at (%s,%s) {$Z$};"%(k,n)
output += r"\draw [fill] (%s,%s) circle [radius=2pt];"%(m1,m2)
output += r"\node [above left] at (%s,%s) {$M$};"%(m1,m2)
output += r"\end{tikzpicture}"
\end{sagesilent}

For the code above k and n are the length and width of the rectangle, so there are k+1 vertical lines and n+1 horizontal lines. Point M will have the coordinates (m1, m2). After choosing n, k, m1, and m2 randomly the picture that you would normally create in the body of your latex document is "typed" in sagesilent as a string, called output. The command: output += r"\begin{tikzpicture}[scale=.7]" starts building the string. The r occurs before the " symbol to indicate that a raw string is used. This is needed because LaTeX has various symbols, such as \, that aren't treated properly if output was a normal string. The default scale is 1, I've dropped it to .7 to make the picture smaller. This allows me you put have a bigger grid for your picture without it running out of the margins.

Python for loops create the horizontal lines

for i in range(0,k+1):
output += r"\draw (%s,0)--(%s,%s);"%(i,i,n)

and vertical lines

for i in range(0,k+1):
output += r"\draw (%s,0)--(%s,%s);"%(i,i,n)

The %s is the string content that will be filled in. In

output += r"\draw (%s,0)--(%s,%s);"%(i,i,n)

there are 3 strings that have data that needs to be determined by Python. The respective values will be i, i, and n, which are varying depending on where you are in the for loop.

The placement of points is determined through commands like

output += r"\draw [fill] (%s,%s) circle [radius=2pt];"%(m1,m2)

There are 2 strings that need to be filled. The first string is that random value m1 and the second string will be the random m2 value.

Creating random test/quiz problems save you time in creating tests, provide you with a solution, and eliminate potential mistakes. Have a student who missed your test? Create a different version quickly.

Here are some current events that caught my eye.

• As you probably know, Asia is the land of fakes. Whether it's fake Rolex watches, fake DVD's, fake designer bags, or fake Ferraris, appearances can be deceptive. You need to be alert to fake doctors, fake teachers (with fake diplomas) and fake monks. It should be no surprise that cheating is rampant in Asia; it's so "advanced" there you might call it an art form. A great example of this is the cheating scandal a couple of years ago. Lots of students tried cheating, and some teachers caught them. That led to a firestorm, "By late afternoon, the invigilators were trapped in a set of school offices, as groups of students pelted the windows with rocks. Outside, an angry mob of more than 2,000 people had gathered to vent its rage, smashing cars and chanting: "We want fairness. There is no fairness if you do not let us cheat."". So it should be no surprise to hear about the latest cheating in China. First up is the cheating on SATs in Asia. From the article: "Bob Schaeffer, public education director of the nonprofit National Center for Fair & Open Testing, known as FairTest, said that his organization had received several e-mails from sources in Asia alleging that the SAT given on Nov. 8 was circulating among students before it was administered. One message included a screen shot of what appeared to be an entire SAT exam in Chinese.". Technically, this cheating allegation hasn't been confirmed but anyone with experience in Asia knows it has to be true. In fact, the article mentions, "Many local educators believe that the test-makers did not aggressively pursue cheating claims to protect the reputation of their flagship product, the SAT.", so I suspect this will get swept under the rug. You can get more details from an earlier story.
• The Daily Mail highlights some of China's attempts to crack down on cheating in high school. From the article, "With thousands of Chinese students resorting to 007-style gadgets such as pinhole cameras and radio transmitter bras to cheat in their exams, one college decided to take a stand....

Security staff in Jinlin, Jiangsu and Guangdong provinces revealed that students started using sophisticated radio vests in order to receive help from someone outside the hall.

Pupils were also taking pictures of the tests using a button-hole camera hidden in a pen or watch, then using a copper antenna loop stitched into their clothing to beam it out of the hall to someone sitting with a receiver".

• 2440 students were caught cheating in China on a pharmacy exam. Here's a video of news coverage.
• ZeroHedge had a piece that illustrates how high school quality has dropped: the article says, "The number of college students taking at least one remedial course rose to 2.7 million in the 2011-2012 academic year from 1.04 million in 1999-2000, federal data show. During the same span, the amount of federal grants spent by undergraduates enrolled in at least one remedial course rose 380%, after inflation, Education Department figures show. There was also a drastic rise in remedial students taking on student debt."
• RT reports that a racist high school administrator tweet led to a student walk out.
• LA Times tells us about 6 students getting arrested after fights break out. The school had to go into lockdown. Education is not what it used to be.

# Current Events: November 17, 2014

A quick post as there has been a lot happening recently:

• The World Chess Championship has 6 games completed. Magnus has the lead with 2 wins to 1. Game 6 featured a simple blunder by Carlsen and Anand misses the simple reply only to have his position collapse a little bit later. Chess.com has  coverage here. Fellow GMs were left scratching their heads at Anand's inability to find the winner. Kramnik had the harsh quote, “I didn't have many opportunities to win [a world championship game] in one move, but I when I did I wasn't missing them.”. On one level that's right: you can't give away free points. On another level, he's watching the match because his poor play couldn't win the qualifying tournament.
• In "Big Numbers: Google Challenges Wolfram to Open Up Math", we learn "....Google throws down a gauntlet against claims of ownership of mathematical truths by the likes of Wolfram:

Modern mathematics research is distinguished by its openness. The notion of “mathematical truth” depends on theorems being published with proof, letting the reader understand how new results build on the old, all the way down to basic mathematical axioms and definitions. These new results become tools to aid further progress.

".  The article praises Sage and Sagemath Cloud and points out that for Mathematica "the information generated by its software is novel, the results of its calculations may be subject to copyright by Wolfram." Exactly right. How'd you like to do some great research and find it was now Wolfram's? Moreover, Mathematica is a "black box" and like all software would be subject to bugs. For all you know, it might be giving you wrong output. Remember the Pentium FDIV bug?? Intel knew of the flaw and said, essentially, it was no big deal. With Sage, mistakes can be found and fixed and you can check for bugs. With Mathematica you can never really be sure.

• Terry Tao is one of the most famous mathematicians alive. He made an appearance recently on The Colbert Report. Learn about "sexy primes" and maybe have a laugh or two.
• E-books directory posted a nice Calculus and Analytic Geometry book. There are some problems with references and you'll see some ?? as if they forgot to LaTeX twice for the references but the book is worth downloading.
• A school teacher in Texas was fired over some bad tweets. USA Today has the details and the local TV coverage here.
• A shooting "drill" in Florida put a school on lock down and had police officers bursting into classrooms with guns drawn and scaring a lot of kids. They promptly texted there parents to spread the fear around. "The school sent an email out after the exercise, called a "lockdown active shooter drill," to let parents know it had taken place." but defended their decision to tell them after and not before in order for the response to be more realistic. "...some parents feel it was extreme for police to have their guns drawn.". The local TV station has an account here.

# SageTex: Tables with a random number of columns/rows

The sagetex package documentation has, on page 9, a passage on one of the most useful applicaations of sagetex: making it write your code for you. The documentation gives an example of creating a table. At this site, I've already used it to create a trig table and a log table. Today I've added another problem to the SageTeX: Combinatorics/Probability page that creates a table that has a random number of columns/rows; you can download the tex file and play with it yourself in Sagemath Cloud. The problem type has the form: Imagine you have two 7-sided dice in which the sides of each die are equally likely to occur. Create a chart to show all possible outcomes and use it to find the probability that the sum is prime. You can see a screenshot above showing the code and output. The value of 7 is random (I allow it to be between 4 and 7 so that creating the chart isn't too easy or too difficult) and the goal, in this cas "the sum is prime", is random as well. The solution then will involve creating a table of random size.

Tinkering with the rows is trivial: just print more lines. Adjusting the columns is a bit more complicated: it uses the idea that, in Python, 'my string'*5 will print out 'my string' 5 times. The table is created in the sagesilent environment and the random number of columns is set by

output += r"\begin{tabular}{c|"
output += 'c'*n
output += r"}"

where string 'c' is repeated n times (n has already been defined as a random integer between 4 and 7). That simple construction is all you need. But sagetex also helps us construct the table entries and compute the answer we seek thereby eliminating mistakes. The row construction is here:

for i in range(1,n+1):
output += r"%s &"%(i)
for j in range(1,n+1):
output += r"%s "%(i+j)
if j < n:
output += r"& "
else:
output += r"\\"

and the part worthy of comment is that the IF statement is there because, as long as we aren't at the last column we need to add an ampersand (&) otherwise, we're at the end of the line, so start a new line. Finally, there are 3 different events to calculate. The code is set up so you can easily add your own cases. Getting used to producing LaTeX code as a Python string takes a little time but it's well worth it. How long would it take you to create the trig table or log table that I've posted without using sagetex?

Here are some issues that caught my eye:

• Have you ever had the annoying "When will I ever use this?" question come up in your class? Douglas Corey of Brigham Young University has some answers.
• An annoying article, "Why Homework Is Bad for Kids". This sorting of thinking infects the public school system and is one reason for poor student performance in mathematics. You simply can't get the repetition needed to build mathematical skills during the school day and homework is the test of whether a student has mastered what was covered in class (when nobody is around to help them). The author writes, "We like to think all of this makes sense: It is well tested and, besides, it is what everyone is doing worldwide. No wonder we lose our markets to Japanese, Chinese, and Korean kids. Their schools are more strict and they study harder.Yet every element of this familiar equation is questionable.". It DOES make sense and of course, the author avoids coming up with another reason for why these other nations do better. The author points out that "...even in countries as workaholic as Japan, the number of hours kids are forced to study is becoming an issue of concern.". Note how lame this argument is, without more facts. IF a US student spends 20 minutes on homework and IF a Japanese student spends 4 hours on homework then arguing that Japan's push for less homework justifies our having 20 minutes (instead of 1 hour) doesn't make sense. But of course, the author doesn't give you the important information to put the issue into context.
• It's not math related but "I F@$#ing love science" has a nice video on "10 Lies You Were Probably Taught in School". This is a good site for any science teachers out there. WARNING: DO NOT open their Facebook page or Twitter feed at school. Some users have inappropriate avatars. # Inquiry Based Learning Inquiry Based Learning (IBL) is a teaching method "that engages students in sense-making activities. Students are given tasks requiring them to solve problems, conjecture, experiment, explore, create, and communicate... all those wonderful skills and habits of mind that Mathematicians engage in regularly.". The website I linked to has lots of information on running a class using IBL. While I don't think it's practical to run a standard classroom that way because the curriculum couldn't be covered, I do think it's an important part of teaching. With 1100+ pages of material that needs to be covered for my accelerated precalculus class, finding time for IBL is not always so easy. Most of the time I have to resort to bonus problems in order give an IBL type problem. But finding these more nuanced problems isn't always easy. In an earlier post, I gave a link to the problems that Phillips Exeter Academy posts on their website. The IBL site I linked to above has lots of links to helpful resources. The goldmine, for me is Art of Mathematics website which has 11 free PDF books that you are free to download. The books have titles: Art & Sculpture, Calculus, Dance, Games & Puzzles, Geometry, Knot Theory, Music, Number Theory, Patterns, The Infinite, Truth, Reasoning, Certainty, & Proof. There's something for everybody. And the materials are well thought out. If you look around the site, there's plenty of useful information to get you started on the road to IBL. One of the links is to a site for IBL Calculus. I've added Exeter's problems and the Art of Mathematics books to the mathematical links on the sidebar. Here are some things that caught my eye: # SageTex: Limits (12) I've added two versions of the problem above depending on whether you start with the difference of two logs or the division of two logs; they're posted on the Sagetex: Limits page. Here are some stories which caught my eye recenty: • TIME magazine has an article "How to Ditch the Common Core and Teach Kids Real Skills". The author, "holds a Ph.D. specializing in education evaluation from U.C. Berkeley" so I was expecting some good insights. I was stunned just how ignorant the writer is and how the writing wandered all over the place. A PhD in education evaluation doesn't have a whole lot of value. Look at this statement: "Take, for example, Algebra 1, considered (falsely, as I will argue later) a critical course.". HUH? Algebra IS a critical course and many students struggle in Calculus precisely because their algebra skills aren't strong enough. Look through the article and try to find where the author shows algebra is not a critical course. It's not really clear to me what that is...it seems to be related to this passage, "Meanwhile, the curriculum does not focus on helping students graduate with far more critical skills: tools for resolving conflict without fisticuffs, parenting skills or financial literacy such as smart ways to save and borrow and estimation skills, for example, whether a person can afford to move out of his parents’ house.". The math to see whether you can afford to move out of your parents' house is important and has nothing to do with algebra..is that the argument? The writer asserts that "trigonometric reciprocal functions", solving systems of linear equations and knowing the interpretation of the slope of a line is "esoteric" and claims "....we require all high schools students to learn that arcana while allowing them to graduate without basics?". What do you think the basics are if not arithmetic and algebra (with respect to math)? How can you go on to college math without knowing concepts like slope or solving systems of linear equations? This is just too typical for me; someone with a poor background in math having a strong opinion on what's appropriate in math and how it should be taught. Following their "standards" would put the US even further down the rankings for math. That ignorance is on display with this howler, "First things should be first. You shouldn’t teach the area of the parabola unless a student knows how to estimate the full four-year cost of college attendance. At some point, a student may get to the point where the esoterica is next in line, but most of that would occur in college or graduate school.". The area of a parabola?!? It's amazing to see this sort of ignorance on display. The problem with these "experts", when they aren't from the hard sciences, is that "expert" and "PhD" aren't worth a whole lot. Unfortunately, they often have an influence on policy, even if it's on a subject that they didn't master at the elementary school level. • Business Insider has some of the Common Core math that's not like what you learned in school. I actually use the box method for multiplication but how about that NC diagram for addition? # Odds and Ends: Nov 2, 2014 I've added a new problem to the Sagetex: Limits page. The screen shot above shows the general form of the question: Evaluate the limit:$latex \displaystyle \lim_{x \to 1}\frac{x^{7}-1}{x^{3}-1}$. The Problems page has also had a trig problem added to it: Prove$latex \frac{\pi}{4}=4\arctan\left(\frac{1}{5}\right)-\arctan\left(\frac{1}{239}\right)\$. This problem is intended for the best of an accelerated class. I would expect to use it in a weekly (optional) problem competition.

Here are some current events that caught my eye:

• The Daily Signal has "10 Reasons Why Common Core  Should Spook You This Season"
• It doesn't matter what metric you use to judge a teacher; the new metric will result in some teachers doing worse, some staying the same, and some improving. And in the US that means lawsuit. The Washington Post has an article on a 4th grade teacher in NY who has been penalized by recent changes. It seems like spooky reason number 10 from the Daily Signal: The one size fits all, top down approach has some experts designing a model that will quantify teacher effectiveness. The top down approach means that there is an industry of "experts" that live off of providing a plan or model to "solve" a problem which is then "implemented" on everybody, resulting in all the deficiencies being brought to light which leads to a backlash and the push for a "better" solution. Poltifact has an article which, thankfully, shows US test results versus the world; In math we've gone from 18th (out of 28) against industrialized countries (2000 data) to 27th (out of 34) for 2012 data. A decade of time shows the top down government model has done poorly but don't expect accountability for being terrible at what you do in government. How much money was wasted to get that level of performance?