Become a fan of Slashdot on Facebook


Forgot your password?
Education Programming Science

Simple, Portable Physics Simulations 145

ttsiod writes "I want to 'lure' my nephews/nieces towards Science and Engineering (to whatever extent that's possible, in the age of consoles). To that end, I have coded simple physics simulations, like falling snow, exploding fireworks, and 1D/2D wave simulations. My efforts are here, in the form of portable SDL mini-programs (GPL code, compilable under Windows, Linux, Free/Net/OpenBSD, Mac OS/X and basically every OS with GCC and SDL). Try them out, and do offer any suggestions on other programs that can trigger scientific interest in young minds. Myself, I am teaching them Python, so that they can code 'fireworks' on their own."
This discussion has been archived. No new comments can be posted.

Simple, Portable Physics Simulations

Comments Filter:
  • Age/Goal? (Score:2, Informative)

    by DDDKKK ( 1088707 ) on Sunday August 16, 2009 @02:36PM (#29085149)
    Looking at the summary as well as at the webpage it does not become clear how old the mentioned kids are and if the goal is really understanding science and engineering. For a younger age things like [] which give a more playful introduction to physics might be better. Programming for kids has been addressed multiple times on Slashdot.
  • FreeBASIC (Score:4, Informative)

    by FlyByPC ( 841016 ) on Sunday August 16, 2009 @02:36PM (#29085153) Homepage
    OK, so it doesn't have "teh s3xy" of Java, Python, or Ruby -- but BASIC is very easy to pick up, and with modern dialects like FreeBASIC [], you can write good, modular, maintainable programs. It's also a lot of fun, which seems to be especially important; you can write a quick simulation of whatever you're interested in, without a lot of work.

    This isn't your father's BASIC; it has support for lots of memory, 32-bit graphics, user data types, functions and subroutines (including passing by reference or value), and even multithreading including mutexes. Or you could use it to run older QBasic programs from the Dark Ages, complete with line numbers, LET statements, GOTOs, and all that.

    Pick up FBIDE [] while you're there, too.

    ...Oh, and did I mention that both FreeBASIC and FBIDE are free?
  • Re:wot? (Score:5, Informative)

    by FlyByPC ( 841016 ) on Sunday August 16, 2009 @02:37PM (#29085161) Homepage

    I seriously have to ask : what does a 1-Dimensional wave look like????

    A compression wave. Think of a sound wave traveling along a very slender rod, after a hammer hits the end.

  • Physics Simulators (Score:5, Informative)

    by brycef ( 866665 ) on Sunday August 16, 2009 @02:42PM (#29085217)
    It is not programming, but Phun [] is a good 2-D physics simulator for kids.

    Another that takes a bit more work is Google's Sketchup [] with the SketchyPhysics [] plugin.
  • Other such programs (Score:1, Informative)

    by Anonymous Coward on Sunday August 16, 2009 @02:49PM (#29085257)

    That's a nice thing to do for your kids. If you want to show them more such programs, or draw inspiration, I recommend this collection [] of Java applets.

  • Paul Falstad Applets (Score:5, Informative)

    by Wookie Monster ( 605020 ) on Sunday August 16, 2009 @02:53PM (#29085289)
    A much larger and cooler collection of physics applets can be found at []
  • Re:wot? (Score:5, Informative)

    by History's Coming To ( 1059484 ) on Sunday August 16, 2009 @02:59PM (#29085333) Journal
    Nope, you're a dimension out (fencepost error?!).

    1D: Compression wave in a single dimension, like the "striking a rod" example above.

    2D: Guitar string. A string is a single dimension (eg left to right) but you need a second dimension for it to vibrate up and down.

    3D: Ripples in a pond. The pond surface is a plane (2D, left/right, forward/back) but the wave is a displacement in a third dimension (up/down).
  • Re:wot? (Score:3, Informative)

    by Compholio ( 770966 ) on Sunday August 16, 2009 @03:03PM (#29085361)

    I seriously have to ask : what does a 1-Dimensional wave look like????

    A compression wave. Think of a sound wave traveling along a very slender rod, after a hammer hits the end.

    If you want to demonstrate this phenomenon visually in the real world you can use a slinky. Just tape down one end and confine it to a track with a couple of boards, push the free end and watch the compression wave travel down the slinky.

  • Re:Age/Goal? (Score:3, Informative)

    by Brian Gordon ( 987471 ) on Sunday August 16, 2009 @03:09PM (#29085401)

    Don't forget the excellent Phun physics sim. Check out some of the things that are possible [].. the standard environment is powerful enough to support rockets and springs, but it's also fully scriptable.

  • by magneticstorm ( 47620 ) on Sunday August 16, 2009 @03:10PM (#29085403)

    Since you have a strong interest in visualizations of physics phenomena, and you're already teaching your nieces and nephews how to write Python, I'd like to suggest that you check out VPython [], which is a series of 3D extensions to Python. In particular I think you'll be intrigued by these examples [] which visualize everything from wave superposition, to magnetic fields, to concepts from relativity. For immediate gratification, the author of that examples page also has Wiimote integration, so you can bridge interest that your relatives might have in video games into an interactive experience in your physics environment.

    Good luck!

  • by Chris Shannon ( 897827 ) <> on Sunday August 16, 2009 @03:13PM (#29085429) Homepage
    Kde's Step [] is a good basic physics simulator. It is part of kde's education project.
    From their description:
    Step is an interactive physics simulator. It works like this: you place some bodies on the scene, add some forces such as gravity or springs, then click "Simulate" and Step shows you how your scene will evolve according to the laws of physics. You can change every property of bodies/forces in your experiment (even during simulation) and see how this will change the outcome of the experiment. With Step you can not only learn but feel how physics works !
  • Another reseource (Score:3, Informative)

    by fermion ( 181285 ) on Sunday August 16, 2009 @03:22PM (#29085501) Homepage Journal
    For those who wish additional simulation, check out The PhET Simulations [].
  • Re:wot? (Score:5, Informative)

    by gardyloo ( 512791 ) on Sunday August 16, 2009 @03:28PM (#29085545)

    Actually, your parent poster is correct: a transverse wave like on a string can be parametrized by one coordinate, since the displacement isn't a dimension. So both compressional and transverse waves on a string can be said to be 1D _in_space_: give an x-coordinate, I can tell you the displacement at a given time (or, if you're masochistic, take the one spatial dimension to be the length along the string from some origin).

        2D: ripples on a pond. Need an (x,y) to specify the location; the other number is the displacement (or density, or velocity; doesn't matter).

        3D: ripples in a volume, such as sound waves in an unbounded medium, electromagnetic waves in space, etc. There are two ways to be "off" by one dimension in problems such as these:
                        1) count time as a needed dimension (usually, it's treated as a parameter, especially for time-harmonic problems, but sometimes it's really needed, as in SR and GR);
                        2) not take advantage of symmetries in the problem, which can sometimes collapse the problem to a lower dimension (or _almost_ lower dimension).

  • Physics 2000 (Score:4, Informative)

    by StarDrifter ( 144026 ) on Sunday August 16, 2009 @03:36PM (#29085619)

    The University of Colorado has something called Physics 2000 [] that has a bunch of applets. Click on "Applet Thumbnails" in the top-left frame. One of my favorites is "Satellite orbits" (click on "Upcoming Applets"). You can try to find stable orbits around the Earth. You can try to find stable orbits around the Moon (although I don't think there are any). You can try launching some objects clockwise and some counter-clockwise and see if it is easier to get things in a stable orbit one way or the other. You can launch a bunch of objects in random directions with random velocities and watch most of them die an early death and a few stick around much longer. Sometimes you can see Orbital resonance []. The simulation extends beyond the visible portion of the screen so you can even get objects in orbits with very long periods that are only visible for a very short portion of their orbit as they dip close to the Earth and then sail away again.

  • Re:wot? (Score:3, Informative)

    by BitterOak ( 537666 ) on Sunday August 16, 2009 @03:37PM (#29085627)

    Does that mean cell phone transmission is 4D? How do we visualize that?

    Nope. It's 3D as well. Unlike the other examples provided, the vibrations here are in the same 3D space in which the wave propagates. The electric and magnetic field vectors are in 3D space, transverse to the direction of propagation.

  • by anthony.vo ( 1581427 ) on Sunday August 16, 2009 @03:50PM (#29085739)
    There's this game called Crayon Physics where you draw objects in order to get a ball to the end point. It sounds simple but it challenges you to overcome various physical obstacles like getting your ball uphill, or to get your ball into a little catapult, and creating a counterweight to launch it to the end point. Neat game, check it out. []
  • Mobinet (Score:2, Informative)

    by Hufo ( 684441 ) on Sunday August 16, 2009 @06:00PM (#29086533)
    Mobinet [] is an open-source platform for mobile objects programming (simulation, games, graphics, maths-physics, ...). It is developed by INRIA Grenoble in France and used to initiate students (from high school to university) to games programming, or more generally to provide them with a concrete intuitive and fun version of the notions seen in math and physics course.
  • Re:wot? (Score:3, Informative)

    by Manchot ( 847225 ) on Sunday August 16, 2009 @10:56PM (#29088051)
    It's really kind of misleading to say that a guitar string is a 2D wave, or a ripple on a pond is a 3D wave. Really, there are two separate concepts: the dimensionality of the domain of the wave, and the dimensionality of the wave itself. A compression wave and a guitar string are both one-dimensional waves in a one-dimensional space. A ripple on a pond is a one-dimensional wave on a two-dimensional space. Sound in a room is a one-dimensional wave in a three-dimensional space. Electromagnetic waves are six-dimensional waves in a three-dimensional space.

Mr. Cole's Axiom: The sum of the intelligence on the planet is a constant; the population is growing.