Breaking spaghetti in two pieces.

Try this out.Take uncooked spaghetti and bend it until it cracks.How many pieces do you expect? 2. Richard Feynman showed by breaking a lot pasta that uncooked spaghetti will rarely break into two pieces.It can break into three , seven or ten pieces.

French physicists Dr Basile Audoly and Dr Sébastien Neukirch say the answer is related to waves of vibration that pass through the pasta when dry spaghetti is bent and suddenly released at one end.

And don’t think this is a minor discovery: the researchers think their findings can be applied to civil engineering to make structures like buildings and bridges more stable.

After taking high-speed images of the broken spaghetti, they applied the Kirchhoff equation, an equation that relates to how waves travel through an object that’s put under stress. The researchers conclude that spaghetti fragmentation is caused by a burst of flexural, or elastic, waves that travel along the spaghetti after the initial break.

And they added that this “physical process of fragmentation is relevant to many areas of science and technology,” a fact confirmed by Rod Cross, a professor of physics at the University of Sydney, Australia.

“If you can understand how spaghetti breaks you can understand how anything else breaks including a building an aeroplane or a car,” he says. “Under impact they’ll all vibrate and break. More to the point it can be a human leg, because if you whack a human leg it’ll probably break in three or four bits as well for the same reason.”

The Runge Kutta 4th order Algorithm

I am doing an intern at Zeus Numerix where I have to simulate motion of an artillery missile fired from a launch vehicle.After doing the dynamics part of the analysis we get a series of second order differential equations which are solved by the Runge – Kutta method.

The Runge-Kutta algorithm is the magic formula behind many of the physics simulations . The Runge-Kutta algorithm lets us solve a differential equation numerically (that is, approximately) it is known to be very accurate and well-behaved for a wide range of problems.

Consider the single variable problem x‘ = f (t, x) with initial condition x(0) = x0. Suppose that xn is the value of the variable at time tn. The Runge-Kutta formula takes xn and tn and calculates an approximation for xn+1 at a brief time later, tn+h. It uses a weighted average of approximated values of f (t, x) at several times within the interval (tn, tn+h). The formula is given by xn+1 = xn + h6 (a + 2 b + 2 c + d) where a = f (tn, xn)
b = f (tn + h2, xn + h2 a)
c = f (tn + h2, xn + h2 b)
d = f (tn + h, xn + h c).

To run the simulation, we start with x0 and find x1 using the formula above. Then we plug in x1 to find x2 and so on.

With multiple variables, the Runge-Kutta algorithm looks similar to the above equations, except that the variables become vectors.

Make sure that u keep all the derivatives on one side of the equation and then solve.

A C++ code for it is as follows:

double solve(double timestep,double init,double stepsize){
double ret=init;
double time=0.0;
while(timestep–){

double k1,k2,k3,k4;//fc is the function obtained to the right hand side of the diff. equation
k1=fc(time,ret);
k2=fc(time+(stepsize/2.0),ret+(1.0/2.0 * k1 * stepsize));
k3=fc(time+(stepsize/2.0),ret+(1.0/2.0 * k2 * stepsize));
k4=fc(time+(stepsize/2.0),ret+(k3 * stepsize));
ret+=((k1+2*k2+2*k3+k4)/6.0);

}
return ret;
}

Edit: Thanks to Fabio for the correction  in the code