This takes advantage of the fact that every third Fibonacci number is even in order to avoid having to check for each number f it is even.
a=1
b=1
c=2
x=0
while c < 4000000:
x=x+c
a=b+c
b=a+c
c=a+b
print x
If you found this little bit of code helpful, then please consider donating so that I can continue coding.
You can donate here
Thursday, 11 September 2008
Wednesday, 3 September 2008
Pythagoras
Today's comic includes a proof of Pythagoras's theorem. Enjoy!
Pythagoras's theorem does indeed have a lot of proofs. Wikipedia list some of them here. This theorem is really important, and yet it gets taught without showing students a single proof. This theorem has a broad range of applications, mostly in trigonometry. it is also an important theorem because it was one of the first theorems to be rigorously proved.
If this comic has helped you, or made you laugh, or made you happy in some other way, then please consider donating so that I can continue drawing these comics.
You can donate here
Pythagoras's theorem does indeed have a lot of proofs. Wikipedia list some of them here. This theorem is really important, and yet it gets taught without showing students a single proof. This theorem has a broad range of applications, mostly in trigonometry. it is also an important theorem because it was one of the first theorems to be rigorously proved.
If this comic has helped you, or made you laugh, or made you happy in some other way, then please consider donating so that I can continue drawing these comics.
You can donate here
Tuesday, 2 September 2008
First Project Euler problem solved!
Well, the first problem was easy enough, at least after I managed to get my for loop working.
This is the python script I ended up with:
If you found this little bit of code helpful, then please consider donating so that I can continue coding.
You can donate here
This is the python script I ended up with:
x=0
for i in range(1, 1000):
if i % 3 == 0 or i % 5 == 0:
x=x+i
print x
If you found this little bit of code helpful, then please consider donating so that I can continue coding.
You can donate here
Project Euler problems
I though it might be nice to have some understanding of another programming language. After thinking about it for a little while, I decided on Python. So now I had the problem of trying to learn it. After a bit of searching, I came across Project Euler, which has a set of maths problems to solve by writing programs to solve them. It seems like a great way to get into programming.
I've just downloaded Python, so we'll see how long it takes to get that installed and to write the solution for the first problem.
If you have found this post helpful, then please consider donating, so that I can continue blogging.
You can donate here.
I've just downloaded Python, so we'll see how long it takes to get that installed and to write the solution for the first problem.
If you have found this post helpful, then please consider donating, so that I can continue blogging.
You can donate here.
Mathematics graphing software
Sometimes, I find that I can't visualise what a graph looks like, and I can't work out all the details in order to be able to sketch it. So I use my computer to draw a graph. The software I use is Autograph, which is excellent. However, the individual price tag of £69.33 is quite pricey, and probably too much for some people. They do have a 30 day trial, so you might want to download it and see what you think before you make up your mind.
Obviously, if you have a graphical calculator, you can use that to draw graphs. However, a graphical calculator is almost certain to be slower than your computer, and will have a smaller screen with a lower resolution.
For those of you without the cash to buy autograph, I'm going to take a look at some free graphing software. All the software has been tested on Windows XP, but may also run in other operating systems.
gnuplot 4.23
gnuplot is open source, and can be freely distributed. It is portable, meaning that it doesn't have to be installed before you use, so you could run it off a flash drive. According to the FAQ, it seems that it will run on pretty much any operating system that you're likely to be running.
My download was 3.71 MB, which should go quite fast even for those on dial-up connections.
It comes with a GUI, but I still ended up having to type in part of the command. It took digging through the help files before I could even manage to plot the graph of y=cos(x)
The last stable version (4.23) was released on 8 March 2008, and there is a beta version, so it is clearly still being actively developed.
Verdict: The software is certainly capable of drawing graphs, but it is not at all user friendly. Not recommended unless you have some form of command line or programming experience, although for a few legacy systems, this may be your only choice.
GraphCalc
GraphCalc seems to have been mostly developed for windows, but it does have a linux version.
The executable file I downloaded was only 841 KB, small enough to fit on a floppy disk. This software is also open source and can be freely distributed, however it needs to be installed before use.
It seems to support a reasonable range of functions, such as trigonometric, exponential, logarithmic, and hyperbolic functions. Entering an equation was really easy, and it appears to support graphing up to 10 equations at once. As well as the Euclidean coordinates (That's cartesian coordinates, with y defined in terms of x), it also supports polar coordinates, and parametric equations. There's also an option for 3D graphs, which I haven't explored much.
You can draw tangents to graphs, and the find the area under graphs, which is very useful when you're checking to see if your calculus is correct.
GraphCalc was last updated in November 2003, so unfortunately doesn't appear to be in active development any more.
Verdict: A simple, easy to use program, which should be able to plot most graphs that you'll come across in GCSE or A-level.
Neither of these programs is as good as autograph, but they are both probably capable of doing a good job of drawing the graphs you're likely to come across.
If this post has helped you, then please consider donating so that I can continue writing these posts.
You can donate here
Obviously, if you have a graphical calculator, you can use that to draw graphs. However, a graphical calculator is almost certain to be slower than your computer, and will have a smaller screen with a lower resolution.
For those of you without the cash to buy autograph, I'm going to take a look at some free graphing software. All the software has been tested on Windows XP, but may also run in other operating systems.
gnuplot 4.23
gnuplot is open source, and can be freely distributed. It is portable, meaning that it doesn't have to be installed before you use, so you could run it off a flash drive. According to the FAQ, it seems that it will run on pretty much any operating system that you're likely to be running.
My download was 3.71 MB, which should go quite fast even for those on dial-up connections.
It comes with a GUI, but I still ended up having to type in part of the command. It took digging through the help files before I could even manage to plot the graph of y=cos(x)
The last stable version (4.23) was released on 8 March 2008, and there is a beta version, so it is clearly still being actively developed.
Verdict: The software is certainly capable of drawing graphs, but it is not at all user friendly. Not recommended unless you have some form of command line or programming experience, although for a few legacy systems, this may be your only choice.
GraphCalc
GraphCalc seems to have been mostly developed for windows, but it does have a linux version.
The executable file I downloaded was only 841 KB, small enough to fit on a floppy disk. This software is also open source and can be freely distributed, however it needs to be installed before use.
It seems to support a reasonable range of functions, such as trigonometric, exponential, logarithmic, and hyperbolic functions. Entering an equation was really easy, and it appears to support graphing up to 10 equations at once. As well as the Euclidean coordinates (That's cartesian coordinates, with y defined in terms of x), it also supports polar coordinates, and parametric equations. There's also an option for 3D graphs, which I haven't explored much.
You can draw tangents to graphs, and the find the area under graphs, which is very useful when you're checking to see if your calculus is correct.
GraphCalc was last updated in November 2003, so unfortunately doesn't appear to be in active development any more.
Verdict: A simple, easy to use program, which should be able to plot most graphs that you'll come across in GCSE or A-level.
Neither of these programs is as good as autograph, but they are both probably capable of doing a good job of drawing the graphs you're likely to come across.
If this post has helped you, then please consider donating so that I can continue writing these posts.
You can donate here
Donations now accepted
I am now accepting donations. They will go towards funding some real webspace, so that I can add more features to this site.
So if I have given you something to do for some of your day, then please consider Donating.
So if I have given you something to do for some of your day, then please consider Donating.
Monday, 1 September 2008
Quadratic formula
Today's comic is about the derivation/proof of the quadratic formula. Enjoy!
The quadratic formula comes in very useful for solving quadratic equations, and it will always give the right answers. It is often first taught without any explanation of why it works. This can frustrate the students who want to know why it works and see the real maths behind it. I know that not everything students are taught in maths can be proved to them, since if we did that, we'd never get anywhere. However, I don't think it is too much to ask that students get to see some of the simpler and easier to follow proofs for the most important concepts, and quadratics are definitely one of those important concepts.
If this comic has helped you, or made you laugh, or made you happy in some other way, then please consider donating so that I can continue drawing these comics.
You can donate here
Subscribe to:
Posts (Atom)