# Sage Interact: Chain Rule

I've added Sage Interact code for generating problems with derivatives, and the user can decide whether the problems require the Chain Rule or not--the screenshot above shows it running on this website. The code, which was designed last year, was created because I needed more problems (with a higher degree of difficulty). At the time, I had students who wanted more practice problems (because they wanted to be able to practice working with more difficult problems) so I ended up giving out the very rough code. I've since cleaned up the code to make the difficulty level more uniform.

The code can be found on the Python/Sage page but since it was designed for the classroom and found some use with my students, it is also on the Sage in the Classroom page.

The basic structure of the code is that the first 6 problems don't involve the Chain Rule, but problems 7-12 require the Chain Rule. Therefore, if the user requests Chain Rule problems then, because the Chain Rule problems are lumped together, a random number from 7 to 12 is repeatedly generated. So if you want to add your own types of problems to the code, make sure that you are grouping Chain Rule problems together.

A more subtle issue to be aware of is when you see code like this:

while i == j and j== 0:
j = Integer(randint(0,len(TheFunctions)-1))

The code is throwing out the possibility of nesting the same exact functions (eg $latex \sin(\sin(x)$) but the j==0 code is more subtle. It throws out the possibility of having $latex e^x$ in the denominator because, for example, if the user has chosen to create problems that don't require the Chain Rule the code might create a quotient problem where $latex e^x$ is in the denominator but then Sage converts it to a product involving $latex e^{-x}$ which requires the Chain Rule.

I've two lines of comment to my code because I've had some inquiries about using some of the resources from this site. With respect to the SageTex problems on my website, the problems are generic in nature so I don't think that I or anyone has the rights to it. For example, the Limits8 problem is the sort of problem you would expect to see in any Calculus textbook. I've just randomized it using Python so I can create randomized tests with answer keys. That saves time and eliminates mistakes.

With respect to Python code that I've created, it should be viewed as Copyleft:
https://en.wikipedia.org/wiki/Copyleft

Essentially any non commercial use for educational purposes only is okay.

This website contains material I develop for use in my classes, and I hope it can help other teachers out. It would be better still if others can contribute copyleft code, such as SageTex problems, so that the database of problems gets bigger even faster. But using code developed here to sell as your own would not be advisable.

Here are some other issues that have caught my attention since last time:

• PerDaily.com has an interesting piece on textbooks that are never obsolete. It asks the question, "What if a school districts...owned all the copyrights of all the textbooks they used and had their teachers, who were so inclined, write chapters for these textbooks." . And a little further down, "Furthermore, the whole nature of textbooks and supporting materials could easily be changed with access to the Internet where these textbooks could constantly be edited and updated in material with new writing and online links as time goes by and the reality of the subject changes. Wouldn't this obviate the necessity of ever having to scrap textbooks in what remains an unnecessary and expensive process every 7 years that clearly only benefits the interests and profits of textbook publishers?". I like the basic idea but I don't like quite a few of the specifics of implementation.
• Alternet.org has a disturbing article: Imagine a student who, "had reportedly been bullied for years at school, hounded with homophobic slurs and constant harassment.". He snapped one day, threw the first punch, and got beaten up badly enough to be in the hospital for 7 weeks. The others involved had no injuries. But what makes this story enter the bizarre is that, "...school officials and local police delivered another blow to Martin by charging him with two counts of assault and refusing to allow him back into the school until he signs a written statement saying he threatened the school (which he denies).". Check out the local TV video coverage.

# SageTeX: Limits (10)

I've added another problem to the SageTex: Limits page. The screenshot is above.

Here are some current events that caught my eye recently:

• Who hasn't heard about the Marysville shootings?: Local new station Q13Fox has extensive coverage here.
• NY Daily News has a story on the 3 Colorada high school students who skipped school and headed to join IS. The FBI was alerted ..."when they discovered the girls' passports — along with $2,000 in cold, hard cash — were gone."". They were stopped in Germany and returned to the US and, as the article says, "It was not immediately clear whether the girls will face charges."....$2,000 just sitting around the house?!?
• Interested in making a lot of money teaching? The NY Daily News tells us about The Equity Project Charter School where teachers start at $125,000 and "...can also qualify for bonuses of more than$10,000". After four years of data, the schools' students, "...achieved scores on state exams as if they had received an extra 1.6 years of math instruction and an additional six months in science and reading instruction, compared with kids from similar backgrounds at neighboring schools.". So $125,000 for (not counting holidays) less than 9 months of teaching. Is it safe to assume that the vacancies don't come around often there?!? • Time Magazine is under attack from the teachers' union for a "malicious" cover that is anti-teacher. The hysterical nonsense from the teacher unions is hard to take. The cover claims that ""It’s Nearly Impossible to Fire a Bad Teacher. Some Tech Millionaires May Have Found a Way to Change That.”". The article itself says, "Critics say that the nuance of the article itself is steamrolled by the magazine's anti-teacher cover...". The American Federation of Teachers is demanding an apology. One of those interviewed states, ""It's not true that it's 'impossible to fire a bad teacher,' whatever that means," she said. "Unions give people due process."". Seriously? The cover said it was "nearly impossible" to fire a bad teacher and that's been documented for years. Read about "rubber rooms" in the New Yorker from 2009. It was such a big deal "The Rubber Room" even became a documentary movie. The New Yorker describes in lots of detail about all the money that is paid to teachers for not teaching precisely because it's too difficult (some might say "nearly impossible") to get rid of a bad teacher. These are teachers that fail by nearly every measure but, a key sentence from the New Yorker article says, "“If you just focus on the people in the Rubber Rooms, you miss the real point, which is that, by making it so hard to get even the obvious freaks and crazies that are there off the payroll, you insure that the teachers who are simply incompetent or mediocre are never incented to improve and are never removable,” Anthony Lombardi says.". But that was years ago, right? That couldn't still be happening? Wrong. Check out the NY Post article from 2013, "One year on the job, 13 years in rubber room earns perv teacher$1M". Or how about the NY Post article from just a couple of weeks ago on teachers getting disability for school related stess? Read about one teacher who was sent to a, "...rubber room after investigators watched her helping in her husband’s Staten Island deli on two days she called in sick. The DOE tried to fire her, but a hearing officer fined her two months’ pay. She then filed for disability.". The money paid out was, "...$48.5 million last year to 2,299 teachers on ordinary disability retirements.". A private school approach would eliminate the expensive cost of removing bad teachers. It would also mean the end to excessive and expensive layers of administration that help drive up the cost of education while adding little value. Perhaps if less money was spent protecting incompetent teachers then good teachers could earn a good salary that would keep them teaching. If not, there's just The Equity Project Charter School. # SageTeX: Limits (9) I've added another limit problem to the SageTex: Limits page. The problem type has the form$latex \lim_{x \to -3}\frac{\frac{1}{3}+\frac{1}{x}}{3+x}$. Some events that caught my eye: # Sagetex: Limits (8) I've added another problem to the Sagetex: Limits page. The problem, shown above, is on using the Squeeze Theorem to establish a limit. Here are some recent stories that stood out: • Vincent Knight, from the blog Un pue de math, has posted 21 videos on "Basic LaTeX using Sagemath Cloud". The videos are posted here. • Do you know 4 methods for subtracting numbers? The Erick Erickson Show has an example of Common Core math that is causing headaches for parents. I've been fortunate to not have had to teach from stupid material like this. You can understand why Common Core has lost a lot of support. • A Baltimore teacher gets into a fight with a student and some of it is recorded on video. WBAL TV11 has the local news report (which includes video). "Officials said the incident started as a verbal confrontation that turned physical. The question is whether the teacher acted unprofessionally or if she was just overly frustrated with the student, who sources said was the instigator.". The article continues, "City schools spokeswoman Anne Fullerton sent 11 News a statement, saying, "The teacher was treated for injuries and has been placed on administrative leave pending the outcome of external and internal investigations. The student, a minor, was charged with assault and released to a parent."". # Sage: Menger Sponge The Menger Sponge is a 3 dimensional fractal with infinite surface area and zero volume. I put together some code to create the fractal but it's been plagued with problems. The screenshot above shows it running for the second iteration. It worked for 3 iterations, initially but now it doesn't but strangely enough the same code will render a 2 dimensional picture of the 3 dimensional object: I've posted the first 4 iterations of the Menger Sponge on the Graphics page. The code that generated the images is posted on the Python/Sage page. The basic process behind the code is mentioned in this Scientific American article. The output was as a .gif file and it was converted to PDF (and jpeg above) using GIMP. Some stories that caught my eye: • The Atlanta school cheating scandal is back in the news as the trial is going on now. Local news at Channel 2 in Atlanta has a report and video here. Two people have admitted to cheating saying they were told to. At the 1:30 mark, one witness says he didn't realize it was criminal. (?!). • An article from the NY Times, here, talks about the new Common Core based tests. The writer here, in NY, looks at the version her child will be taking and brings up a potential problem: "In many ways, it is a better test than the fill-in-the-bubble multiple-choice exams of my youth. With a computer-based test, the questions can be more complicated but still easily graded. Both consortiums also offer paper versions for the time being, because not all schools have enough computers and Internet connectivity."................" But for other questions, the test provides a more complex equation editor — rows of buttons including numerals, mathematical operations like add and subtract, a tool to enter fractions — for entering the answer. A keyboard and mouse is not a natural way of doing math, and I wondered whether these questions would be more a test of computer interface. Laura Slover, the chief executive of Parcc, asked me if I had done the tutorial before taking the practice test. I had not. I asked if it was reasonable to expect that all students would have the time and opportunity to do that. She said the organization encouraged taking the tutorial, and that in the field test last spring, students who practiced beforehand did not find the computers an obstacle. Hint to parents: If your children are to take one of these tests, make sure they puzzle out the interface first.". This sounds like a disaster in making. It's difficult to imagine all these families taking the tutorial before taking the computer based test. # LaTeX: Behavior Log I've added a behavior log to the Procedural page. As part of progressive discipline policies, this is a useful form to have. Do you have a student who you've talked to already about staying on task? Get out the behavior log write his name down, the date, and the problem (eg playing a video game on his cellphone). And then get their signature. If the student refuses then their defiance is good reason to send them to the dean's office. Once the behavior log is signed you've got a record of the student' problems along with the student's admission of guilt. Having a behavior log gives you a way to de-escalate conflicts with students: just walk back to your desk, get the form out, and come back. You should, of course, include information in your syllabus about how you use the behavior log. For example, 3 behavior problems results in a parent teacher meeting. When students know you have the their signed confession and that there is a consequence/annoyance for the third strike, students are more likely to keep their behavior in check. For those students who just don't care, you have the documentation you need for the parents along with the signature of their little angel admitting guilt on multiple occasions. Here are some stories that caught my eye. • Philly.com tells us a "war" is coming: "By activating its nuclear option and cancelling its teachers' contract, the Philadelphia School Reform Commission took an action Monday that could remake the city's schools and have national implications.The unilateral step at a morning meeting has already set off a battle.". The article goes on to say,"The terms imposed Monday mean most PFT members will have to pay either 10 or 13 percent of the cost of their medical plan beginning Dec. 15, depending on their salaries. They now pay nothing if they opt for a basic plan. Officials said workers would pay between$21 and $200 per month, beginning Dec. 15.The changes will save the cash-strapped district$54 million this school year, officials said, and as much as $70 million in subsequent years.That money, SRC Chairman Bill Green said, will be invested directly in classrooms, with principals empowered to use the cash as they see fit - to hire a full-time counselor and nurse, perhaps, or to pay for more supplies or after-school programs.Green said district principals, blue-collar workers, and families have stepped up, and it was time for the teachers to do the same." • The Las Vegas Review Journal reports on changes in sex education that have upset the local community: "Considered changes include education of homosexuality as early as ages 5 through 8 and giving everyone “respect regardless of who they are attracted to.”Children of that age range also would be taught that “touching and rubbing one’s genitals to feel good is called masturbation.”“You want to teach my 5-year-old how to masturbate?” said parent Julie Butler, referencing the item getting the most attention Monday night."........."Clark County Superintendent Pat Skorkowsky tried to calm the approximately 50 parents by asserting that the curriculum is not proposed for the district’s 357 schools.The district is just gathering community input, he said.". Public outrage resulted in a public apology. The local news reports say, "In an Oct. 3 letter to parents, Clark County School District Superintendent Pat Skorkowsky said, “I believe that our school district has inadvertently broken trust with many of our families and with some members of our Board of Trustees.”He said the problem was created when the district set up a series of invitation-only community forums to discuss possible changes in sex education curriculum. “We made a misjudgment when we put out a document in these community forums from the Sexuality Information and Education Council of the United States, also known as SIECUS,” Skorkowsky said."....."“I regret that we made these decisions, and that we did not open these initial input sessions to the general public,” Skorkowsky said. “We also should have notified the Board of School Trustees as a whole about the documents that were passed out at the forums.“I am sorry that the trustees have taken criticism over the situation because they did not approve this process as group, and some of them, including Board President Erin Cranor, did express objections to the methodology of the meetings.”" # Sage Interact: the Birthday Problem The Birthday Problem asks the question: In a group of n people, what's the probability that at least 2 will have the same birthday? Answering the Birthday Problem involves creating a mathematical model. The model rests on two assumptions that aren't true and should be discussed with the class: • there are 365 days in a year (Feb 29th is ignored to simplify the model) • birthdays are equally likely to be on any given day (Also false. This varies from country to country; in the US birthdays are more towards the middle of the year. Count back 9 months and you've got cold weather. Nothing random there.) Under those assumptions the sample space is$latex 365^n$, since there are 365 choices for each birthday. Counting the number of ways that nobody has the same birthday is just (365)(364)....(365-n+1), giving us the probability of at least 2 people with the same birthday as the complementary probability: 1-[(365)(364)....(365-n+1)]/(365)^n$.

This simple model yields surprising answers: with a group of only 50 people the probability of at least 2 people with the same birthday is 0.97; this illustrates how counter-intuitive probability can be. So is the model any good? It turns out that although the model is built on incorrect assumptions, experimental evidence validates gives results that are close to the model. That's a basic fact about models; they're based on assumptions that in many cases aren't true. Ultimately, experimental evidence is needed to determine whether the model is accurate. Try the Birthday Problem with each of your classes and find out how well it works with 1 class, with any 2 classes, any 3 classes, and so on.

I've created code for computing the Birthday Problem given n people and plots the probabilities on a graph. You can see the output above; the code is on the Python/Sage page.

Some stories that caught my eye recently:

1. Education Next has articles on "Rethinking the High School Diploma". Three articles consider the idea of having 2 diplomas: 1 for graduating and the second higher diploma for excellence/mastery. It seems symptomatic of today's culture. You can't enforce standards so everybody needs to graduate and the diploma lacks value. So create a second diploma which will show the employer the student has mastered the basics. An interesting idea.
2. Businessweek has an article suggesting that the US should station soldiers in schools, similar to air marshalls on a plane. The Call of Duty author has, "...anticipated objections. “The public won’t like it, they’ll think it’s a police state,” he said. But, he went on, “All of these are solvable problems.” Anthony’s address, which was punctuated by videos depicting such future threats as a U.S. drone hacked by Iran and a hotel massacre in Las Vegas, included repeated exhortations to policymakers to learn from the examples of corporations and creative artists in selling potentially unpopular ideas. “When we have a new product that has elements that we’re not sure how people will respond to, what do we do as a corporation?” he asked. “We market it, and we market it as much as we can—so that whether people like it or not, we do all the things we can to essentially brainwash people into liking it before it actually comes out.”". Incredible.....
3. Huffington Post reports on teachers behaving badly: "Louisiana Teachers Planned Illicit Group Sex With Student: Police". The article states, "Police now say that one of the Louisiana high school teachers accused of having group sex with another teacher and a 16-year-old student had previous sexual encounters with the minor.". There's a video from Huffington Post.

# Sagetex: Limit of a rational function

I've added another problem to the Sagetex: Limits page. There are three different variations of the problem depending on whether the polynomial in the numerator has a degree which is greater than, equal to, or less than the degree of the polynomial in the denominator. Choose which type of rational function you want for your test/quiz. Delete the rest.

The Sage code for the problem contains some noteworthy features. The line

R.<x>=QQ[]

is used to specify that the coefficients of the polynomial are rational numbers. A random polynomial is defined by

N = R.random_element(degree = degree)

and the issue to be aware of is that if, for example, degree = 5 (or any integer) then the polynomial created has degree less than or equal to 5. Therefore, I created a WHILE loop to discard any polynomial with degree < degree. Since the polynomial degree is random, Sage has to convert it to a string of LaTeX code. The rational function, in LaTeX, is created here:  output = latex(N/D) and then inserted into the problem using \sagestr.

Several stories at Democracy Now! caught my eye: