#include<stdlib.h>

#pragma TASS input 
int NX_BOUND;
#pragma TASS input 
int NSTEPS_BOUND;
#pragma TASS input {nx>=2 && nx<=NX_BOUND} 
int nx;
#pragma TASS input 
double u0[nx];
#pragma TASS input {nsteps>=0 && nsteps<=NSTEPS_BOUND} 
int nsteps;
#pragma TASS input 
double kappa;

#pragma TASS output 
double data[nsteps+1][nx];

double u[nx];

void init() {
	int i;
	
	for (i=0; i<nx; i++) u[i] = u0[i];
}

void write(int time) {
	int i;
	
	for (i=0; i<nx; i++) data[time][i] = u[i];
}

void update() {
	double u_new[nx];
	int i;
	
	for (i=1; i<nx-1; i++) u_new[i] =  u[i] + kappa*(u[i+1] + u[i-1] - 2*u[i]);
	for (i=1; i<nx-1; i++) u[i] = u_new[i];
}

void main() {
	int iter;
	
	init();
	write(0);
	for (iter = 1; iter <= nsteps; iter++) {
		update();
		write(iter);
	}
}
