# Odds and Ends: March 28, 2013

An earlier link (Chessville) is no longer any good so I've removed it and added 3 new links you might find useful.

1. Online Scientific Calculator links you to a web based calculator for some "quick and dirty" calculations.
2. PiCalc is another online scientific calculator.
3. 3D Function Plot is a link to a very nice graphing calculator (shown above). It does almost everything: 2D plots, 3D plots, parametric plots, contour plots, gradient fields, pie charts and more. This site is especially nice because not only do you have a lot of control over how things are plotted but you can also download your plot in a variety of formats including, but not limited to, eps, bmp, gif, animated gif, tif, jpeg, and pdf. Note that images created on the website should be cited if you're using them in publications.

I plan to see which online calculator link (link 1 or 2) is more useful and remove the other. Got a favorite? Let me know.

Finally, the tournament to determine a challenger for the next world championship is winding down and it's a 3 horse race: Carlsen, Aronian, and Kramnik. No real surprises here as these are the top 3 players in the world according to the Live Chess Ratings. There's been some good fighting chess and if you haven't seen the Svidler-Grischuk game from round 9 then you're in for a treat. Remember, you can follow the games live on ChessBomb (the link is on the sidebar) and there is streaming commentary from the official tournament site.

# Sagetex: Randomized Test with Answer Key

Once you've gotten over the initial learning curve of working with Sage, sagetex, and $latex \LaTeX$ and created your first randomized test template you'll be able to copy and paste code from your working template to create additional tests/quizzes quickly and easily. But there's a huge added bonus: you can program Sage to create your answer key.  In order for Sage to generate the answer key correctly, though, you'll need to make sure you've converted the Python integers created by randint() to Sage Integers using the Integer() function as discussed in the previous post.

To help you along I've put together a simple template for a randomized test to help you. In order for it to work, you'll need to have Sage installed on your computer. The process for creating a document using sagetex is covered here.

I've put the file, called SageTemplate, along with the output on the Handouts page. Of course, since the test is randomized my output will almost certainly be different from your output. It's there to give you a look at the final product and an incentive to install Sage onto your computer.

# Sagetex: Randomized Test Warning

Combining Sage, sagetex, and $latex \LaTeX$ will give you the ability to create randomized tests and that's a handy, time saving feature that any teacher can appreciate. But if you dive right in you're almost certain to encounter some inexplicable problems, so a warning is in order. But first we need some background. To create randomized test we'll use the Python randint() command to create (pseudo) random integers: a=randint(1,12) will choose an integer at random from 1 to 12, inclusive, and store it in the value a. But you need to be aware that Python and Sage go about their calculations in different ways and this can create all sorts of problems. Recall (in Sage) the command n() forces a number (such as a fraction, radical, or pi) into a decimal. You'll also need to know that the type() command can tell us the object we're looking at. Copy and pasted the following code into the Sage Cell Server (or the Sage Sandbox):

a=randint(1, 1) #chooses 1 "randomly"
b=randint(3, 3) #chooses 3 "randomly"
c = 1
d = 3
print a, b, type(a)
print c, d, type(c)
print a/b, type(a/b)
print c/d, type(c/d)
print n(c/d), type(n(c/d))
e=randint(1, 10)
print e, type(e)
print Integer(e), type(Integer(e))

Here's a screenshot of what happens:

Although a and b represent the same numbers as c and d, respectively, Sage will treat them very differently. Using the randint() function has 1 and 3 as (Python) integers while c and d are Sage integers. In Python 1/3 is computed as 0, the quotient, while Sage integers gives us the 1/3 we expect. The answer 1/3 is a Sage rational number and forcing it to a decimal results in a Sage real number. When you're creating randomized tests with sagetex, be aware that numbers aren't just numbers in Sage.

The numbers produced by randint() need to be converted into Sage integers so the calculations work as we'd expect them to. This is accomplished by putting Integer() around the number.

Finally, if you ever have a problem with Sage giving you the wrong answer, make sure you check the type.

# The Best Free Ipad Calculator Apps

Linux is the best operating system, period. Unfortunately, this well kept secret means you'll be forced to work with some other operating systems along the way. Schools (including my own) have latched onto the Ipad as the tool of choice. So it's good to know what apps are out there. I've selected the free calculator apps that I like best. I don't include the Sage app because it requires you to be online and the input is clumsy on tablets. My calculator choices are all scientific calculators because a plain vanilla calculator won't be able to handle a variety of basic high school math calculations. Here's the list of the best calculator apps out there.

4. Free Graphing Calculator is a good quick-I-need-the-answer-to-this-simple-calculation calculator. Although you have the ability to for more complicated calculations, such as hyperbolic sine, it's cumbersome to use. On the positive side, it allows you graph multiple 2d functions simultaneously and gives you access to mathematical results. Can't remember that half angle formula? Not to worry, this calculator has it.

3. HiCalcHD comes in next but the annoying reminders when you start it up detract from the experience. A large variety of functions are readily available, including trig functions, log functions, exponentials, factorials, combinations, integrals, and series. Some of the nonstandard calculations tell you how to properly input the calculation you are working on  (such as the definite integral) while you're typing. You can even set the calculator to work in RPN (reverse Polish notation). Great calculator but those reminders....

2. Calculator $latex \infty$ is free for now, so download it ASAP. No really. Stop reading and download it now. This calculator has everything HiCalcHD has and even lets you input fractions and convert the resulting answer to a fraction.

1. Halcyon Calc Lite takes top spot, though it is definitely not for everyone. Pictured at the top of this post, it's modeled after the HP28S calculator: a calculator that was cutting edge when I bought it over 25 years ago (!):

Since I own the HP28S and am familiar with RPN notation it was pretty easy for me to find my way around. There is more functionality here than any of the other calculator apps I've mentioned, probably more than a typical person will use. Unfortunately, someone new to this type of calculator will almost certainly struggle.

I do have one complaint, though. After graphing a function I was unable to figure out how to get back to the calculator. I couldn't find instructions anywhere. When I exited the app and opened it up again, I was left looking at the graph I created. Eventually I just deleted the app and installed it again. Whether that's a bug, lack of documentation, or a feature meant for the paid version, I have no idea. Note there's a demo video on their website, if you're curious.

If you need an excellent scientific calculator then Halcyon Calc Lite (for people who want RPN) and Calculator $latex \infty$ (for people who don't) are the best free apps out there.

# Discovering Pi

I've added a simple Interact manipulative to print the digits of $latex \pi$ and color them according to their color. Counters keep track of the number of times each digit occurred. The output is shown above and on the Sage Output page.

You can find the code on the Python/Sage page.

# Integrating SAGE and Kile

There was an interesting post on TeXStackExchange not too long ago. The result was instructions on how to integrate SAGE into the Kile IDE. So if you use Kile to compile your latex documents, following the instructions will result in creating a button on the toolbar which, when it's pressed:

• runs pdflatex on your document, thereby creating a sage file
• runs SAGE on the sage file
• runs pdflatex on your document again
• opens up the PDF document to show the results.

If your LaTeX code doesn't compile or your SAGE code doesn't run properly then a button to run through all these processes isn't that useful. But if you can get your code running properly you'll save yourself a lot of time compiling through Kile by pushing a button. I've put the instructions into picture form to make it even easier to follow. The page "Integrating SAGE and Kile" is on the sidebar; just click here to take a look.