GVA SUPPORT

³äïîâ³äü íà çàïèòàííÿ ¹ 1326803698
Text:
	ԲΠ= Ãîðáà÷åíêî Â.À.

 Çàïèòàííÿ:#include <iostream>
#include <cstdlib>  // òóò rand (), srand ()
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <string>

// ÊÎÍÑÒÀÍÒÈ
#define a -2.0
#define b 0.7
#define h 0.3
#define MAX_X 10
#define MAX_Y 2

// ÌÀÑÈÂ
double mas[MAX_X][MAX_Y]={ // 10 x 2
       {-2.11         ,0.0003},
       {-1.8          ,0.0096},
       {-1.5          ,0.0674},
       {-1.15         ,0.1700},
       {-0.95         ,0.1818},
       {-0.22         ,0.0763},
       {-0.1          ,0.0693},
       {0.34          ,0.1031},
       {0.7           ,0.5819},
       {1.0           ,1.00}};
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;
}
 



//---------------------------------------------------------------------------


====================================	
Âàøà â³äïîâ³äü