Python Programs

Hi, everyone. Blogging after a long time. This is because the college machines all run on linux, despite the fact that they all came with the latest distro of Vista, one CD each. What a loss. It’s what you get when you have a bunch of ideologists running the computer dept. It’s a pain blogging on linux. Even if the machines ran Windows, it would be awkward going to college to blog.
And I don’t have a laptop yet.
Hence the delay.
Anyway, I called to say that I’ve been learning Python, the programming language, in college, and I’ve made a few programs I want to share. Not all the programs have been made into executables in linux (although most have been). So in linux, start the terminal and type python <program name>.py, as usual. This will run all of the programs below. The Number Picture program is complete, except I haven’t had time to include a documentation about what exactly it is that it’s doing. I’ll try to do that soon.
 

http://cid-a5c48e3a27cedbb5.skydrive.live.com/embedrowdetail.aspx/Public/PythonPrograms/FibonacciSeries|0PhiConvergence.py

Displays Fibonacci numbers up to the count you specify  and also their successive ratios that converge to the Golden Ratio.

http://cid-a5c48e3a27cedbb5.skydrive.live.com/embedrowdetail.aspx/Public/PythonPrograms/Prime1.0.py

Displays Prime numbers, upto a number or upto a count. Checks whether a number is prime. Also returns nth prime for given n.

http://cid-a5c48e3a27cedbb5.skydrive.live.com/embedrowdetail.aspx/Public/PythonPrograms/Orbit1.0.py

Prints coordinates of 2 masses in a binary system. You can set masses, initial positions and initial velocities of the two bodies. Resulting file, plotted in gnuplot with lines, gives orbit of both.

http://cid-a5c48e3a27cedbb5.skydrive.live.com/embedrowdetail.aspx/Public/PythonPrograms/Projectile1.0.py

Generates a data file plotting the position (x,y) of a projectile. Projected particle is slowed down by air friction as in real life, and hits ground and rebounds (losing energy) as in real life. You can set the launch position, launch angle, launch velocity, viscous force constant and coefficient of restitution.

http://cid-a5c48e3a27cedbb5.skydrive.live.com/embedrowdetail.aspx/Public/PythonPrograms/NumPic1.0.zip

Accepts a number from user. Takes a point at origin. Gives it successive unit translations along 1 of 10 different directions, depending on the value of successive digits of the number. The directions form a regular polygon with 0 upwards. Successive coordinates are printed to a file that can be plotted with gnuplot.

The zip file contains the program itself, and a PDF help file where everything has been explained.

If you modify and/or redistribute these programs, you cannot charge money for them. Also, I’d like it if you acknowledge my authorship, although I wouldn’t mind if you add your name to it.

Enjoy.

Tags: , programs,


Add comment in external guestbook (no need for Windows Live account or sign-in.)

2 thoughts on “Python Programs

    1. Sorry for replying so late. I wrote those programs in Windows, which might be the problem. For example, some use the commands module which doesn’t work properly on Ubuntu. And maybe some use the Gnuplot module which may not be installed on your system etc.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s