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

 
Output of file : YMAPMENU.C contained in archive : DYNAM_S1.ZIP
/************************* YMapMenu.C ************************/
/********************* (C) 1986,7,8 by JAMES A. YORKE ************************/

#include "yinclud.h"
/* ************************** routines in file:
map_menu(output,map) for select_map() /
FILE *output;
char *map;
d_mod()
v_mod()
p_mod()
v2_mod()
y_mod_for_des()
init_map(output)
FILE *output;
This routine should occur after the maps are defined or
the maps should be declared. Notice the declaration of the
differential equations
****************************/
#ifdef YYFILE
char otherText[80] = "\r";
#endif



map_menu(output,map) /* for select_map() */
FILE *output;
char *map;
{
/* if output = stdprn, program would send the list to the printer */
if(strcmp(map,"all") == 0)
get_set(output,map);


/* Written by JIM YORKE,(c)1985,6,7,8 Copy freely, but do not sell.\n");*/
if (strcmp(map,"all") == 0)
fputs("\n",output);

if (strcmp(map,"all") == 0)
fputs(
"C Cubic map in complex plane \n"
,output);
TESTMAP("c")
fputs(
"C Cubic in complex plane rho*Z^3 + (C1+iC2)*Z^2 + (C3+iC4)*Z + C5+iC6\n"
,output);
TESTMAP("c")
fputs("Z = X + iY; set rho = 0 for quadratic polynomial\n"
,output);




if (strcmp(map,"all") == 0)
fputs(
"DR Double Rotor: A 4-dim map \n"
,output);
TESTMAP("dr")
fputs(
"DR Double Rotor: A 4-dim map: 2 linked rods with impulse strength rho \n"
,output);

TESTMAP("dr")
{ fputs(
"mass1,2=C1,2;length2=C4;length1=C4*sqrt(C2/ C1+C2);damping1,2=C5,6 hittime=C7"
,output);
fputs("\n",output);
}


if (strcmp(map,"all") == 0)
fputs(
"DDR Degenerate Double Rotor \n"
,output);
TESTMAP("ddr")
fputs(
"DDR Degenerate Double Rotor: like DR except wait until it stops each time\n"
,output);
TESTMAP("ddr")
{ fputs(
"mass1,2=C1,2;length2=C4;length1=C4*sqrt(C2/ C1+C2);damping1,2=C5,6 \n"
,output);
}


if (strcmp(map,"all") == 0)
fputs(
"H The Henon map \n"
,output );
TESTMAP("h")
fputs(
"H The Henon map: (x,y) -> (rho -x*x +C1*y, x) \n"
,output );


if (strcmp(map,"all") == 0)
fputs(
"I Ikeda Laser map\n"
,output);
TESTMAP("i")
fputs(
"I Ikeda Laser map:(Z = x+iy) Z -> rho +C2*Z*exp{i[C1 - C3/(1 + |Z|^2)]}\n"
,output);
TESTMAP("i")
fputs(
" tau = C1 - C3/(1+x*x+y*y); x -> rho + C2*[x*cos(tau) -y*sin(tau)] \n"
,output);
TESTMAP("i")
fputs(
" y -> C2*[x*sin(tau) +y*cos(tau)]\n"
,output);


if (strcmp(map,"all") == 0)
fputs(
"Q Quasiperiodicity map \n"
,output);
TESTMAP("q")
fputs(
"Q Quasiperiodicity vs Chaos See Grebogi-Ott-Yorke Physica 15D 1985 p.354\n"
,output);
TESTMAP("q"){
fputs(
" X -> X + C1 + rho*P1, Y ->Y + C2 + rho*P2 both mod 1 \n"
,output);
fputs(
" P1 and P2 are each period 1 in X and Y. Map is invertible for rho < 0.673\n"
,output);
}


if (strcmp(map,"all") == 0)
fputs(
"R Pulsed Rotor and standard map\n"
,output);
TESTMAP("r")
fputs(
"R Pulsed Rotor: x -> x + y mod(2 pi) + pi THEN y -> C1*y + rho*sin(x)\n"
,output);


if (strcmp(map,"all") == 0)
fputs(
"RR Random Rotate map \n"
,output);
TESTMAP("rr")
fputs(
"RR at Random either Rotate by C1 degrees and mult by rho OR flip about 1,0\n"
,output);
TESTMAP("rr")
{
fputs(
" The probability of a flip (x -> 2-x, y-> -y) is C2\n"
,output);
fputs(
" Otherwise rotate C1 degrees about 0,0 and multiply x and y by rho (<1)\n"
,output);
}



if (strcmp(map,"all") == 0)
fputs(
"T Tinkerbell:",output);
TESTMAP("t"){
fputs(
"T Tinkerbell:",output);
fputs(
" x(n+1) = x*x-y*y + C1*x +C2*y; y(n+1) = 2*x*y + C3*x +C4*y\n",output);
}

#ifdef DONTPRINT
#ifdef MS
TESTMAP2("testh")
fputs(
"TESTH (experimental) The Henon map: (x,y) -> (rho -x*x +C1*y, x) \n"
,output );
#endif
#endif /* DONTPRINT */

/* space break between maps and dif eqns */
if (strcmp(map,"all") == 0)
fputs("\n",output);


if (strcmp(map,"all") == 0)
fputs(
"D Forced Double Well Duffing equation\n"
,output);
TESTMAP("d")
fputs(
"D Forced Double Well Duffing x'' +C1*x' -C2*x +C3*x^3 = rho*sin(C4*t)\n"
,output);
TESTMAP("d")
fputs(
"Numbering of variables: y[0]= time mod twopi/C4 ,y[1]=x, y[2]=x', y[3]=t \n"
,output);


if (strcmp(map,"all") == 0)
fputs(
"L The Lorenz system \n"
,output);
TESTMAP("l")
fputs(
"L The Lorenz system: x'= sigma*(y-x), y'= rho*x -y -x*z, z'= x*y- beta*z\n"
,output);
TESTMAP("l")
fputs(
"Numbering of variables: y[0]=x ,y[1]=y, y[2]=z, y[3]=time \n"
,output);


if (strcmp(map,"all") == 0)
fputs(
"LPR The Lorenz system's Poincare Return map \n"
,output);
TESTMAP("lpr")
fputs(
"LPR The Lorenz system: Poincare Return map using plane z = rho - 1 \n"
,output);
TESTMAP("lpr")
fputs(
"A dot is plotted in x-y plane when trajectory crosses downward past z=rho-1\n"
,output);


if (strcmp(map,"all") == 0)
fputs(
"P Forced Damped Pendulum \n"
,output);
TESTMAP("p")
fputs(
"P Forced Damped Pendulum x''+C1*x' +C2*sin x =rho*(C3+cos(C4*t)) \n"
,output);
TESTMAP("p")
fputs(
"Numbering of variables: y[0]= time mod twopi/C4 ,y[1]=x, y[2]=x', y[3]=t \n"
,output);

if (strcmp(map,"all") == 0)
fputs(
"SAM N.Samardzija/L.Geller odd symmetry Lorenz-like system \n"
,output);
TESTMAP("sam")
fputs(
"SAM N.Samardzija/L.Geller: x'= C1*x+C2*y-z, y'= C3*x+C5*y-C6*x^3, z'= rho*x\n"
,output);
TESTMAP("sam")
fputs(
"Numbering of variables: y[0]=x ,y[1]=y, y[2]=z, y[3]=time \n"
,output);

if (strcmp(map,"all") == 0)
fputs(
"V forced Van der Pol equation \n"
,output);
TESTMAP("v")
fputs(
"V Van der Pol x''- C1*x'*(1-x*x) +C2*x +C3*x^3 =rho*sin(C4*t) \n"
,output);


if (strcmp(map,"all") == 0)
fputs(
"V2 2 forced coupled Van der Pol equations \n"
,output);
TESTMAP("v2")
fputs(
"V2 2 VdPs: x1''- C1*x1'*(1-x1*x1) +C2*x1 +C3*x1^3 =rho*{sin(C4*t) +x2} \n"
,output);
TESTMAP("v2")
fputs(
" x2''- C5*x2'*(1-x2*x2) +C6*x2 +C7*x2^3 =rho*{sin(C4*t) +x1} \n"
,output);
TESTMAP("v2")
fputs(
"Variables: y[0]= time mod twopi/C4 ,y[1]=x1, y[2]=x1', y[3]=x2, y[4]=x2' \n"
,output);


#ifdef DONTPRINT
#ifdef MS
TESTMAP2("testp")
fputs(
"TESTP is a pendulum;Variables: y[0]= time mod twopi,y1 is in -pi,pi \n"
,output);
#endif /* DONTPRINT */

#ifdef TESTING /* not yet for public consumption */
TESTMAP2("other")
fputs(
"OTHER is for previously prepared files of reverse Polish notation commands\n"
,output);
TESTMAP("other")
fputs( otherText, output);
#endif /* TESTING */

#endif
if (strcmp(map,"all") == 0)
fputs(
"other differential equations PD: (Parametric Duffing) \n"
,output);

TESTMAP("pd")
{
fputs(
"PD PARAMETRICALLY DRIVEN DUFFING: \n"
,output);
fputs(
" x'' +C1*x' -x +C2*(1+rho*sin(C4*t))*x^2 +C3*(1+rho*sin(C4*t))*x^3 = 0\n"
,output);
}

if (strcmp(map,"all") == 0)
fputs(
"XX to terminate program \n"
,output);
}



