123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #include "Lemma"
- using namespace Lemma;
- using namespace std;
-
- #ifdef LEMMAUSEVTK
- #include "matplot.h"
- using namespace matplot;
- #endif
-
- int main() {
-
- int N = 600;
- int upb = 5;
- int lowb = -1;
- VectorXr func(N);
- VectorXr wx(N);
- Real integrationres,actres;
-
- gaussianquadrature *lgqw = gaussianquadrature::New();
- lgqw->SetFreqs(N,upb,lowb);
- lgqw->CalcAW();
-
- wx=lgqw->GetAbscissae();
- func=cos(wx.array());
-
-
-
-
- lgqw->SetFunc(func);
- lgqw->Integrate();
- integrationres=lgqw->GetResult();
-
- actres = -sin((Real)upb)+sin((Real)lowb);
-
- cout << "Gaussian Quadrature Result: " << integrationres << endl;
- cout << "Actual Result: " << actres << endl;
-
-
-
- #ifdef LEMMAUSEVTK
- double colour1[3] = {0.0,0.0,1.0};
-
- Plot2D_VTK p1("X", "Y", 800,600);
- p1.plot(wx,func,colour1,".-");
- p1.show();
-
- #endif
-
- return EXIT_SUCCESS;
- }
|