#include #include #include "project.h" #define PRINT(X,Y) printf("%i %f\n",X,Y); /************************************************************************ * Reads in a binary sequence and outputs a graph representing the * * Scrodinger equation * * David Longbottom * ************************************************************************/ int main (int argc, char *argv[]) { char c; int i = 2; float t = 1; float E = 1; float V = V_A; float ca, cb, cc; ca = 0; cb = 1; //Useage: ./sequence2spectrum [E][c1] if (argc > 1 ) E = atof(argv[1]); if (argc > 2 ) cb = atof(argv[2]); fprintf(stderr,"Value of E used: %f\n\ Value of c1 used: %f\n",E,cb); //starting values PRINT(0,ca) PRINT(1,cb) while ( TRUE ) { if ((c = getchar() ) == '\n' ) break; // \n is end of line V = (c == A) ? V_A : V_B; //fprintf(stderr,"%i ",(int)V); cc = cb; cb = (E-V)*cb/t - ca; ca = cc; PRINT(i,cb) i++; } return(EXIT_SUCCESS); }