Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- long double f_xmax(double x);
- long double f_sum(double x);
- int main()
- {
- double x = -2, h = 0.4;
- int n = (2+2)/h+1;
- double array[2][n];
- for (int i = 0; i < n; i++)
- {
- array[0][i] = x;
- if (x > 0)
- {
- array[1][i] = f_xmax(x);
- }
- else
- {
- array[1][i] = f_sum(x);
- }
- x += h;
- }
- for (int i = 0; i < 2; i++)
- {
- for (int j = 0; j < n; j++)
- {
- cout << array[i][j] << "\t";
- }
- cout << endl;
- }
- }
- long double f_xmax(double x)
- {
- double tempSum = pow(x,3)/1/5;
- return tempSum;
- }
- long double f_sum(double x)
- {
- double tempSum = 0;
- int k = 1;
- for (int i = 0; i < 3; i++)
- {
- tempSum += pow(x,2) + pow(x,k)/k;
- k++;
- }
- return tempSum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement