Anterior

Procedimiento numérico

Raíz de una ecuación trascendente

Determinamos el instante t1 resolviendo la ecuación trascendente

( C cos ( ω t ) + D sin ( ω t ) ) · exp ( γ t ) + A cos ( ω f t ) + B sin ( ω f t )   = 0

por el procedimiento del punto medio

Los coeficientes A y B

A = F m ( ω 0 2 ω f 2 ) cos δ + 2 γ ω f sin δ ( ω 0 2 ω f 2 ) 2 + 4 γ 2 ω f 2 B = F m 2 γ ω f cos δ ( ω 0 2 ω f 2 ) sin δ ( ω 0 2 ω f 2 ) 2 + 4 γ 2 ω f 2

Si las condiciones iniciales son t=0, x=x0, v=v0.

C = x 0 A D = 1 ω ( v 0 + γ C ω f B )

 void setNuevo(double wf, double fuerza, double cte, double x0){
     w=Math.sqrt(w0*w0-cte*cte);
     t=0.0;
     tRebote=0.0;
     coeficientes(x0, 0.0, 0.0);  
} void coeficientes(double x0, double v0, double delta){ A=fuerza*((w0*w0-wf*wf)*Math.cos(delta)+2*cte*wf*Math.sin(delta))
/((w0*w0-wf*wf)*(w0*w0-wf*wf)+4*cte*cte*wf*wf); B=fuerza*(2*cte*wf*Math.cos(delta)-(w0*w0-wf*wf)*Math.sin(delta))
/((w0*w0-wf*wf)*(w0*w0-wf*wf)+4*cte*cte*wf*wf); C=x0-A; D=(v0+cte*C-wf*B)/w; } double posicion(double t){ double y=Math.exp(-cte*t)*(C*Math.cos(w*t)+D*Math.sin(w*t))
+A*Math.cos(wf*t)+B*Math.sin(wf*t); return y; } double velocidad(double t){ double y=-cte*Math.exp(-cte*t)*(C*Math.cos(w*t)+D*Math.sin(w*t))
+w*Math.exp(-cte*t)*(-C*Math.sin(w*t)+D*Math.cos(w*t))
+wf*(-A*Math.sin(wf*t)+B*Math.cos(wf*t)); return y; } void mover(){ x=posicion(t); v=velocidad(t); if(x<0.0){ double t0=puntoMedio(t-dt, t); tRebote+=t0; v=velocidad(t0); coeficientes(0.0, -v, wf*tRebote); t=0.0; x=0.0; } t+=dt; } //procedimiento numérico double puntoMedio(double a, double b) { double m, ym; int iter=0; do{ m=(a+b)/2; ym=f(m); if(Math.abs(ym)<CERO) break; if(Math.abs((a-b)/m)<ERROR) break; if((f(a)*ym)<0) b=m; else a=m; iter++; }while(iter<MAXITER); if(iter==MAXITER){ System.out.println("No se ha encontrado la raíz"); } return m; } double f(double z){ return posicion(z); }

 

Anterior