2014-02-10 11:22:56 +00:00
|
|
|
#include <iostream>
|
2014-03-13 18:51:01 +00:00
|
|
|
#include <LatAnalyze/CompiledFunction.hpp>
|
|
|
|
#include <LatAnalyze/Math.hpp>
|
|
|
|
#include <LatAnalyze/Plot.hpp>
|
2014-09-22 15:19:46 +01:00
|
|
|
#include <LatAnalyze/TabFunction.hpp>
|
2014-02-10 11:22:56 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Latan;
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2014-09-22 15:19:46 +01:00
|
|
|
const Index nPoint = 8;
|
2014-02-10 11:22:56 +00:00
|
|
|
Plot p;
|
2014-09-22 15:19:46 +01:00
|
|
|
DVec x(nPoint), y(nPoint);
|
2014-02-10 11:22:56 +00:00
|
|
|
|
2014-09-22 15:19:46 +01:00
|
|
|
for (Index i = 0; i < nPoint; ++i)
|
|
|
|
{
|
|
|
|
x(i) = static_cast<double>(i)/2.;
|
|
|
|
y(i) = x(i)*x(i);
|
|
|
|
}
|
|
|
|
p << PlotRange(Axis::x, -5.0, 5.0) << PlotRange(Axis::y, -5.0, 20.0);
|
2014-03-03 18:34:35 +00:00
|
|
|
p << Color("rgb 'blue'") << PlotFunction(StdMath::tgamma, -5, 5);
|
|
|
|
p << PlotFunction(CompiledDoubleFunction(1, "return cos(x_0)^2;"), -5, 5);
|
|
|
|
p << Color("rgb 'brown'") << PlotCommand("x**3");
|
2014-09-22 15:19:46 +01:00
|
|
|
p << PlotCommand("x**2");
|
|
|
|
p << PlotFunction(TabFunction(x, y), 0.,
|
|
|
|
static_cast<double>(nPoint)/2.0 - 1.1);
|
2014-02-10 11:22:56 +00:00
|
|
|
cout << p << endl;
|
|
|
|
p.display();
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|