i have write the java program related to double pendulum but it seems that there is something wrong because i am changes the mass of either ball1 or ball2 ,the effect is not present,its actions remains the same and this should not happen,so could you please help me so that my program will be better.
the program that i have write is as following:

package untitled10;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.io.*;
import java.math.*;
public class Applet6 extends Applet implements Runnable,AdjustmentListener,ActionListener
{
TextField tf1;
TextField tf2;
Scrollbar sc1;
Scrollbar sc2;
Scrollbar sc3;
Scrollbar sc4;
double l1=100; // defining all the constants
double l2=70;
double m1=5;
double m2=2;
private Thread t1;
float PI=3.141592654f;
private int i;
private double g=10;
private int r1=5;
private int r2=10;
//private double l=1;
double initial_theta1 = 30*PI/180;
double initial_dtheta1 = 0.6;
double initial_theta2 = 60*PI/180;
double initial_dtheta2 = 0.7;

//private double friction = 100;
double[] t,q,dq,theta1,theta2,dtheta1,dtheta2,momentum1,momentum2;
double h=0.01;

public void init()
{


add(new Label("length1"));
sc1=new Scrollbar(0,10,4,0,200);
sc1.addAdjustmentListener(this);
add(sc1);
add(new Label("length2"));
sc2=new Scrollbar(0,10,4,0,200);
sc2.addAdjustmentListener(this);
add(sc2);
add(new Label("theta1"));
sc3=new Scrollbar(0,5,10,60,180);
sc3.addAdjustmentListener(this);
add(sc3);
add(new Label("theta2"));
sc4=new Scrollbar(0,5,10,30,180);
sc4.addAdjustmentListener(this);
add(sc4);
add(new Label("mass1"));
tf1=new TextField(2);
add(tf1);
tf1.addActionListener(this);
add(new Label("mass2"));
tf2=new TextField(2);
add(tf2);
tf2.addActionListener(this);

t= new double[10000];
theta1 = new double [10000];
dtheta1 = new double [10000];
theta2 = new double [10000];
dtheta2 = new double [10000];
momentum1 = new double [10000];//derivative of angular frequency
momentum2 = new double [10000];
t1=new Thread(this);
t1.start();
q= new double[4];
dq= new double [4];

theta1[0]=initial_theta1;
dtheta1[0]=initial_dtheta1;
theta2[0]=initial_theta2;
dtheta2[0]=initial_dtheta2;
momentum1[0]=(m1+m2)*l1*l1*dtheta1[0]+m2*l1*l2*dtheta2[0]*Math.cos(theta1[0]-theta2[0]);//initial condition
momentum2[0]=m2*l2*l2*dtheta2[0]+m2*l1*l2*dtheta1[0]*Math.cos(theta1[0]-theta2[0]);//initial condition

}
public void adjustmentValueChanged(AdjustmentEvent e)
{
l1=sc1.getValue();
repaint();
l2=sc2.getValue();
repaint();
initial_theta1=sc3.getValue();
initial_theta2=sc4.getValue();
repaint();
}
public void actionPerformed(ActionEvent e){
m1=Integer.parseInt(tf1.getText());
m2=Integer.parseInt(tf2.getText());
repaint();
}

void derive() /* take the value of theta1, theta2, momentum1 and momentum 2
    and gave us the values of dtheta1, dtheta2, dmomentum1 and dmomentum2 */

{
dq[0]=(l2*q[2]-l1*q[3]*Math.cos(q[0]-q[1]))/(l1*l1*l2*(m1+m2*Math.sin(q[0]-q[1])*Math.sin(q[0]-q[1])));
dq[1]=(l1*q[3]*(m1+m2)-l2*m2*q[2]*Math.cos(q[0]-q[1]))/(l1*l2*l2*m2*(m1+m2*Math.sin(q[0]-q[1])*Math.sin(q[0]-q[1])));
dq[2]=-(m1+m2)*g*l1*Math.sin(q[0])-(((q[2]*q[3]*Math.sin(q[0]-q[1]))/(l1*l2*(m1+m2*Math.sin(q[0]-q[1])*Math.sin(q[0]-q[1])))))+((l2*l2*m2*q[2]*q[2]+l1*l1*(m1+m2)*q[3]*q[3]-l1*l2*m2*q[2]*q[3]*Math.cos(q[0]-q[1]))/(2*l1*l2*l1*l2*(m1+m2*Math.sin(q[0]-q[1])*Math.sin(q[0]-q[1]))*(m1+m2*Math.sin(q[0]-q[1])*Math.sin(q[0]-q[1]))))*Math.sin(2*(q[0]-q[1]));
dq[3]=-m2*g*l2*Math.sin(q[1])+(((q[2]*q[3]*Math.sin(q[0]-q[1]))/(l1*l2*(m1+m2*Math.sin(q[0]-q[1])*Math.sin(q[0]-q[1])))))-((l2*l2*m2*q[2]*q[2]+l1*l1*(m1+m2)*q[3]*q[3]-l1*l2*m2*q[2]*q[3]*Math.cos(q[0]-q[1]))/(2*l1*l2*l1*l2*(m1+m2*Math.sin(q[0]-q[1])*Math.sin(q[0]-q[1]))*(m1+m2*Math.sin(q[0]-q[1])*Math.sin(q[0]-q[1]))))*Math.sin(2*(q[0]-q[1]));

}//end of derive

void eular (int i)
{
theta1[i+1]=theta1[i]+h*dq[0];
theta2[i+1]=theta2[i]+h*dq[1];
momentum1[i+1]=momentum1[i]+h*dq[2];
momentum2[i+1]=momentum2[i]+h*dq[3];
}// end of euler
public void run()
{
for(i=0;i<10000;i++)
{
t[i]=i*h;
q[0]=theta1[i];
q[1]=theta2[i];
q[2]=momentum1[i];
q[3]=momentum2[i];
derive();
eular(i);
dtheta1[i]=dq[0];
dtheta2[i]=dq[1];

try
{  repaint();
t1.sleep(5);

}
catch(InterruptedException e ) {}
}
}


public void paint(Graphics g)
{
double x1,y1,x2,y2,x3,y3;
x1=getSize().width/2;
y1=200;
x2=(x1+l1*Math.sin(theta1[i]));
y2=(y1+l1*Math.cos(theta1[i]));
g.drawLine((int)x1,(int)y1,(int)x2,(int)y2);
g.setColor(Color.red);
g.fillOval((int)x2-r1,(int)y2-r1,2*r1,2*r1);
g.fillOval((int)x2-r2,(int)y2-r2,2*r2,2*r2);
x3=x1+l1*Math.sin(theta1[i])+l2*Math.sin(theta2[i]);
y3=y1+l1*Math.cos(theta1[i])+l2*Math.cos(theta2[i]);
//System.out.println(Math.cos(theta1[i])+"  "+Math.cos(theta2[i]));
g.drawLine((int)x2,(int)y2,(int)x3,(int)y3);
g.setColor(Color.yellow);
g.fillOval((int)x3-r1,(int)y3-r1,2*r1,2*r1);
g.fillOval((int)x3-r2,(int)y3-r2,2*r2,2*r2);
}
}



Hope to here from you soon.
Best Regards.


Katia :)