"If I have a thousand ideas and only one turns out to be good, I am satisfied."
..."Alfred Nobel(1833-1896, Swedish inventor, chemist, philanthropist)"

Reply #1 on: February 17, 2010, 04:35:53 pm » posted from:Taipei,T\'ai-pei,Taiwan

The following is an EJS version of the above applet (with more options)

You can drag the spring, particle and the rod with mouse click/drag. You can change spring constant k, mass m , spring length L, and damping constant b. Enjoy it!

Reply #2 on: October 24, 2011, 12:51:49 pm » posted from:Taipei,T'ai-pei,Taiwan

Equation used in the above simulation. Assume angle for the pendulum, angular velocity And where calculate spring force and find it tangential component.

Code:

public double calAlpha (double c) { cs=Math.cos(c); sc=Math.sin(c); x=x2-R*cs; y=y2-R*sc; L=Math.sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1)); f=-k*(L-L0); fx=f*(x-x1); fy=f*(y-y1); n=-fx*cs-fy*sc; nx=-n*cs; ny=-n*sc; fx=fx-nx; fy=fy-ny; if(c>0)sign=-1; else sign=1; return sign*Math.sqrt(fx*fx+fy*fy)/I; // where I is the momentum of initial }

"If I have a thousand ideas and only one turns out to be good, I am satisfied."
..."Alfred Nobel(1833-1896, Swedish inventor, chemist, philanthropist)"