#include <iostream>
#include <math.h>
using namespace std;
float f_1(float x, int n)
{
float result = 0;
for(int k = 1; k <= n; k ++)
result += (sin(k * x) + sin((k*x - 1)/2))/exp(x - 1.0/k);
return result * sqrt(n * M_PI);
}
float f_2(float x, int n)
float result = 1.0;
result *= pow(pow(x, k - 1.0)/(k + 1.0/3.0), 1.0/k) + 0.5;
return sqrt(x)* log(x) - result;
float f_3(float x, int n)
result += pow(exp(k + sqrt(x))*cos(2.0*x/k), 1.0/k);
return sqrt(abs(x) + n) * result;
float f_4(float x, int n)
result *= sqrt(x*x * pow(log(n),k/2.0))/(k + 4.0/3.0);
return exp(x) - sin(x) + result;
float f_5(float x, int n)
result += pow(x, k - 1.0)/(abs(log(k*x*x))+2.0/3.0);
return (x*x + pow(x, 1.0/3.0)) *result;
int main()
cout.setf(ios::fixed);
float x;
int n;
cout << "Vvedite x, n" << endl;
cin >> x >> n;
cout << "f_1(x, n) = " << f_1(x,n)<< endl;
cout << "f_2(x, n) = " << f_2(x,n)<< endl;
cout << "f_3(x, n) = " << f_3(x,n)<< endl;
cout << "f_4(x, n) = " << f_4(x,n)<< endl;
cout << "f_5(x, n) = " << f_5(x,n)<< endl;
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
#include <iostream>
#include <math.h>
using namespace std;
float f_1(float x, int n)
{
float result = 0;
for(int k = 1; k <= n; k ++)
result += (sin(k * x) + sin((k*x - 1)/2))/exp(x - 1.0/k);
return result * sqrt(n * M_PI);
}
float f_2(float x, int n)
{
float result = 1.0;
for(int k = 1; k <= n; k ++)
result *= pow(pow(x, k - 1.0)/(k + 1.0/3.0), 1.0/k) + 0.5;
return sqrt(x)* log(x) - result;
}
float f_3(float x, int n)
{
float result = 0;
for(int k = 1; k <= n; k ++)
result += pow(exp(k + sqrt(x))*cos(2.0*x/k), 1.0/k);
return sqrt(abs(x) + n) * result;
}
float f_4(float x, int n)
{
float result = 1.0;
for(int k = 1; k <= n; k ++)
result *= sqrt(x*x * pow(log(n),k/2.0))/(k + 4.0/3.0);
return exp(x) - sin(x) + result;
}
float f_5(float x, int n)
{
float result = 0;
for(int k = 1; k <= n; k ++)
result += pow(x, k - 1.0)/(abs(log(k*x*x))+2.0/3.0);
return (x*x + pow(x, 1.0/3.0)) *result;
}
int main()
{
cout.setf(ios::fixed);
float x;
int n;
cout << "Vvedite x, n" << endl;
cin >> x >> n;
cout << "f_1(x, n) = " << f_1(x,n)<< endl;
cout << "f_2(x, n) = " << f_2(x,n)<< endl;
cout << "f_3(x, n) = " << f_3(x,n)<< endl;
cout << "f_4(x, n) = " << f_4(x,n)<< endl;
cout << "f_5(x, n) = " << f_5(x,n)<< endl;
return 0;
}