28 std::cout <<
"\n" << type <<
" interpolation:" << std::endl;
30 std::cout <<
"x[i] y[i] deriv[i] deriv2[i] integral[i] \n" << std::endl;
35 for (
double xi = 0; xi < 10; xi += 0.2) {
37 ycoord[i] = itp.
Eval(xi);
38 double dyi = itp.
Deriv(xi);
39 double dy2i = itp.
Deriv2(xi);
40 double igyi = itp.
Integ(0, xi);
41 std::cout << xcoord[i] <<
" " << ycoord[i] <<
" " << dyi <<
" " << dy2i <<
" " << igyi << std::endl;
78 std::vector<double>
x(n+1);
79 std::vector<double>
y(n+1);
80 for (
int i = 0; i < n+1; ++i) {
89 c1 =
new TCanvas(
"c1",
"Original (red), Linear (upper left), Polynomial (upper right), Spline , Spline periodic, Akima (lower left) and Akima Periodic (lower right) Interpolation",10,10,1000,800);
94 grorig =
new TGraph(n+1,xorig,yorig);
122 itp3.
SetData(x.size(), &x[0], &y[0]);
152 std::cout <<
"\n***********************************" << std::endl;
153 std::cout <<
"Using default Interpolation type: " << std::endl;
163 int main(
int argc,
char **argv)
171 for (
Int_t i=1 ; i<argc ; i++) {
172 std::string arg = argv[i] ;
181 cerr <<
"Usage: " << argv[0] <<
" [-g] [-v]\n";
183 cerr <<
" -g : graphics mode\n";
184 cerr <<
" -v : verbose mode";
double Eval(double x) const
Return the interpolated value at point x.
virtual void SetName(const char *name="")
bool SetData(const std::vector< double > &x, const std::vector< double > &y)
Set the data vector ( x[] and y[] ) To be efficient, the size of the data must be the same of the val...
This class displays a legend box (TPaveText) containing several legend entries.
double Deriv2(double x) const
Return the second derivative of the interpolated function at point x.
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
std::string Type() const
Return the type of interpolation method.
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
Class for performing function interpolation of points.
double Integ(double a, double b) const
Return the Integral of the interpolated function over the range [a,b].
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
virtual void Run(Bool_t retrn=kFALSE)
Main application eventloop. Calls system dependent eventloop via gSystem.
virtual void SetMarkerColor(Color_t mcolor=1)
void interpolate(const ROOT::Math::Interpolator &itp, bool drawSame=false)
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis from bin first to last.
virtual void SetMarkerStyle(Style_t mstyle=1)
int main(int argc, char **argv)
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
double Deriv(double x) const
Return the derivative of the interpolated function at point x.
TAxis * GetYaxis() const
Get y axis of the graph.
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
A Graph is a graphics object made of two arrays X and Y with npoints each.
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...