samedi 18 avril 2015

I'm trying to solve a system of complex differential equation. I would like to fill the complex vector xi[n] with a gaussian valued function. But, when I check the output file, it gives me just a lot of zeros. I gave the input values using the cin function and it worked...what's the problem in this code????



using namespace std;


int main()


{



int n;

int tmax;
int tt = 5000; // number of first-order equations
double ti, tf, dt, sigma,mu,z,q,N ;
complex<double> xi[n], xf[n], eta[tt];
double j;
int i, y,d;
int m=0;




ofstream file;
file.open ("provavet11(om100(2g))).dat");




printf("Number of equations\n");
scanf("%d", &n);
printf("Particles in central cav.\n");
scanf("%d", &N);
printf("Sigma\n");
scanf("%d", &q);


/* initial information */



ti = 0.0;
// initial value for variable t
for(y=0; y<=n-1; y++)

{

//scanf("%f\n", xi[y]);
//cin >> xi[2*y]


// }



xi[y]= N*exp(-pow((y-(n-1)/2.),2)/(2*q*q));


}

Aucun commentaire:

Enregistrer un commentaire