int main(int argc, char **argv){ double(*fn_array[3])(double) = {x_2,x_4,x_6}; struct pair* pair_array[3]={N_2,N_3,N_4}; printf("%-10s%-10s%-10s%-10s\n", "N","x^2","x^4","x^6"); for (int i = 0; i < 3; ++i){ printf("%-10d", i+2 ); for(int j=0 ;j<3; j++){ printf("%-10.4f",approximation(pair_array[i],fn_array[j],i+2)); } printf("\n"); } printf("Part B I - %f\n",approximation(N_4,exp_fn,4)); return 0; }
int main () { double * log = natural_log (); double * approx = approximation (); double * percent = percentage(log, approx); file_output (log, approx, percent); return 0; }
void Ball::activateBallShader() const { //float lightPos[4] = { 0.0f, 0.0f, 1.0f, 0.0f }; //glLightfv(GL_LIGHT0, GL_POSITION, lightPos); //glEnable(GL_LIGHTING); Vector3 normal(0.0f, 0.0f, 1.0f); float light = approximation(mPos, normal); if (hasBallTexture()) { //glEnable(GL_TEXTURE_2D); //glBindTexture(GL_TEXTURE_2D, sTextureBall); ColorStack::colorStack.setColor(Color4(light, light, light)); } else { ColorStack::colorStack.setColor(Color4(light, 0.0f, 0.0f)); } }
int main() { #ifdef __WIN__ system("chcp 65001"); #endif // __WIN__ srand (time(NULL)); INIReader reader("config.ini"); if (reader.ParseError() < 0) { printf("Can't load 'config.ini'\n"); return 1; } int N = 1000; int M = 5000; int z; bool A, P, T; z = reader.GetInteger("analytical", "z", 0); if (z) { double l = reader.GetReal("analytical", "l", 0.001); double ecut = reader.GetReal("analytical", "ecut", 400); analytical(z, M, N, l, ecut); A = true; } z = reader.GetInteger("table", "z", 0); if (z) { double l = reader.GetReal("table", "l", 0.001); double ecut = reader.GetReal("table", "ecut", 400); table(z, M, N, l, ecut); T = true; } z = reader.GetInteger("approximation", "z", 0); if (z) { double l = reader.GetReal("approximation", "l", 0.001); double ecut = reader.GetReal("approximation", "ecut", 400); approximation(z, M, N, l, ecut); P = true; } z = reader.GetInteger("monte-carlo", "z", 0); if (z) { double l = reader.GetReal("monte-carlo", "l", 0.00001); double s = reader.GetReal("monte-carlo", "s", 0.0001); double ecut = reader.GetReal("monte-carlo", "ecut", 10); int nparticles = reader.GetInteger("monte-carlo", "particles", 400); int ntimes = reader.GetInteger("monte-carlo", "times", 400); int N = 100; monte_carlo(z, nparticles, ntimes, N, ecut, s, l); plot_mc(); } plot_analytics(A, P, T); return 0; }