Sage Interact: Chain Rule

ChainRuleI'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 \sin(\sin(x)) but the j==0 code is more subtle. It throws out the possibility of having 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 e^x is in the denominator but then Sage converts it to a product involving 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.
  • NJ.com has an article on a teacher who had their license suspended for making comments about a student's name on Facebook. The article says, ""The student's name contained a curse word and Nichols allegedly posted 'I want to ask the parents if I can change it' and 'I still can't get over the student's name!'" it said. "In response to others' comments about the name, Nichols allegedly wrote "How do you think I feel when I have to address him???? I literally can't stop laughing! I have to go all year with this’---!!!'"". Some people have WAY too much free time on their hands. With the potential for some serious penalties, cue the violins, as the teacher in question, "...told the board she was under significant stress at the time due to a recent divorce and struggling with diabetes.The board agreed not to revoke Nichols' teaching certificates permanently, instead ordering a one-year suspension of them because she had "fully accepted responsibility for her actions.""She has also undertaken counseling to deal with her level of stress and many responsibilities,"".
  • 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)

Limits10I'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)

Limits9I've added another limit problem to the SageTex: Limits page. The problem type has the form \lim_{x \to -3}\frac{\frac{1}{3}+\frac{1}{x}}{3+x}.

Some events that caught my eye:

Sagetex: Limits (8)

Limits8I'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

MengerSCThe 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:

Menger4I'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

BehaviorI'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

BirthdayProbThe 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 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

Limits7I'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:

Altermundus: creating simple geometric diagrams

I've added an example to the page on creating lines and rays with the Altermundus package. The additional information is posted here. Start with a typical geometric diagram you might need to construct in high school mathematics.

TrigDiag1I'm calling the diagram "simple" because it consists of line segments, angle markings and text. In order to create the lines, you need 2 points. Therefore, when you look at the diagram you should see 9 points are needed.

TrigDiag1a

I take the bottom left point to be the origin but that isn't required. The building on the left is made up of 4 points:

\tkzDefPoint(0,0){A1}
\tkzDefPoint(1,0){B1}
\tkzDefPoint(1,2){B2}
\tkzDefPoint(0,2){A2}

The building on the right has 5 points:

\tkzDefPoint(5,0){D1}
\tkzDefPoint(6,0){E1}
\tkzDefPoint(5,5){D2}
\tkzDefPoint(6,5){E2}
\tkzDefPoint(5,2){H}

Once you have the 9 points defined you create the line segments. In addition to \tkzLabelSegment there is \tkzDrawPolygon. The \tkzDrawPolygon takes 3 or more points and creates polygon defined by them. The building on the left and right are \tkzDrawPolygon(A1,A2,B2,B1) and \tkzDrawPolygon(D1,D2,E2,E1), respectively. The dashed lines are created:

\tkzDrawSegments[dashed](B2,H B2,D2 B2,D1)

Be careful here! Note that there is a space after every 2 vertices. Putting a comma between them causes an error. After that the \tkzLabelSegment is used to get text.
\tkzLabelSegment[above=3pt](B2,H){$x$}
\tkzLabelSegment[left=3pt](D2,H){$a$}
\tkzLabelSegment[right=3pt](B1,B2){$100$ ft}

and finally the angles are marked and labelled.

\tkzLabelAngle[pos = 0.75](H,B2,E2){$42^{\circ}$}
\tkzMarkAngle[size=0.75cm](E1,B2,H)
\tkzLabelAngle[pos = 1.0](E1,B2,H){$20^{\circ}$}
\tkzMarkRightAngle(B2,H,D2)

Note the is a special command to create the right angle mark.

By breaking down a simple geometric diagram into the points needed to create the lines, you can easily decompose the picture into pieces that can be plotted with the macros mentioned. Define the points, create the lines, and add the text. See the page on creating lines and rays with the Altermundus package for the complete file to create the diagram.

Sagetex: derivative as a limit

LimDQI've added another problem to the Sagetex: Limits page. Find the derivative of quadratic function using the limit of a difference quotient. The screenshot is above.

Several stories caught my eye recently:

  1. William Stein, the driving force behind Sage, reports on a, "major 3d update. Print worksheets with embedded 3d graphics. Pan with alt/command. Plots persist between refreshes.". More details can be found here.
  2. The Washington Post has a piece about an "award winning" principal who used to support Common Core and is now opposed to it. She writes about the "Four Common Core 'Flim-Flams'".
  3. Common Dreams reports: "Hundreds of students from high schools across Colorado's Jefferson County school district walked out of classes on Monday, Tuesday, and Wednesday this week, protesting attempts by rightwing members of the school board to amp up what they consider the "positive aspects of the United States and its heritage" within the district's history curriculum while minimizing focus on more progressive aspects of history such as people's movements, the history of struggle, and "social strife."". The article says, "that plan would look at Advanced Placement history courses to make sure materials "promote citizenship, patriotism, essentials and benefits of the free-market system, respect for authority and respect for individual rights" and don't "encourage or condone civil disorder, social strife or disregard of the law."" A passage from a piece on the Breitbart website gives a student opining, "...the nation's foundation was built on civil protest, "and everything that we've done is what allowed us to be at this point today. And if you take that from us, you take away everything that America was built off of."".
  4. This hasn't gotten much publicity: AL.com reports, "A secret program to monitor students' online activities began quietly in Huntsville schools, following a phone call from the NSA, school officials say.". According to the school officials they were alerted to a student making threats on Facebook. "The NSA, a U.S. agency responsible for foreign intelligence, this week said it has no record of a call to Huntsville and does not make calls to school systems.". So now Huntsville City Schools are looking at social media sites for gangs, guns, and threats of violence. One school official says, ""There was a foreign connection," said Wardynski, explaining why the NSA would contact Huntsville schools. He said the student in Huntsville had made the online threats while chatting online with a group that included an individual in Yemen.". But it's not just Huntsville. The article continues, "A company called Geo Listening watches social media for school districts including Glendale, Calif. Their web site reads: "Geo Listening's unique monitoring service will process, analyze and report the adverse social media from publicly available student posts... We align our reporting criteria with existing school district procedures and board policy as they relate to student conduct & safety."".