void problem_output(){
	if (output_check(10000.)){
		output_timing();
		integrator_synchronize();
		FILE* f = fopen("energy.txt","a");
		double e = energy();
		fprintf(f,"%e %e %e\n",t, fabs((e-e_init)/e_init), tools_megno());
		fclose(f);
		printf("  Y = %.3f",tools_megno());
	}
}
Пример #2
0
void problem_output(){
	if (output_check(1000.*dt)){
		output_timing();
	}
	if (output_check(362.)){
		// Output the time and the MEGNO to the screen and a file.
		FILE* f = fopen("Y.txt","a+");
		fprintf(f,"        %.20e     %.20e\n",t, tools_megno());
		printf("        %.20e     %.20e\n",t, tools_megno());
		fclose(f);
	}
}
Пример #3
0
void tools_megno_update(double dY){
	// Calculate running Y(t)
	tools_megno_Ys += dY;
	double Y = tools_megno_Ys/t;
	// Calculate averge <Y> 
	tools_megno_Yss += Y * dt;
	// Update covariance of (Y,t) and variance of t
	tools_megno_n++;
	double _d_t = t - tools_megno_mean_t;
	tools_megno_mean_t += _d_t/(double)tools_megno_n;
	double _d_Y = tools_megno() - tools_megno_mean_Y;
	tools_megno_mean_Y += _d_Y/(double)tools_megno_n;
	tools_megno_cov_Yt += ((double)tools_megno_n-1.)/(double)tools_megno_n 
					*(t-tools_megno_mean_t)
					*(tools_megno()-tools_megno_mean_Y);
	tools_megno_var_t  += ((double)tools_megno_n-1.)/(double)tools_megno_n 
					*(t-tools_megno_mean_t)
					*(t-tools_megno_mean_t);
//	// Check to see if we need to rescale
//	if (tools_megno_delta0!=0){
//		tools_megno_rescale();
//	}
}