Math operations in Chrono (demo_CH_math.cpp) 
  Tutorial on main mathematical tools:
- vectors
- quaternions
- matrices
No GUI: only text output.
// =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of the distribution and at
// http://projectchrono.org/license-chrono.txt.
//
// =============================================================================
// Authors: Alessandro Tasora, Radu Serban
// =============================================================================
//
// Demo on how to use Chrono mathematical functions
//
// =============================================================================
#include "chrono/core/ChMatrix.h"
#include "chrono/core/ChLog.h"
#include "chrono/core/ChVector.h"
#include "chrono/core/ChQuadrature.h"
#include "chrono/core/ChException.h"
#include "chrono/core/ChMathematics.h"
using namespace chrono;
int main(int argc, char* argv[]) {
    // To write something to the console, use the chrono::GetLog()
    // statement, which returns a global output stream to the console (just
    // like the std::out stream).
    GetLog() << "\n=== Computing integrals of functions in 1D/2D/3D ===\n\n";
    // Define a y=f(x) function by inheriting ChIntegrable1D:
      public:
        void Evaluate(double& result, const double x) { result = sin(x); }
    };
    // Create an object from the function class
    MySine1d mfx;
    // Invoke 6th order Gauss-Legendre quadrature on 0..PI interval:
    double qresult = 0;
    ChQuadrature::Integrate1D<double>(qresult, mfx, 0, CH_C_PI, 6);
    // Other quadrature tests, this time in 2D
      public:
        void Evaluate(double& result, const double x, const double y) { result = sin(x); }
    };
    MySine2d mfx2d;
    qresult = 0;
    ChQuadrature::Integrate2D<double>(qresult, mfx2d, 0, CH_C_PI, -1, 1, 6);
    // Other quadrature tests, this time with vector function (that is, integrates 2x1 matrix)
      public:
            result(0, 0) = x * y;
            result(0, 1) = 0.5 * y * y;
        }
    };
    MySine2dM mfx2dM;
    ChMatrixNM<double, 1, 2> resultM;
    resultM.setZero();
    ChQuadrature::Integrate2D<ChMatrixNM<double, 1, 2>>(resultM, mfx2dM, 0, 1, 0, 3, 6);
    return 0;
}
Base class for 1D integrand T=f(x) to be used in ChQuadrature.
Definition: ChQuadrature.h:83
As ChIntegrable1D, but for 2D integrand T=f(x,y) to be used in ChQuadrature.
Definition: ChQuadrature.h:95
ChLog & GetLog()
Global function to get the current ChLog object.
Definition: ChLog.cpp:39
Eigen::Matrix< T, M, N, Eigen::RowMajor > ChMatrixNM
Dense matrix with fixed size (known at compile time).
Definition: ChMatrix.h:52
