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

# Data Plot Template

In any group of students there are bound to be different opinions on math: from love to hate to fear.  And if you've ever experienced the joy of teaching proofs in geometry to students who question why they have to learn proofs, you'll know "real world" data can help make math more relevant to some students. Recently I was attempting to put together my own data. Creating plots with pgfplots is usually straightforward but I ran into a problem: my plot involved years on the x-axis and I was getting output with a comma; e.g 1,980 rather than 1980. As most $latex \LaTeX$ users will know, sometimes an easy task takes a long time to solve. Eventually I found the answer. In this case it involved:

\usepgfplots{dateplot}

\pgfkeys{

/pgf/number format/ set thousands separator=

}

Chances are, unless you work a lot with $latex \LaTeX$, you're unlikely to have dealt with dateplot and pgfkeys. Leaving the right hand side of the equal sign blank removes the comma. I know I'll forget this in another day or week, so I've posted a template on the Handouts page.

Here are some issues that caught my eye recently:

1. There's an interesting opinion piece on improving schools by letting teachers take over. Though I've got a different set of ideas, this was a well thought out article and is definitely worth a look.
2. The U.S. territory of Guam has a problem:  the legal requirement for students to have the resources are not met by the Department of Education. From the article,"Mead cited the Every Child is Entitled to an Adequate Public Education Act, which was signed into law in 2005.The law details 14 specific requirements that Guam DOE must meet to provide an adequate education for students on island.The tenth requirement states Guam DOE must have "adopted and required textbooks and workbooks issued to each public school student for the classes in which he or she is enrolled," according to the law." Guam's legislature blames budget cuts for lack of funds to buy books. With textbooks averaging about $100 per student, about 3 times the amount the have, you have to wonder how this gets resolved. In a private school model teachers could find their own set of resources (e.g. open source textbooks). But with the top down model where everything has to be approved, it looks like the students lose while law makers (rather than teachers) decide what's best. What could go wrong? 3. The current depression (Keynes: “a chronic condition of subnormal activity for a considerable period without any marked tendency towards recovery or towards complete collapse.”) has had a chilling impact on schools. A piece on ZeroHedge looks at a recent Washington Post article: for the first time In 50 years, the majority of public school students are in poverty. 4. The problem of not having enough money to spend on school textbooks in Guam can be solved with open textbooks (except you can bet there are lots of laws governing approved textbooks standing in the way). The OpenTextBookStore is one way to solve the problem: free textbooks (click the "Catalog" tab) which can be modified. From the website link:Copyright is usually used to restrict the rights of the consumer. Open textbooks are textbooks for which the author has granted a set of permissive rights. While slight variations exist on what people consider "open", they often include: • The right to use (read) the book without cost, typically through free online viewing • The right to share the book with others • The right to modify, adapt, or remix the book to fit your needs • The right to print the book for your own use 5. The emphasis on technology in US schools has always annoyed me. Even as they neglect to maintain standards (e.g. you have students who struggle with arithmetic in an Algebra 2 class---where they get access to a calculator which prevents them from ever gaining basic mathematical proficiency) administrations extol the need for expensive technology to give students "a 21 century education". Yet China and other countries manage to get students proficient in the basics without all these resources. And then there's this: while looking over the free course material for MIT, the notes for the Calculus text says on page 2: "(M.I.T. does not do much computing in the first year, and does nothing with graphing calculators.) But calculators are so convenient that we will see them more and more. They have the advantage of requiring less faculty time, as well as being personal and portable and not too expensive. ". So the public schools spend a lot of public money on education in pursuit of performance (but never really getting it) while MIT (and other countries) have better performance without it. Why the blind faith in expensive technology when the facts don't back it up? # LaTeX: Book Template I ran across an excellent LaTeX template on the TeXStackExchange site by user jqueralt but it was in Catalan. I've changed the language over to English and removed a lot of the filler to get the sized down. The result is an English version of his template; I've posted the modified template on the LaTeX page. A screen shot is shown above. It looks very professional but sending it to your printer will run through a lot of ink given all the dark text boxes. The tex file relies on a graphics image Remember, so make sure you download the image or the tex file won't compile. Some current events that caught my eye: 1. Five rounds of the Tata Steel Masters tournament are down and Ivanchuk is showing the youngsters that when he's in form he's still very dangerous. Hou Yifan has come back from losing the first two games to get 3 draws. She still has Carlsen and Aronian to face. I'll be curious to see if the pressure of this level of competition affects her play in the final 4 rounds of the tournament. If she can get used to this level of competition then she has a great chance to surpass J. Polgar (in the coming years) as the best woman player ever. The games stream here. 2. In the last post I mentioned the horrific killing of a teacher that was allegedly done by a student. How, I wondered, did kids get to this "level"? And when does it start? And then I saw this: People.com reporting that "4th Graders Plotted to Kill Teacher with Hand Sanitizer". The article reports, "The students allegedly plotted to put the substance on items they knew their teacher would touch after they learned that she wasseverely allergic to antibacterial sanitizer. The girls reportedly told their classmates that they were going to "kill" their teacher. Asked why they wanted to harm their teacher, the students reportedly told youth officers from Genesee County Sheriff's Department that the teacher "yells" at the students and that "the class has problems with her." The children were unable to carry out their attack on their teacher after another student not directly involved in the scheme reported it to his mother. While the girls won't face any legal repercussions for their plan, they were reportedly suspended, and the Sheriff's Department handed the case over to the Elba Central School District.". What has the culture come to that 9 year olds are allegedly planning murders? 3. A NJ teen says that his Common Core testing is "the most stressful thing" he's done and challenges board members to take it. He mentions the problems of the computer testing (I mentioned the potential for problems here). The teen testified: "In fact, it’s so convoluted that my class had to be given a lesson on accomplishing these operations. A 55-minute class for “writing” square roots, parentheses, exponents and so on. I can easily write these on a piece of paper. And this is just the math part of the exam. The Language Arts part (as I quote from a teacher), “is not for freshmen.”" 4. Forbes reports that children are having recess cut back or cancelled so more time can be spent in the classroom. The article says, "Increasing numbers of school administrators, teachers unions, and policymakers have taken the position that there simply isn’t enough time in the day to accomplish what needs to be done for students. If so, the solution is not to do away with recess. Instead, either lengthen the school year or think about cutting back on the teaching load." # Graphics: TI-84 plus calculator If you use a graphing calculator in your math class then you might have encountered problems in explaining how to use it to the class. Holding up the calculator, pointing to various buttons, and walking around the class to make sure everybody can see what you're talking is a bit clumsier than I like; especially when it comes to the sequence of keystrokes.$latex \LaTeX$to the rescue! The tipfr package can help. The calculator above on the right gives you a graphing calculator graphic to help. And the package also has graphics to just give you the screen output or the keystrokes. It's ideal for helping you explain the calculator to your class. There are several issues I found with the package, though: 1. The calculator is set up in French 2. The keys in the top row are too small 3. The keys are in lower case 4. Some of the keys are difficult to read 5. I'm not fond of the calculator color 6. There are no options to put a graph on the calculator screen So I hacked the style file to make my own version which is shown on the left. That calculator is posted on the Graphics page. I've changed the keys so they are in English and increased the size of the keys in the top row. Unfortunately, my tikz background is weak and the keys are a little off in shape. I've also increased the size of fonts for some keys, put others into all capitals and changed the calculator color to yellow. That makes the calculator look more like the one I use and it seems to make the letters stand out a little more. While hacking the style file I noticed there is a commented out line of code which lets you draw an image on the screen. It looks like the author thought about having an image on the screen but abandoned that for now. I've uncommented it and added a second plot as well. The package also lets you highlight various keys. I've chosen some keys to highlight and put them into a beamer slideshow. They're posted on the Handouts page. Here are some things which caught my attention lately: • The Tata Steel Masters tournament has started. It contains some very strong players: Carlsen, So, MVL, Caruana, Ivanchuk, Aronian, Radjabov, and more. Most interesting to me is the inclusion of Hou Yifan, the women's World Champion and one of the best female players ever. Ranked 70 in the world she will, however, be playing many higher rated players here. This tournament doesn't have any easy rounds for her and I'll be curious to see how she holds up against the relentless pressure. The games are streaming live here. • Those bygone days of smiling kids in a classroom have been gone for some time. The News and Sentinel reports on, "A teen charged with raping and killing his high school math teacher had a bloody box cutter and women's underwear in his backpack when he was detained...". Surveillance footage shows the accused teen (wearing gloves and a hood) following the teacher into a bathroom. Later, the footage shows him taking out a recycling barrel from the bathroom, which was found near to the dead teachers body. The 15 year old is alleged to have used the teacher's credit card for subsequent purchases; he'll be tried as an adult. • I ran across APEX Calculus 2.0---some top notch (free) calculus books (Calc 1, 2, and 3) made with LaTeX and Tikz. They are well written as well and plan (in future versions) to have 3D images that can be manipulated in the PDF. If you do anything related to Calculus then you simply must download these resources. # Odds and Ends: Jan 7, 2015 Some odds and ends for today: • There's a well known activity out there: take the digits of the year and use various mathematical operations to form the numbers from 1 to whatever. I ran across an example here, but if you take a look at the worksheet there is minimal space for showing the calculation. Moreover, it looks hideous--the sort of look you'd expect from one of those expensive document programs. I've altered the rules a bit for my version (eg avoiding factorials and double factorials), made it 2 single sided pages (1 double sided) and given a lot more space. It relies on the sagetex package to create the table so run it through Sagemath Cloud. You can, of course, easily modify the year or the instructions. I've posted the tex file on the Handouts page. • I've posted another animated gif on the Sage in the Classroom page. The function,$latex f(x)=x^{2/3}$has the function written on the gif. • The link for the American Mathematical Society's Google page was mistakenly put in with the LaTeX link. I've switched it to the math links. • With respect to current events, RT reports that Oklahoma wants to ban hoodies. Expect a backlash enforcing that in the public schools. IJReview has piece on 10 Common Core Math Problems That Children Should Win a Nobell Prize for Solving. The outcome of math ed people out of control. Take a look at problem number 10. # sagetex and pgfplots template A question came up on TeXStackExchange, so I took the opportunity to answer it with the latest improvements in plotting with sagetex. I've made the answer a plot template and posted the file on the Plotting with Sagetex page; the the output is shown above. The template is designed so the minimum/maximum values of x and y along with the step size to control the attributes of the picture. This prevents mistakes where a value (such as xmin) is used in multiple places with different values. And if we think about what we want to happen with plotting then it's something like: "Plot the point if it's on the screen". The problem is pgfplots still wants to connect the points together. I've gotten around this with the option unbounded coords=jump that will not connect points that have an infinite y value. So the IF-THEN-ELSE statement will check if a point is on the screen and (if it isn't) it will set the y value to infinity. If it is on the screen then the proper coordinate is created. Now pgfplots will skip over the points outside the window thereby creating the disconnected graph above. This is a big improvement over creating multiple plots and then piecing them together. # How do I....get fancy text boxes with logos? Although everyone seems to love$latex \LaTeX$for the way it typesets documents so well, after awhile you want something more. More graphical, like a textbook you had at school with different boxes that helped to organize the information in a comfortable way. Of course you can do that in$latex \LaTeX\$, too. The package being used here is bclogo but, unfortunately the documentation is in French. You can get a glimpse of it in the screenshot above: logos in colorful boxes with shadows.

The list of logos is extensive: here's  the page from the documentation

The commands for these logos are in the documentation. The focus here is on the boxes. To start, you'll need to put \usepackage{bclogo} in the preamble. The boxes are created with

Text to appear in the box
\end{bclogo}

By filling in the options you can control many features of the box:

• coleur to set the color of the box
• couleurBord to set the border color
• noborder set False for no border, True to have a border
• sousTitre can give a subtitle
• arrondi to set the curvature of the box: 0 for a rectangle and closer to 1 gives more rounded corners
• cadreTitre (true or false) puts the label of the box inside the box
• ombre (ture or false) true gives a shadow
• epOmbre (decimal from 0 to 1) the bigger the number the bigger the shadow length
• couleurOmbre is the color of the shadow
• blur to blur the shadow
• barre sets the "line" on the lefthand side of the box. Possibilities: line, zigzag, snake, motif
• epBarre sets the thickness of the line
• couleurBarre sets the color of the line
• marge set the margin

Using motif lets you pick the symbol.

I've created a page with this information. It also includes a sample tex file to illustrate a variety of text boxes. You can find the link on the sidebar or click here.