/* y[0] = moduloAB(y[0],0.,1.);
y[1] = moduloAB(y[1],0.,1.);
*/

init_map(output)
FILE *output;

/* This routine should occur after the maps are defined or
the maps should be declared. Notice the declaration of the
differential equations */
{
#ifdef YYFILE
int initOther();
#endif
int GetMapName();
/* the following do not have to be declared if they are defined
in this file above the spot where it is called */
char *gets();/* gets obtains a line-edited string from the console and
puts it into the beffer that is its argument: gets(buf);
it returns its argument or 0 on end of file or on error; */

strcpy(MapName,"-9999");/*this is default for detecting bad input*/

while(strcmp(MapName,"-9999") ==0)/* go thru this routine until a legal
map is typed and a break occurs */
{
if (input == StInput)
map_menu(output,"all");/* this just prints info on the screen*/

if (GetMapName() <= 0)/* means the name is not acceptable */
{
strcpy(MapName,"-9999");/* this re-initializes to the
default for detecting bad input */
continue;
}

TESTMAP("a")
{
init_aron();
continue; /* causes exit from switch */
}
TESTMAP("rr")
{
init_bob();
continue; /* causes exit from switch */
}
TESTMAP("c")/* cubic */
{
initcubic();
continue; /* causes exit from switch */
}
TESTMAP("h")
{
initHenon();
continue; /* causes exit from switch */
}
TESTMAP("q")
{ /* Ruelle-Takens torus map */
initRuelleTakens();
continue; /* causes exit from switch */
}
TESTMAP("t")
{
initComplex();
continue; /* causes exit from switch */
}
TESTMAP("r")
{
initRotor();
continue; /* causes exit from switch */
}
TESTMAP("dr")
{ /* double rotor in YDblRtr.C */
initDblRotor();
continue; /* causes exit from switch */
}
TESTMAP("ddr")
{ /* Degenerate double rotor in YDegen.C */
initDegenerateDblRotor();
continue; /* causes exit from switch */
}
TESTMAP("i")/* Ikeda */
{
initLaser();
continue; /* causes exit from switch */
}
TESTMAP("l")
{
initLorenz();
continue;
}
TESTMAP("lpr")
{
initLRetMap();
continue;
}
TESTMAP("sam")
{
initSam();
continue;
}
TESTMAP("d")/* Duffing */
{ /* x'' + C1*x' -C2*x +C3*x^3 = rho*sin(C4*t) */
initDED();
continue; /* causes exit from switch */
}
TESTMAP("p")
{
initDEP();
continue; /* causes exit from switch */
}
TESTMAP("pd")/* Parametric Duffing */
{
initDEPD();
continue; /* causes exit from switch */
}
TESTMAP("v")
{
initDEV();
continue; /* causes exit from switch */
}
TESTMAP("v2")
{
initDblVanderpol();
continue; /* causes exit from switch */
}
#ifdef YYFILE
TESTMAP("testh")
{
initTestH();
continue; /* causes exit from switch */
}
TESTMAP("testp")
{
initTestP();
/* modPointer is specified in initTestP() */
continue; /* causes exit from switch */
}
TESTMAP("other")
{
if (initOther() == YES) /* this routine in YY.C
asks for a file name and tries to open it;
if the file can be opened, it returns YES */
continue; /* causes exit from switch */
}
#endif
TESTMAP("xx")
{
level = KILL;
character_mode();
exit(0);
continue;
}
PRINT
"That was NOT a proper response buster; try again. To exit: XX \n");
strcpy(MapName,"-9999");/* this is
default for detecting bad input */
continue;
} /* while end */
}






  3 Responses to “Category : C Source Code
Archive   : DYNAM_S1.ZIP
Filename : YMAPMENU.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/