Friday, February 19, 2010

Computer Algebra System

This is just a quick tutorial on how to use Sage Notebook to answer the 'computational' problem on this homework, namely problem 15.b in section 1.5. One does not need to use a computer to do this problem (it is not *that* hard to find compute the GCD), but for those of you that want to use a computer, here is how it can be done.

Go to www.sagenb.com and create a log in. You will be presented with the (currently empty) list of worksheets you have created. Create a new worksheet by clicking on the "New Worksheet" button along the top row. We will work through an example; note that this is *not* the example that you are asked to compute in the problem.

Near the top, you will see a drop down box that says 'sage'. Select 'macaulay2' from the dropdown box. After you type in each cell, be sure to click 'evaluate' at the bottom of the cell to see what the result of running each command will be.

In the first cell, type in the following:

R = QQ[x]
f = x^9 - 29*x^8 + 371*x^7 - 2747*x^6 + 12968*x^5 - 40460*x^4 + 83392*x^3 - 109440*x^2 + 82944*x - 27648

This tells sage that we are working in the ring QQ[x], and we are going to try to find the squarefree part of f. In the next block, put

fprime = diff(x,f)

This is just the derivative of f with respect to x. In the next box, put

gcd(f,fprime)

And then finally, in the next box put.

h = f // gcd(f,fprime)

To verify our work, check that both elements factor to give the right thing, so in two boxes, put

factor f

and

factor h

This is exactly what the problem told us would happen :)

No comments:

Post a Comment