double Parameters::calculate_fy(int area_number, double x, double y)
	{
		if(Testing_parameters::test == 1)
			switch(area_number)
			{
				case 0: return 1.0 / calculate_rho(area_number) * 0;
				case 1:	return 1.0 / calculate_rho(area_number) * 0;
				default: return 1.0;
			}
		if (Testing_parameters::test == 2)
			switch (area_number)
			{
			case 0: return 0.0;
			case 1:	return 0.0;
			default: return 0.0;
			}
		if(Testing_parameters::test == 3)
			switch(area_number)
			{
			case 0: return -calculate_lambda(area_number) * (60 * x * x - 60 * y * y) + 
							1.0 / calculate_rho(area_number) * (60 * x * x - 60 * y * y) + 
							400 * pow_i(4, x)  * pow_i(3, y) + 100 * (pow_i(7, y) 
							- pow_i(4, x)  * pow_i(3, y));
			case 1:	return -calculate_lambda(area_number) * (60 * x * x - 60 * y * y) + 
							1.0 / calculate_rho(area_number) * (60 * x * x - 60 * y * y) + 
							400 * pow_i(4, x)  * pow_i(3, y) + 100 * (pow_i(7, y)
							- pow_i(4, x)  * pow_i(3, y));
			default: return 1.0;
			}

		return 1.0;
	}
Ejemplo n.º 2
0
Archivo: pow.cpp Proyecto: gianct79/bst
int main()
{
    int b, e;
    while (std::cin >> b >> e) {
        std::cout << pow_r(b, e) << '\n';
        std::cout << pow_i(b, e) << '\n';
    }
    return 0;
}
	double Parameters::calculate_fx(int area_number, double x, double y)
	{
		if(Testing_parameters::test == 1)
			switch(area_number)
			{
				case 0: return 1.0 / calculate_rho(area_number) * 0;
				case 1:	return 1.0 / calculate_rho(area_number) * 0;
				default: return 1.0;
			}
		if (Testing_parameters::test == 2)
			switch (area_number)
			{
			case 0: return 0.0;
			case 1:	return 0.0;
			default: return 0.0;
			}

		if(Testing_parameters::test == 3)
			switch(area_number)
			{
			case 0: return -calculate_lambda(area_number) * 120 * x * y + 
							1.0 / calculate_rho(area_number) * 120 * x * y + 
							400 * x * pow_i(6, y) + 300 * (pow_i(5, x) * y * y
							- x * pow_i(6, y));
			case 1:	return -calculate_lambda(area_number) * 120 * x * y + 
							1.0 / calculate_rho(area_number) * 120 * x * y + 
							400 * x * pow_i(6, y) + 300 * (pow_i(5, x) * y * y
							- x * pow_i(6, y));
			default: return 1.0;
			}

		return 1.0;
	}