Edited 15 Jul 2010

Willie's points are well-taken. I apologize for the wordy description. It turns out have a relative who is quite knowledgeable about numerical problems like this and has offered to help. Thus, please consider this problem closed.

I'm not a mathematician, so please ignore this post if you think it's inappropriate. Plus, I'm a geezer who's been away from academia for many years, so I'm not current with anything except, according to some cruel offspring I'm acquainted with, fending off dinosaur attacks. Please excuse my ignorance in advance.

I would like to work on a chunk of software with a friend. It may wind up being something we would like to turn into a business product, so I want to be careful about exposing the business ideas. Thus, I'll be vague about the details. But the flavor of the problem should be evident.

I am looking for some advice on how to proceed to generate a workable solution to this problem. High accuracy is not needed; two significant figures is probably fine and three is definitely. Calculation speed is important to avoid losing the user's attention -- a 1 second calculation is fine, but an order of magnitude increase is not.

Some physical subsystems are located on a rectangular lattice in a plane. (However, I'm hoping the method of solution will allow an arbitrary location of the systems for a more interesting simulation.) Let's suppose the lattice is an n x m lattice with n and m being integers in the range of 5 to 100. Each physical system at each point is identical, although I'd like the method of solution to be general enough to allow an arbitrary mix of different systems in the lattice.

At each point (n, m), the state of the system at that point is determined by the interactions with the other points. In general, the modeling system needs to allow for interactions with all the other points; in practice for most of the simulations we're probably interested in, the interactions will be with only the nearest neighbors (nearest in linear distance), mainly to cut down on calculational complexity.

The system at each point can be a variety of types. For example, they can be influenced by gravitational, magnetic, electrostatic, elastic, or other types of forces that the user can make up. I can write down the forces on the system at point (n, m) as a function of the state of the other systems

$F_{n,m}(S_{1,1}(t), S_{1,2}(t), ...) $

Here, the function S is a state function for a system that depends on time and changes with time. Each state function can involve some "local" variables specific to that system, such as position variables with respect to the lattice point.

The objective of the problem is to calculate the $S_{i,j}(t)$ for all time given the initial conditions $S_{i,j}(0)$ and knowledge of the force functions $F_{n,m}$. The states can be allowed to evolve via e.g. Newtonian mechanics -- thus, the state functions S will often involve a position vector. Each system at each point in the lattice has freedom to move locally, but the systems are constrained in such a way that they never could get near another lattice point. For sake of argument, then, there's a circular boundary centered at each lattice point with a radius of half of the smaller of the two lattice separations; the physical systems are not allowed to cross this boundary.

Here's a concrete problem to illustrate things better. Suppose at each lattice point there's a post perpendicular to the plane with a mass that is connected to the post by a spring. Ignore flexing of the post or the mass of the spring. The mass can move frictionlessly in the plane of the lattice. The state of the system at each point has two degrees of freedom, so we could choose two generalized coordinates (polar coordinates might not be a bad choice). Now, these masses interact with each other via some kind of force. Let's assume an electrostatic-like force so that the force can be either attractive or repulsive. Let's also assume I can pick a constant $\alpha$ such that the force law between two points is proportional to $1/r^\alpha$, where r is the distance between the two masses of interest. The force on a system is then gotten by the usual superposition of the interactions with the neighbors.

Now, given the initial positions of all the masses and the spring constants for each spring, I want to calculate the motion of these masses.

I'd appreciate some guidance on some approaches to solve this problem adequately (2 to 3 significant figures). Here are the two methods that have occurred to me so far:

Write down the equations of motion for each system and integrate them numerically with Runge-Kutta or some other method.

Consider the problem a discrete simulation problem and use some software that manages such simulations. For each step, the state of each system at each lattice point would be looked at, the force on the mass calculated, then the system would be changed (possibly by a heuristic) on the basis of that force. Each lattice point would be treated, with the new states being held separately from the old state (each system's changes would always be calculated with the old states of the other lattice points). Then the old states would be replaced by the new states and the iteration would be done again.

To avoid oscillating states, I will probably introduce sufficient damping into each system's behavior so that oscillations quickly die out.

At arbitrary times in the future, the state of one or more lattice points can be instantaneously changed by a human; then the system needs to figure out the new equilibrium states (my intuition says the damping will ensure this happens).

Would you pick either of these approaches or use something different?

My concern about solving the equations of motion is that the time to solve to get the new steady states will be long and the system's response will become sluggish as the size of the lattice is increased.

I had an undergraduate mechanics class in the 1960's, but that information is, ah, temporally very distant from my current mental state, if you get my drift. :^) And, as this was well before computers or calculators came into use, I didn't get exposed to any training in solving such problems as students today probably get.