MathCheck.cpp File Reference
#include "Math/Helpers.h"
#include "Math/ExtendedMath.h"
#include <sstream>

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
10 {
11  std::stringstream ss;
12  for (Mdouble x=-6; x<6; x+=0.01)
13  {
18  ss << x << " "
19  << e << " "
20  << l << " "
21  << c << " "
22  << s << "\n";
23  }
24  logger(INFO, "Execute 'gnuplot MathCheck.gnu' to view output");
25  helpers::writeToFile("MathCheck.data", ss.str());
26  helpers::writeToFile("MathCheck.gnu",
27  "set xlabel 'x'\n"
28  "p 'MathCheck.data' u 1:(log($2)) t 'log(Exp(x))',"
29  " 'MathCheck.data' u 1:3 t 'Log(Exp(x))', x,"
30  " 'MathCheck.data' u 1:5 t 'Sin(x)', sin(x),"
31  " 'MathCheck.data' u 1:4 t 'Cos(x)', cos(x)x"
32  "\n");
33  //WARNING: sin and cos are really bad outside (-pi,pi)
34  Mdouble d = 1e-15;
35  logger(INFO, "Accuracy of sin: %\n"
36  "Accuracy of cos: %",
38 }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
double Mdouble
Definition: GeneralDefine.h:13
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
RealScalar s
Definition: level1_cplx_impl.h:130
#define INFO(i)
Definition: mumps_solver.h:54
int c
Definition: calibrate.py:100
const Mdouble pi
Definition: ExtendedMath.h:23
bool writeToFile(const std::string &filename, const std::string &filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:29
Mdouble log(Mdouble Power)
Definition: ExtendedMath.cc:83
Mdouble cos(Mdouble x)
Definition: ExtendedMath.cc:43
Mdouble exp(Mdouble Exponent)
Definition: ExtendedMath.cc:63
Mdouble sin(Mdouble x)
Definition: ExtendedMath.cc:23
list x
Definition: plotDoE.py:28

References calibrate::c, mathsFunc::cos(), e(), mathsFunc::exp(), INFO, mathsFunc::log(), logger, constants::pi, s, mathsFunc::sin(), helpers::writeToFile(), and plotDoE::x.