GVA SUPPORT

³ 1326803674
Text:
	Բ =  ..

 :#include <iostream>
#include <cstdlib>  //  rand (), srand ()
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <string>

// 
#define a 0
#define b 1.8
#define h 0.2
#define MAX_X 9
#define MAX_Y 2

// 
double mas[MAX_X][MAX_Y]={ // 10 x 2
       {-0.1              ,-0.985},
       {0.21              ,-0.934},
       {0.63              ,-0.436},
       {0.82              ,-0.0482},
       {0.9               ,0.083},
       {1.29              ,0.962},
       {1.54              ,1.508},
       {1.76              ,1.916},
       {2.13              ,2.336}};
using namespace std;

// =============================================================================


double func_a1(double x){//   
       double sum=0; // . .  32  5

       for (int i = 0 ; i < MAX_X ; i++){
              double z=1;
              for (int j = 0 ; j < MAX_X ; j++)
              {
                  if (i!=j) z*=(x-mas[j][0])/(mas[i][0]-mas[j][0]);
              }
              sum+=z*mas[i][1];
       }
       return sum;
}

// =============================================================================

double func_b(double x){ //  1

        //   
        return (func_a1(x+h)-func_a1(x-h))/(h*2);
}

//==============================================================================

double func_c(double x){//  2
//  |  .   
    return (func_a1(x+h)+func_a1(x-h)-2*func_a1(x)  )/(h*h);

}


//==============================================================================
int main()
{
        cout<<"\tFunction f(x) = cos(2*x)*sin(x)\r\n";
        cout<<"Interval of integration : \r\n";
                cout<<"step of integration dx = \t";
                double dx;
                dx=h;
        double x = a;
        cout<<"integration in process...\r\n";
        double sum = (func_a1(x + dx) - func_a1(x))/2*dx;
        while(x < b)
        {
                sum += (func_a1(x + dx) - func_a1(x))/2*dx;
                x += dx;
        }
        cout<<"complete....\r\n";
        cout<<"result is "<<sum<<"\r\n";
        system("pause");
        return 0;
}
//---------------------------------------------------------------------------


====================================