#include"TH1D.h" #include "TF1.h" double X[100]; double Y[100]; int n=10; //i nodi sono n+1 double fteorican(double* xv, double* parv) { double x = xv[0]; double y=(x*x*x)*cos(x); return y; } Double_t fteorica(double x) { double y=(x*x*x)*cos(x); return y; } double Lagrange(double x, int i) { double y=1.; for(int j=0; jSetLineColor(kRed); ptfteorica->Draw(); //return; X[0]=a; X[n]=b; double passo=(X[n]-X[0])/n; cout<< "al passo i=0, X="<SetLineColor(kBlue); pfinterpol->SetLineStyle(2); pfinterpol->Draw("same"); //return; TF1 *resto= new TF1("rest","resto(x)",a,b); TCanvas *c2=new TCanvas("c2","c2", 800,600); resto->Draw(); }