College Algebra @ Seminole State College
Yesterday, I was asked to help a friend with some College Algebra homework. She attends Seminole State College and is having a bit of trouble solving polynomial equations.
If you recall from your own College Algebra notebook, a polynomial equation is defined as:
In mathematics, a polynomial is an expression consisting of variables (or indeterminates) and coefficients, that involves only the operations of addition, subtraction, multiplication, and non-negative integer exponents.
Yeah, you remembered that right?
On paper, a polynomial is expressed like this...
f(x) = 3x**2 + 4x**4
In this example, the leading coefficient (4) is a positive integer and an even value. Our simple graph rises on the left and rises on the right like a stretched out U shape.
We spent an hour together working on evaluating these equations and plotting a few graphs. I thought we made some good progress.
I thought about our homework session A LOT on my ride home. I knew Python could be used to plot polynomials. I should have introduced her to iPython while I was there. Darn. Opportunity missed.
Oh, Hello, Numpy and Matplotlib!
This is where iPython really shines. Data and scientific research.
And college math homework ;-)
In [ ]:
from numpy import * from matplotlib.pyplot import * x = linspace(-1, 1, 100) y = (-3*x**2 + 4*x**4) # make a new figure figure()
Out [ ]:
<matplotlib.figure.Figure at 0x1412e48>
In [ ]:
# plot some data plot(x, y)
Out [ ]:
[<matplotlib.lines.Line2D at 0x2fe8128>]
In [ ]:
# show thin grid lines grid(True) # save the image savefig('plot_1.png')
The image is saved to the directory in which you are running your iPython session.
And the plot from our function:
Google also has a very nice polynomial factoring and plotting function baked right into Google Search.
Go to Google.com and enter:
f(x) = -3x**2 + 7x**3
What does Google tell you?
Disclaimer: It only helps you learn if you use the search results data provided to then solve the equation yourself. Using Google to do your homework is ill-advised.
Now that I have stated the obvious...
Google gives you the the solved equation, the grid, the plot with the x and y intercepts and the ability to zoom in and out of the plot.
It's pretty freaking cool, nerds!
The only question I have now is...
Where the hell was the iPython, Google and/or the Internet when I was learning College Algebra?
Oh, yes... Of course, you're right. That was 1988.
edit: I found another polynomial graphing tool online that is simple to use.
edit #2: I am now using Anaconda as my default interpreter with iPython. It includes many of the math and scientific modules and there are no other tools or modules that need to be installed. It rocks.