Procedimiento numérico
Ecuación diferencial de segundo orden y sistema de dos ecuaciones diferenciales de segundo orden
- Primera etapa: movimiento de rotación de la tabla
Se resuelve la ecuación diferencial por procedimientos numéricos con las siguientes condiciones iniciales: En el instante t=0, θ=0, dθ/dt=0.
Se termina la primera etapa del movimiento en el instante t1 cuando la tabla forma un ángulo θ1 por debajo de la horizontal
- Segunda etapa: La tabla desliza
Resolvemos este sistema de ecuaciones diferenciales por procedimientos numéricos, con las siguientes condiciones iniciales: en el instante t=t1, r=r0, dr/dt=0, y
Concluye esta etapa cuando el valor fuerza normal N
es nulo.
public abstract class State {
double t;
double x;
double vx;
public State(double t, double x, double vx) {
this.t=t;
this.x=x;
this.vx=vx;
}
}
public class Estado extends State{
public Estado(double t, double x, double vx) {
super(t, x, vx);
}
}
public class Estado1 extends State{
double y;
double vy;
public Estado1(double t, double x, double y, double vx, double vy) {
super(t, x, vx);
this.y=y;
this.vy=vy;
}
}
public interface RK {
abstract public void resolver(State e);
}
public abstract class RungeKutta implements RK{
double h;
public RungeKutta(double h){
this.h=h;
}
public void resolver(State e){
//variables auxiliares
double k1, k2, k3, k4;
double l1, l2, l3, l4;
double q1, q2, q3, q4;
double m1, m2, m3, m4;
//condiciones iniciales
double x=e.x;
double v=e.vx;
double t=e.t;
k1=h*v;
l1=h*f(x, v, t);
k2=h*(v+l1/2);
l2=h*f(x+k1/2, v+l1/2, t+h/2);
k3=h*(v+l2/2);
l3=h*f(x+k2/2, v+l2/2, t+h/2);
k4=h*(v+l3);
l4=h*f(x+k3, v+l3, t+h);
//nuevo estado del sistema
x+=(k1+2*k2+2*k3+k4)/6;
v+=(l1+2*l2+2*l3+l4)/6;
//cambia el estado de la partícula
e.x=x;
e.vx=v;
e.t=t+h;
}
abstract public double f(double x, double v, double t);
}
public abstract class RungeKutta1 implements RK{
double h;
public RungeKutta1(double h){
this.h=h;
}
public void resolver(State e){
//variables auxiliares
double k1, k2, k3, k4;
double l1, l2, l3, l4;
double q1, q2, q3, q4;
double m1, m2, m3, m4;
//estado inicial
double x=e.x;
double y=((Estado1)e).y;
double vx=e.vx;
double vy=((Estado1)e).vy;
double t=e.t;
k1=h*vx;
l1=h*f(x, y, vx, vy, t);
q1=h*vy;
m1=h*g(x, y, vx, vy, t);
k2=h*(vx+l1/2);
l2=h*f(x+k1/2, y+q1/2, vx+l1/2, vy+m1/2, t+h/2);
q2=h*(vy+m1/2);
m2=h*g(x+k1/2, y+q1/2, vx+l1/2, vy+m1/2, t+h/2);
k3=h*(vx+l2/2);
l3=h*f(x+k2/2, y+q2/2, vx+l2/2, vy+m2/2, t+h/2);
q3=h*(vy+m2/2);
m3=h*g(x+k2/2, y+q2/2, vx+l2/2, vy+m2/2, t+h/2);
k4=h*(vx+l3);
l4=h*f(x+k3, y+q3, vx+l3, vy+m3, t+h);
q4=h*(vy+m3);
m4=h*g(x+k3, y+q3, vx+l3, vy+m3, t+h);
x+=(k1+2*k2+2*k3+k4)/6;
vx+=(l1+2*l2+2*l3+l4)/6;
y+=(q1+2*q2+2*q3+q4)/6;
vy+=(m1+2*m2+2*m3+m4)/6;
t+=h;
//estado final
e.x=x;
((Estado1)e).y=y;
e.vx=vx;
((Estado1)e).vy=vy;
e.t=t;
}
abstract public double f(double x, double y, double vx, double vy, double t);
abstract public double g(double x, double y, double vx, double vy, double t);
}
public class Sistema extends RungeKutta{
final double lonVarilla=0.102;
double radio;
public Sistema(double radio, double h){
super(h);
this.radio=radio;
}
public double f(double x, double v, double t){
double y=9.8*12*radio*Math.cos(x)/(lonVarilla*lonVarilla+12*radio*radio);
return y;
}
}
public class Sistema1 extends RungeKutta1{
final double lonVarilla=0.102;
double mu;
public Sistema1(double mu, double h){
super(h);
this.mu=mu;
}
public double f(double x, double y, double vx, double vy, double t){
double z=(12*y/(lonVarilla*lonVarilla+12*y*y))*(9.8*Math.cos(x)-2*vx*vy);
return z;
}
public double g(double x, double y, double vx, double vy, double t){
double z=9.8*Math.sin(x)-(mu*lonVarilla*lonVarilla/
public class MiCanvas extends Canvas {
//parámetros
final double lonVarilla=0.102; // 10.2 cm
//intervalo de tiempo
final double dt=0.0005;
double radio=0.55/100;
double angCritico;
double mu;
double x0, y0, v0x, v0y;
double angulo;
double t;
double y, x;
//objeto sistema
RK sistema;
State estado=new Estado(0.0, 0.0, 0.0);
Polygon barra=new Polygon();
int tipo=1;
void setNuevo(double mu, double radio){
this.radio=radio;
this.mu=mu;
tipo=1;
estado=new Estado(0.0, 0.0, 0.0);
sistema=new Sistema(radio, dt);
angCritico=Math.atan(mu/(1+36*radio*radio/(lonVarilla*lonVarilla)));
t=0.0;
}
void mover(){
switch(tipo){
case 1:
sistema.resolver(estado);
if(estado.x>angCritico){
double wCritica=Math.sqrt(24*9.8*radio*Math.sin(angCritico)
|
