Category : C Source Code
Archive   : DYNAM_S1.ZIP
Filename : YDBLVDP.C

 
Output of file : YDBLVDP.C contained in archive : DYNAM_S1.ZIP
/********************** YDblVdp for double vanderPol *************************/
/********************* (C) 1986,7,8 by JAMES A. YORKE ************************/

#include "yinclud.h"

DEDblVdp(k, Y) /* 2 coupled vanderpol oscillators -- see also
map 23 */
double k[],
Y[];
{
int i;
double tval, /* t is a global variable */
s,
X1,
X2,
Y1,
Y2;
int base;
tval = Y[0];
X1 = Y[1];
Y1 = Y[2];
X2 = Y[3];
Y2 = Y[4];
s = rho * sin(C4 * tval);
k[0] = 1;
k[1] = Y1;
k[2] = C1 * Y1 * (1 - X1 * X1) - C2 * X1 - C3 * X1 * X1 * X1 + s + rho * X2;

k[3] = Y2;
k[4] = C5 * Y2 * (1 - X2 * X2) - C6 * X2 - C7 * X2 * X2 * X2 + s + rho * X1;

if(num_lyap > 0) {
for(i = 0; i < num_lyap; i++) {
base = lyapzero + vec_dim * i;
k[base] = Y[base + 1];
k[base + 1] = (-2 * C1 * X1 * Y1 - C2 - 3 * C3 * X1 * X1) * Y[base]
+ C1 * (1.- X1 * X1) * Y[base + 1]
+ rho * Y[base + 2];
k[base + 2] = Y[base + 3];
k[base + 3] =
rho * Y[base]
+ (-2 * C5 * X2 * Y2 - C6 - 3 * C7 * X2 * X2) * Y[base + 2]
+ C5 * (1 - X2 * X2) * Y[base + 3];
}
}
}
v2_mod() {
double moduloAB();
y[0] = moduloAB(y[0], 0., twopi / C4);/* time */
modFlag = NO;
/* bring y[1] and y[3] into -pi,pi etc. */
y[1] = moduloAB(y[1], -pi, pi);
y[3] = moduloAB(y[3], -pi, pi);
}


initDblVanderpol() {
extern int DEDblVdp(), v2_mod ();
zeroth = 1;
vec_dim = 4; /* the dimension of the Lyapunov vectors =
phase space dim */
num_lyap = 0; /* the number of Lyapunov numbers to be
computed <= vec_dim */
lyapzero = 5; /* y[lyapzero] is the zeroth coord of the
zeroth lyapunov vector */
dim = lyapzero + num_lyap * vec_dim;
/* needed for rungekutta */
X_upper = 2.2; /* x scale */
X_lower = -2.2;
Y_upper = 3.3; /* y scale */
Y_lower = -3.3;
X_coord = 1;
Y_coord = 2;
C1 = 2./ 5.;
C2 = 0.;
C3 = 1.;
C4 =.6;
C5 = 1./ 5.;
C6 = 0.;
C7 = 1.;
rho = 1.0;
steps_per_cycle = 40;
step = (twopi / C4) / steps_per_cycle;
DE = DEDblVdp; /* DE is a pointer to a function */
modPointer = v2_mod;
}



  3 Responses to “Category : C Source Code
Archive   : DYNAM_S1.ZIP
Filename : YDBLVDP.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/