Fishtank simulation
This applet is based on a simple N-body problem. To be exact a badly written N-Body Problem since it uses an explicit Euler integration scheme which is terribly inaccurate. Nevertheless the inaccuracy is what makes it interesting. And after all this justifies putting a badly written N-Body problem on this page.
Details
We start with N-Bodies. Half of them are positively charged the other half is negatively charged. They attract or repel one another according to Colombs law. If they come close to each other the explicit euler scheme fails miserably which allows them to gain lot of additional energy out of nothing. So with a bit of phantasy it looks like red and blue fish are mating.
- Blue 'fishes' are charged positively.
- Red 'fishes' are charged negatively.
- The movement is the result of the application of the coloumb law using a terrible integration scheme.
Download and Useage
Download jar file
Download source code
(requires Netbeans)
In order to use the applet add the following lines to your html code:
<object classid="java:fishes.class" type="application/x-java-applet" width="400" height="400">
<param name="code" value="fishes.class"/>
<param name="archive" value="JFishtank.jar"/>
<param name="number" value="500"/>
<param name="sleep" value="5"/>
<param name="preview" value="false"/>
</object>
The following table lists the applet parameters and their meaning.
| Parameter | Meaning |
|---|---|
| number | The number of fish involved |
| sleep | time to wait after each frame (in milli seconds) |
| preview | If this value is true the applet looks like an image only moving when the mouse is over the applet. |