# Sagetex: Matrices 2

I've added more problems on the Sagetex: Matrices page. The first problem is solving a matrix equation. The second, essentially the same type of problem, is written as a system of equations. The problem you run into is if the elements from the matrix end up being negative (or zero) then your system can look as ugly as 0x+-1y=3. I've put parentheses around the numbers to make it a little more readable. One way of getting around these issues is to insist that the matrix A has entries which are all positive (when building the while statement).

Note that the while statement has a condition that the determinant is <6. This makes the numbers easier for students to work with. Of course, if it's a calculator test you can take that condition off. You can see the results above running in The Sagemath Cloud.

# Update: Dec 23,2013

There are several changes to mention:

• Sage 6.0 was released a couple of days ago. The changelog is here.
• I've added a new problem to the Problems page; it's shown below as well. If I had to teach graph theory, this is the sort of problem I would use to motivate it. You can, however, reason your way to the answer if you're looking for a problem to challenge some of your students

# Law Of Sines (ambiguous case)

The book I use for precalculus does a poor job explaining the ambiguous case of the Law Of Sines. Actually, it just lists the different cases while giving no insight as to how to reason through the various cases; a recipe for disaster. So I've put together some diagrams to describe the ambiguous case of the Law of Sines with a little more depth; to be explained later. You can find them posted on the Graphics page.

# Creating Problems: Determinants

Putting Sage into the classroom this year has been problematic at times, some successes and some failures. One place where I find Sage extremely helpful is creating extra problems, along with the answer, that I can use later in the classroom. The book I'm using, unfortunately, doesn't have enough sample problems so creating a simple manipulative that can generate many examples is a great help: I take a quick look at the problems and, if the numbers are reasonable, write them down to use as either example problems to illustrate a concept/skill or sample problems for students to practice.

I put together a manipulative to generate a variable number of matrices along with the value of determinant. Since I thought I'd eventually put together notes for my various classes (no time soon), I've added the option to show the $latex \LaTeX$ code as well. If that "perfect" example pops up, I'll save the code for later use. You can turn that part off if it's not useful. The output is shown above.

I've posted the code on the Sage In the Classroom page.

# Odds and Ends: Dec 9th, 2013

There were a lot of "discoveries" this past week due mainly to the results of PISA. Here are some of the more notable reads of the week.

There are many ways to spin this story; for me, it's just same story different day.

# AIM math

I ran across the AIM math website recently by stumbling onto their section for free math textbooks which, according to their evaluation criteria: "...must be able to serve as the primary text in a mainstream mathematics course at the undergraduate level in U.S. colleges and universities....Furthermore, we expect books of the quality we seek to be class-tested. They should have been used (and be in current use) by faculty other than the author....We are impressed with books that have a support system, signs of which are a website that is maintained, a community of users, a means for submitting support material from faculty such as test questions and project ideas, and a mechanism for improving the book by correcting errors, publishing errata lists, and displaying user comments."

These are some of the best free textbooks out on the internet; you should take a look. While looking around the website I found the Math Teacher's Circle Network had some resources that you might find useful as well. The latest newsletter (Summer 2013) focuses on Common Core math and the Resources section has some PDFs you might be able to integrate into your classroom. For example, the "Introduction to Problem Solving", "Mathematical Games" and "Introduction to Matrices" PDFs stand out.

# Sagetex: trig problem 1 (radians)

In an earlier post sagetex was used to create a problem that said, "Use reference triangles to find the sine/cosine/tangent/etc of the angle x (in degrees)". As I mentioned there, Sage prints out radian angles such as $latex \frac{3\pi}{4}$ so that $latex \pi$ is multiplied by $latex \frac{3}{4}$. You can't just code in $latex \LaTeX$ and insert the numerator or denominator via a Sage command because $latex 0$ and $latex \pi$ aren't fractions. I opted to crunch things out case by case; simple and quick to implement. It gets the job done by referring to the numerators and denominators:

anglesR = [0, pi/6, pi/4, pi/3, pi/2, 2*pi/3, 3*pi/4, 5*pi/6, pi, 7*pi/6, 5*pi/4, 4*pi/3, 3*pi/2,5*pi/3,7*pi/8,11*pi/6]
#Numerators and Denominators of the radian angles
anglesRnum = [0,1, 1, 1, 1, 2, 3, 5, 1, 7, 5, 4, 3,5,7,11]
anglesRden = [1, 6, 4, 3, 2, 3, 4, 6, 1, 6, 4, 3, 2,3,8,6]

Regardless of the angle, it's passed to a function GetTheta that will take the index and return the $latex \LaTeX$ string formatted as a single ratio: $\sin\left(\sage{theta1}\right)$. Here's the GetTheta function; note that the code isn't formatted properly:

def GetTheta(Index):
if Index == 0:
theta = '0'
elif Index == 8:
theta = '\\pi'
elif (Index == 1) or (Index == 2) or (Index == 3) or (Index == 3) or (Index == 8):
theta = '\\frac{\\pi}{'+ str(anglesRden[Index])+'}'
elif (Index == 5):
theta = '\\frac{2\\pi}{'+ str(anglesRden[Index])+'}'
elif (Index == 6) or (Index == 12):
theta = '\\frac{3\\pi}{'+ str(anglesRden[Index])+'}'
elif (Index == 7) or (Index == 10):
theta = '\\frac{5\\pi}{'+ str(anglesRden[Index])+'}'
elif (Index == 9) or (Index == 14):
theta = '\\frac{7\\pi}{'+ str(anglesRden[Index])+'}'
elif (Index == 11):
theta = '\\frac{4\\pi}{'+ str(anglesRden[Index])+'}'
elif (Index == 15):
theta = '\\frac{11\\pi}{'+ str(anglesRden[Index])+'}'

return theta

That's some long, ugly code but as you can see from the screenshot, it works. Note that backslash has to be typed twice to be picked recognized in a regular string (but not a raw string). The full code is posted on the SageTeX: Trigonometry page.