31 + par[3] *
cos(tpi_l *
sqrt(x_p2 + yp_p2)));
32 return amplitude * amplitude;
42 for(
Int_t i=0; i<10; i++){
45 Double_t intens = interference(xint, par);
46 if(intens > maxintens) maxintens = intens;
56 TCanvas *
c1 =
new TCanvas(
"waves",
"A double slit experiment", 300, 40, 1004, 759);
57 c1->Range(0, -10, 30, 10);
59 TPad *pad =
new TPad(
"pr",
"pr", 0.5, 0 , 1., 1);
60 pad->
Range(0, -10, 15, 10);
63 const Int_t colNum = 30;
64 Int_t palette[colNum];
65 for (
Int_t i=0;i<colNum;i++) {
74 TF2 *f0 =
new TF2(
"ray_source",interference, 0.02, 15, -8, 8, 4);
82 title.
DrawLatex(1.6, 8.5,
"A double slit experiment");
85 graph->SetFillColor(0);
86 graph->SetFillStyle(1001);
87 graph->SetLineWidth(0);
88 graph->SetPoint(0, 0., 0.1);
89 graph->SetPoint(1, 14.8, 8);
90 graph->SetPoint(2, 0, 8);
91 graph->SetPoint(3, 0, 0.1);
95 graph->SetFillColor(0);
96 graph->SetFillStyle(1001);
97 graph->SetLineWidth(0);
98 graph->SetPoint(0, 0, -0.1);
99 graph->SetPoint(1, 14.8, -8);
100 graph->SetPoint(2, 0, -8);
101 graph->SetPoint(3, 0, -0.1);
108 line =
new TLine(15, 0 - 0.5*
d +0.2 ,15, 0 + 0.5*
d -0.2);
118 TF2 *finter =
new TF2(
"interference",interference, 0.01, 14, -10, 10, 4);
123 finter->
Draw(
"samecol");
129 Float_t r = 0.5 * lambda, dr = lambda;
130 for (
Int_t i = 0; i < 16; i++) {
131 arc.
DrawArc(0, 0.5*
d,
r, 0., 360.,
"only");
132 arc.
DrawArc(0, -0.5*
d,
r, 0., 360.,
"only");
138 TF2 *fresult =
new TF2(
"result",
result, 14, 15, -10, 10, 4);
143 fresult->
Draw(
"samecol");
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
R__EXTERN TStyle * gStyle
virtual TArc * 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 SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
virtual void SetParameters(const Double_t *params)
A 2-Dim function with parameters.
virtual void SetContour(Int_t nlevels=20, const Double_t *levels=nullptr)
Set the number and values of contour levels.
virtual void SetNpy(Int_t npy=100)
Set the number of points used to draw the function.
void Draw(Option_t *option="") override
Draw this function with its current attributes.
A TGraph is an object made of two arrays X and Y with npoints each.
To draw Mathematical Formula.
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.
Use the TLine constructor to create a simple line.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
The most important graphics class in the ROOT system.
void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Set world coordinate system for the pad.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
void Draw(Option_t *option="") override
Draw Pad in Current pad (re-parent pad if necessary).
void SetPalette(Int_t ncolors=kBird, Int_t *colors=nullptr, Float_t alpha=1.)
See TColor::SetPalette.
RVec< PromoteType< T > > cos(const RVec< T > &v)
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.