30 Double_t ym_p2 = (x[1] - d_2) * (x[1] - d_2);
31 Double_t yp_p2 = (x[1] + d_2) * (x[1] + d_2);
34 + par[3] *
cos(tpi_l *
sqrt(x_p2 + yp_p2)));
35 return amplitude * amplitude;
45 for(
Int_t i=0; i<10; i++){
48 Double_t intens = interference(xint, par);
49 if(intens > maxintens) maxintens = intens;
61 c1->
Range(0, -10, 30, 10);
63 TPad *pad =
new TPad(
"pr",
"pr", 0.5, 0 , 1., 1);
64 pad->
Range(0, -10, 15, 10);
67 const Int_t colNum = 30;
68 Int_t palette[colNum];
69 for (
Int_t i=0;i<colNum;i++) {
71 ,
pow(i/((colNum)*1.0),0.3)
72 ,
pow(i/((colNum)*1.0),0.3)
73 ,0.5*(i/((colNum)*1.0)),
"");
78 TF2 * f0 =
new TF2(
"ray_source",interference, 0.02, 15, -8, 8, 4);
87 title.
DrawLatex(1.6, 8.5,
"A double slit experiment");
110 line =
new TLine(15,-10, 15, 0 - 0.5*d -0.2);
112 line =
new TLine(15, 0 - 0.5*d +0.2 ,15, 0 + 0.5*d -0.2);
115 line =
new TLine(15,0 + 0.5*d + 0.2,15, 10);
119 finter =
new TF2(
"interference",interference, 0.01, 14, -10, 10, 4);
125 finter->
Draw(
"samecolorz");
131 Float_t r = 0.5 * lambda, dr = lambda;
132 for (
Int_t i = 0; i < 16; i++) {
133 arc->
DrawArc(0, 0.5*d, r, 0., 360.,
"only");
134 arc->
DrawArc(0, -0.5*d, r, 0., 360.,
"only");
139 TF2 * fresult =
new TF2(
"result",
result, 14, 15, -10, 10, 4);
145 fresult->
Draw(
"samecolor");
146 line =
new TLine(13.8,-10, 14, 10);
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void DrawArc(Double_t x1, Double_t y1, Double_t radius, Double_t phimin=0, Double_t phimax=360, Option_t *option="")
Draw this arc with new coordinates.
virtual void SetParameters(const Double_t *params)
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
R__EXTERN TStyle * gStyle
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
To draw Mathematical Formula.
double pow(double, double)
TLatex * DrawLatex(Double_t x, Double_t y, const char *text)
Make a copy of this object with the new parameters And copy object attributes.
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
virtual void SetEditable(Bool_t mode=kTRUE)
Set pad editable yes/no If a pad is not editable:
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Set world coordinate system for the pad.
The most important graphics class in the ROOT system.
virtual void SetNpy(Int_t npy=100)
Set the number of points used to draw the function.
A 2-Dim function with parameters.
virtual void SetContour(Int_t nlevels=20, const Double_t *levels=0)
Set the number and values of contour levels.
The color creation and management class.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
A Graph is a graphics object made of two arrays X and Y with npoints each.
virtual void Update()
Update canvas pad buffers.
void SetPalette(Int_t ncolors=kBird, Int_t *colors=0, Float_t alpha=1.)
See TColor::SetPalette.
void Modified(Bool_t flag=1)