# Creating Linear Regression Data

Precalculus in today's classroom includes scatter plots of data and using a calculator to find the regression line/curve that goes through the data. The problems typically consist of a dataset with a limited number of points, say 8, which the student is supposed to enter into their calculator, use the calculator to find the regression line/curve, and then plot the results.

I've posted Sage code on the Sage in the classroom page that will create linear regression data along with the scatter plot. You can use it to create fresh datasets for the classroom, worksheets, or test problems.

The code chooses random values for the slope and intercept and then adds "noise" to each point. The actual regression line should have a slope and intercept that is close to that (but different). Later on we'll find the equation of the regression line through a set of data.

# Sage Tutoring: complex numbers

I've added code to the Sage in the Classroom page. It creates 2 random complex numbers and show you the steps to add, subtract, multiply, and divide them. The code can be used in the classroom to create the problems you demonstrate (clicking on the box will hide the solution) and as a tutor to help students outside the classroom.

# Odds and Ends: July 9th, 2013

There's an interesting example of math magic demonstrated and explained here. I added it to the Other page of this site. After exploring the site of the creator, I found there are enough well thought out videos that could benefit many math teachers. So I've added a link to his site, Numberphile, onto the sidebar and removed the neoK12 website.

There's a nice story on the ABC conjecture that you can find here. As the Wikipedia link mentions there was some recent progress that looks promising. A proof of the ABC Conjecture has been posted. The author, Shinichi Mochizuki has the bona fides that you'd expect of someone who would be capable of such a feat. There is so much original mathematics in the paper, however, that I get the feeling it will take years before we know if the conjecture is, in fact, true.

# Sage Essentials: Formatting program output

In an earlier post I mentioned how you can add text to explain your notebook calculations through either %latex or using text fields. I've copied that information to the Sage Essentials page. Those approaches don't apply for output generated by a program, however, so I've added the following information on format that output. Here's a screenshot of some different approaches:

The Sage notebook lets you format the output from your programs in multiple ways depending on how much time and effort you want to spend on making it look nice.

• The print statement is the simplest it gives you basic output but equations aren't so easy on the eyes. At times the background of a print statement will look gray.
• A plain html statement won't result in a gray background and it has the same simplistic representation for math output.
• html statements can be adjusted to give $latex \LaTeX$ output for numbers by enclosing the numerical output it $signs (thereby entering math mode). The fonts become a little nicer and exponentiation is easier on the eyes. • html statements can be adjusted to give$latex \LaTeX$fonts for text and math by putting the output string into math mode and then using the \mbox command to get into text mode. I've cleaned up the math output a little more using \\frac{%s}{%s}$<p>'% (v.numerator(), v.denominator())) to create a ratio with 2 lines. However, the multiplication symbol gets printed out which doesn't look the way it should.
• To get around the problem of the * sign showing up, use the latex() command to convert the statement to latex code. This strips out the * sign. Converting that to a string via str(latex(v)) finally gives the cleanest output of all.
• Another way of getting $latex \LaTeX$ uses the view() command. In some ways, it's simpler but I've had problems with it when you combine text and math into a view command: in the second cell, view(p+q+r+s) causes problems.

The code for each cell is given on the Sage Essentials page.