#include "TStyle.h" #include "TCanvas.h" #include "TF2.h" #include "TTimer.h" #include "TMath.h" #include "TAxis.h" #include "TROOT.h" #include "TSystem.h" #include "Math/SpecFunc.h" #include #include #include Double_t myf(Double_t *x, Double_t *par) { Double_t xx = x[0]; Double_t yy = x[1]; Double_t rr = sqrt(xx*xx+yy*yy); Double_t costh = xx/rr; Double_t sum = 0; Int_t lmax = (Int_t)par[0]; for (Int_t l=0; l <= lmax; l++) { if(l%2==0){ sum += TMath::Power(-1,l/2.)*(2*l+1)* ROOT::Math::sph_bessel(l,rr)* ROOT::Math::legendre(l,costh); } } return sum; } void plot() { gROOT->SetStyle("Plain"); gStyle->SetTitleAlign(23); gStyle->SetTitleX(0.54); gStyle->SetTitleY(0.97); gStyle->SetTitleBorderSize(0); gStyle->SetTitleFillColor(0); gStyle->SetTitleColor(1); gStyle->SetLabelFont(132,"xyz"); gStyle->SetTitleFont(132,"xyz"); gStyle->SetTitleFont(132,""); gStyle->SetTextFont(132); gStyle->SetStatFont(132); gStyle->SetNdivisions(505,"xyz"); gStyle->SetLabelSize(0.075,"xyz"); gStyle->SetTitleSize(0.075,"xyz"); gStyle->SetTitleSize(0.06,""); gStyle->SetPadTopMargin(0.2); gStyle->SetPadRightMargin(0.10); gStyle->SetPadLeftMargin(0.20); gStyle->SetPadBottomMargin(0.18); TCanvas *c1 = new TCanvas("c1","c1",400,400); TF2 *f = new TF2("f",myf,-19.999,20,-20,20,1); f->SetNpx(50); f->SetNpy(50); f->SetMaximum(2); f->SetMinimum(-1.999); for (Int_t i =0; i < 33;i++){ f->SetParameter(0,i); f->GetXaxis()->SetTitle("#it{x}"); f->GetYaxis()->SetTitle("#it{y}"); { std::ostringstream os; os << "Re#[]{ #Sigma_{#it{l}=0}^{" << i << "} #it{i}^{#it{l}} (2#it{l}+1) #it{j}_{#it{l}}(#it{r})#it{P}_{#it{l}}(cos#theta)}"; f->SetTitle(os.str().c_str()); } f->Draw("surf1"); { std::ostringstream os; os << "fig" <Print(os.str().c_str()); } } }