Page 779 - Chapra y Canale. Metodos Numericos para Ingenieros 5edición_Neat
P. 779

25.4  SISTEMAS DE ECUACIONES                                     755

                 a) Programa principal o “manejador”           b) Rutina para tomar un paso de salida
                 Asigna valores para                           SUB Integrator (x, y, n, h, xend)
                 n = número de ecuaciones                        DOFOR
                 y i  = valores iniciales de n variables           IF (xend – x < h) THEN h = xend – x
                        dependientes                               CALL RK4 (x, y, n, h)
                 x i  = valor inicial de la variable               IF (x > xend) EXIT
                        independiente                            END DO
                 xf = valor final de la variable               END SUB
                      independiente
                                                               c) Método RK de cuarto orden para un sistema
                 dx = cálculo del tamaño de paso
                                                                 de EDO
                 xout = intervalo de salida
                                                               SUB RK4(x, y, n, h)
                 x = xi                                          CALL Derivs (x, y, k1)
                 m = 0                                           DOFOR i = 1, n
                 xp m  = x                                         ym i  = y i  + k1 i  * h/2
                 DOFOR i = 1, n                                  END DO
                                                                 CALL Derivs (x + h / 2, ym, k2)
                 yp i,m  = y i
                                                                 DOFOR i = 1, n
                 y i  = yi i
                 END DO                                            ym i  = y i  + k2 i  * h / 2
                 DOFOR                                           END DO
                   xend = x + xout                               CALL Derivs (x + h / 2, ym, k3)
                   IF (xend > xf) THEN xend = xf                 DOFOR i = 1, n
                   h = dx                                          ye i  = y i  + k3 i  * h
                   CALL Integrator (x, y, n, h, xend)            END DO
                   m = m + 1                                     CALL Derivs (x + h, ye, k4)
                   xp m  = x                                     DOFOR i = 1, n
                   DOFOR i = 1, n                                  slope i  = (k1 i  + 2*(k2 i +k3 i )+k4 i )/6
                     yp i,m  = yi                                  y i  = y i  + slope i  * h
                   END DO                                        END DO
                   IF (x > xf) EXIT                              x = x + h
                 LOOP                                          END SUB
                 DISPLAY RESULTS
                 END                                           d) Rutina para determinar derivadas
                                                               SUB Derivs (x, y, dy)
                                                                 dy 1  = ...
                                                                 dy 2  = ...
                                                               END SUB
                 FIGURA 25.18
                 Seudocódigo del método RK de cuarto orden para sistemas de ecuaciones.



                                         donde y  y y  = desplazamiento angular y velocidad en el caso no lineal. Resuelva estos
                                                  4
                                               3
                                         sistemas en dos casos: a) un pequeño desplazamiento inicial (y  = y  = 0.1 radianes; y  =
                                                                                              3
                                                                                          1
                                                                                                            2
                                         y  = 0) y b) un gran desplazamiento (y  = y  = p/4 = 0.785398 radianes; y  = y  = 0).
                                                                       1
                                                                           3
                                         4
                                                                                                   2
                                                                                                       4
                                         Solución.
                                          a)  Los resultados calculados para los modelos lineal y no lineal son casi idénticos (fi -
                                            gura 25.19a). Esto era lo que se esperaba, ya que cuando el desplazamiento inicial
                                            es pequeño, sen (q) ≅ q.
                                                                                                         6/12/06   14:02:05
          Chapra-25.indd   755
          Chapra-25.indd   755                                                                           6/12/06   14:02:05
   774   775   776   777   778   779   780   781   782   783   784