🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.fractals
Article #481

Henon-Heiles Code

#481
From: aalpern
Date: Thu, 28 Jan 1993 20:49
34 lines
1883 bytes
Here we are, as promised, I present you with mssrs Henon-Heiles.
Here's the code for iterating the Henon-Heiles system, from 
CMJ fall 1992.

double	x = 0, y = 0.1
		xdot, ydot = 0.2,		/* first derivatives */
		E = 1.0/6.0,			/* max allowable energy */
		xdotdot, ydotdot,		/* second derivatives */
		xdot_squared,			/* for solution of xdot */
		delta_t = 0.01;			/* for integration */

xdot_squared = (2.0*E)-(y*y)+((4.0/3.0)*y*y*y)-(ydot*ydot);
if (xdot_squared < 0.0)	{
	printf("ERROR: xdot_squared < 0.0 : Bad initial conditions.");
	exit(1);
} 
else
	xdot = sqrt(xdot_squared);
	
for(counter = 0; counter < ITERATIONS; counter++)	{
	xdotdot = -x - (2.0 * x * y);
	ydotdot = -y - (x * x) + (y * y);
	
	xdot = xdot + (xdotdot * delta_t);
	ydot = ydot + (ydotdot * delta_t);
	x = x + (xdot * delta_t);
	y = y + (ydot * delta_t);
	
	/* output a poincare section */
	if (xdot < 0.001 && xdot > -0.001)	
		output((fabs(xdot) * 10000.0),(fabs(ydot) * 10.0));
	/* the multiplications here were done to */
	/* put the output into a more usable range */
}
Technical Details
Message-ID: <1993Jan28.164936.1@hamp.hampshire.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!spool.mu.edu!yale.edu!qt.cs.utexas.edu!news.Brown.EDU!noc.near.net!nic.umass.edu!hamp.hampshire.edu!aalpern

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f49f0,160190ca67e82c51,start
X-Google-Attributes: gidf49f0,public
X-Google-Thread: 10ed18,160190ca67e82c51,start
X-Google-Attributes: gid10ed18,public
X-Google-Thread: ff06e,160190ca67e82c51,start
X-Google-Attributes: gidff06e,public
X-Google-ArrivalTime: 1993-01-28 12:49:36 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!spool.mu.edu!yale.edu!qt.cs.utexas.edu!news.Brown.EDU!noc.near.net!nic.umass.edu!hamp.hampshire.edu!aalpern
From: aalpern@hamp.hampshire.edu
Newsgroups: sci.fractals,bit.listserv.frac-l,comp.music
Subject: Henon-Heiles Code
Date: 28 Jan 93 16:49:36 EDT
Organization: Hampshire College
Lines: 34
Distribution: inet
Message-ID: <1993Jan28.164936.1@hamp.hampshire.edu>
NNTP-Posting-Host: hamp.hampshire.edu