From: Bruce S. <Bru...@nc...> - 2008-03-31 02:07:20
|
Very impressive and sophisticated, especially for a first try! I'll mention that the Rubiks cube program does run on the highly experimental as-yet-unreleased-under-rapid-development new version, at least on Vista. In MagDisc, I believe the force calculation is incorrect, and the rotational motion update is incorrect. The force that one magnet exerts on another is quite complicated. You can get the right answer by pretending that a magnet is an electric dipole (with small separation between the + and - charges) instead of a magnetic dipole, to reduce the problem to a simpler case, and then calculate the electric forces among all the individual point charges. What you have in MagDisc seems to be a calculation of a 1/r^2 field made by one magnet, multiplying by a constant representing the other magnet to get the force. But the field of a magnet isn't a simple 1/r^2 field, and the force it exerts on another magnet isn't simply a constant times that field. Also, you seem to increment the angle of a disc proportional to the torque acting on the disc. But you have to increment the angular momentum of the disc (moment of inertia times angular speed) proportional to the net torque (magnetic and frictional), then use the new angular speed to increment the angle. Bruce Sherwood Doug Mair wrote: > Hi all, > > I created a blog entry about my experiences learning python and visual > at: http://dougmair.blogspot.com/ > > Please check it out and make suggestions. > > I created two programs (source files are also on the blog). > > The Rubik cube program works well, but is not written in a very python > like way. > I spend most of my time programming in C#, so it's hard for me to think > in the python way. > I would appreciate any code review telling me how it could be done > better in python. > > The MagDisc.py program is a simulation of magnetic forces between > freespinning discs with magnets fixed on them. > I'm trying to create a virtual free energy simulator. It's cheaper than > building it in the real world. > This program works pretty well, but I'm having trouble with the equation > that converts the magnetic forces into the angular momentum of the discs. > Any physics advice would be appreciated. > > Also, I tried the Rubiks cube with the version 4 beta on Windows Vista > and it had lots of problems. > > Thanks for any help, > Doug Mair |