********Mathematica Tutorial: SBU********

Today

Removing all definitions and Setting Directory

Removing all definitions, values attributes, messages and default options that have been created in the Global` context and that don' t have the Protected attribute (Protected attributes are those qualities, traits or characteristics that, by law, cannot be discriminated against)

(*Quit Kernal*)
Quit[]

(*Keep the defined variables but will wash the assigned value*)
ClearAll["Global`*"]

aa

aa=2

aa

(*To remove a perticular variable*)
Clear[aa]

SetDirectory[NotebookDirectory[]];

Differential Equations

Solve

a1=Solve[3(a^3)-2(b^2)-(c^3)-h==0,b][[2,1,2]]

N[a1/.{a->2,c->1,h->2}]

a11[a_,c_,h_]:=Solve[3(a^3)-2(b^2)-(c^3)-h==0,b]

N[a11[2,1,2]]

Cc

Magnetization

Solve[M==Tanh[((M*z)/T)+(Bext/T)],M]

z=3;
Bext=0;
T=1;
aa=ParametricPlot[{M,Tanh[((M*z)/T)+(Bext/T)]},{M,-2.2,2},AspectRatio->0.7]

bb=Plot[M,{M,-2.2,2},AspectRatio->0.7,PlotStyle->Dashed]

Show[aa,bb]

Differential Solve

DSolve[b''[x]+b'[x]+b[x]==0,b[x],x][[1,1,2]]

D[b[x],{x,9}]

Numerical Differential Solve

Simple Harmonic Oscillator

α=0;
ω0=1;
f=0;
ω=0.666;
ss1=NDSolve[{y''[t]+α*y'[t]+((ω0)^2)*y[t]==f*Cos[ω*t],y'[0]==1,y[0]==0},y,{t,0,40}][[1,1,2]]

Plot[ss1[t],{t,0,40}]

Plot[ss1'[t],{t,0,40}]

ParametricPlot[{ss1[t],ss1'[t]},{t,0,40}]

Damped Harmonic Oscillator

α=0.2;
ω0=1;
f=0.52;
ω=0.666;
ss=NDSolve[{y''[t]+α*y'[t]+((ω0)^2)*Sin[y[t]]==f*Cos[ω*t],y'[0]==1,y[0]==0},y,{t,0,100}][[1,1,2]]

->

λ Λ δ

λ

5/6

(5/6)  (l^4)

(Subscript[s, 3])

g=5*6+8-9

Plot[ss[t],{t,0,100},PlotRange->{{40,65},{-2,2}},Frame->True,GridLines->{{-1,0,1}, {-1,0,1}}]

Plot[ss'[t],{t,0,100},PlotRange->All]

ParametricPlot[{ss[t],ss'[t]},{t,0,100},PlotRange->All,Frame->True]

Boundary Value Problems

Exp[]

DSolve[{y''[x]+y[x]==(E^x),y[0]==1,y[1]==1/2},y,x]

Partial Differential Equation

((∂P(x,t))/(∂t))=d*(((∂^2)P(x,t))/(∂(x^2))), p(x,0)= Sin[x]

∂

(dt/dx)

DSolve[{D[P[x,t],t]==d*D[P[x,t],{x,2}],P[x,0]==Sin[x]},P[x,t],{x,t}]

NDSolve[{D[u[x,t],t]==D[u[x,t],x,x],u[x,0]==Sin[x],u[0,t]==0,u[π,t]==0},u,{x,0,π},{t,0,1}]

Coupled Differential Equations

ClearAll["Global`*"]
mp=2.435515*(10^18);RM=Sqrt[2.137*(10^(-9))];
kc=(6.394970897*(10^(-39)))/mp;k0=0.05*kc;
M=0.1;
ϕc=M;
m1=3*(10^5);
m2=11;
Λ=((2.21*(10^(-9)))/(3.429508708250553`))*((12(π^2))/(m1^2));
ψ0=(Sqrt[((Λ(Sqrt[2 ϕc m1])M)/(96(π^(3/2))))]);
b=-8*(10^9);
V[n_]=Λ((((1-(((ψ[n])^2)/(M^2))))^2)+(((ϕ[n]-ϕc))/m1)-((((ϕ[n]-ϕc))^2)/(m2^2))+((2((ϕ[n])^4)((ψ[n])^2))/((M^4)((ϕc)^2)))+((ψ[n])/b));
SV[n_]=V[n]/.{ψ[n]->sψi[n],ϕ[n]->sϕi[n]};
ϕi=ϕc(1+0.0011);
ψi=ψ0;
dψi=(-D[V[n],ψ[n]])/V[n]/.{ψ[n]->ψi,ϕ[n]->ϕi};
dϕi=(-D[V[n],ϕ[n]])/V[n]/.{ψ[n]->ψi,ϕ[n]->ϕi};
ni=Log[(k0/(Hi*1*(10^6)))];
nf=-54;

Hi=√(V[n]/(3(1-((dψi)^2)/6-((dϕi)^2)/6)))/.{ψ[n]->ψi,ϕ[n]->ϕi};

HPH[n_]=(1/(2 V[n]))(6-((ϕ'[n])^2)-((ψ'[n])^2)) (V'[n]/(6-((ϕ'[n])^2)-((ψ'[n])^2))-(V[n] (-2 ϕ'[n] ϕ''[n]-2 ψ'[n] ψ''[n]))/(((6-((ϕ'[n])^2)-((ψ'[n])^2)))^2));

sHPH[n_]:=HPH[n]/.{ϕ->sϕi,ψ->sψi};

H[n_]=√((2*V[n])/(6-((((ϕ'[n]))^2)+(((ψ'[n]))^2))));

sH1[n_]:=H[n]/.{ϕ->sϕi,ψ->sψi};

varsI={ϕ[n],ψ[n]};
initsI={ϕ[ni]==ϕi,ψ[ni]==ψi,ϕ'[ni]==dϕi,ψ'[ni]==dψi};
eqnsI={ϕ''[n]+(HPH[n]+3)*ϕ'[n]+D[V[n],ϕ[n]]/(((H[n]))^2)==0,ψ''[n]+(HPH[n]+3)*ψ'[n]+D[V[n],ψ[n]]/(((H[n]))^2)==0};

{sϕi[n_],sψi[n_]}=varsI/.NDSolve[Join[eqnsI,initsI],varsI,{n,ni,nf},MaxSteps->Infinity,MaxStepSize->0.001,Method->{"ExplicitRungeKutta"}][[1]]

a[h_,c_]=h+c

a[h,c]

Plot3D[Log[((V[n])/Λ)],{ψ[n],-0.2,0.2},{ϕ[n],0,1.5},Boxed->True,PlotPoints->100,Mesh->10,ColorFunction->"DarkBands",Axes->True,AxesLabel->{"ψ","ϕ","V"},AxesStyle->Directive[Black,12,FontFamily->"Algerian",Bold],ImageSize->490]

LogPlot[{sϕi[n],Abs[sψi[n]],sH1[n]},{n,ni,nf},Frame->True,FrameLabel->{"(Subscript[N, k])",""},FrameStyle->Directive[Black,15],PlotLegends->Placed[LineLegend[{"ϕ","ψ","H"},LabelStyle->12,LegendMarkerSize->{{15,10}},LegendFunction->(Framed[#,RoundingRadius->15]&),LegendMargins->2],{0.15,0.65}],ImageSize->490]

(Numerical) Integration

Definite

aa[x_]=Integrate[(1/((x^3)+1)),x]

N[aa[2]-aa[1]]

NIntegrate[(1/((x^3)+1)),{x,1,2}]

Code for nested integrals

ClearAll["Global`*"]
Gμ=1*(10^(-10));
a0=1;
h=0.6736;
H0=((100*(10^3)*h)/(3.08568*(10^22)));
ξr=(Sqrt[(1-Y)])*(Sqrt[k(k+ct)]);
ct=0.23;
k=((2(Sqrt[2]))/π)(((1-8*((νr)^6))/(1+8*((νr)^6))))(1-((νr)^2))(1+2(Sqrt[2])((νr)^3));
Y=0.8;
νr=0.662*(Sqrt[1-Y]);
Γ0=50;
Γ=Γ0*(((1-Fppm))^(BcΓ));
Fppm=(Sqrt[Y]);
(*For Chiral Current*)
BcΓ=((BsΓ)/(Sqrt[2]));
(*1.5 for kinks, (2 for cusps)*)
BsΓ=2.6;
α=0.3688566917981026;
Ωr=9.2188*(10^(-5));
Ωm=0.308;
ct=0.23;
(*𝒢1=Import["C:\\Users\\adeel\\OneDrive\\Desktop\\Current_Carrying_CSs\\Data_points\\Gvsa.DAT"];
𝒢=Interpolation[𝒢1,InterpolationOrder->1];*)
𝒢[a_]=1;
ℱ=0.1;
ϵr=((α*ξr)/(Γ*Gμ));
tpl=5.39*(10^(-44));
aminr=((a0*(Sqrt[2*H0(Sqrt[Ωr])(ϵr+1)tpl]))/(Gμ));
aeq=a0*((Ωr)/(Ωm));
l=((2 *a*j)/(f*a0));
Ar=ℱ*((ct*νr)/((Sqrt[2])*((ξr)^3)));
Cr=(Ar/(α*ξr))(((α*ξr+Γ*Gμ))^(3/2));
Hr=H0*(Sqrt[𝒢[a]*Ωr])((((a0/a)))^2);
tr=((a^2)/(2 (a0^2) H0 (Sqrt[𝒢[a]*Ωr])));
nr[f_]=(Cr/((tr^(3/2))(((l+Γ*Gμ*tr))^(5/2))));
q=(5/3)(*Kinks*);
Pj=((Γ*(j^(-q)))/(Zeta[(4/3)]));
ss=100;
ss1=101;
NRs[f_?NumericQ]:=Sum[NIntegrate[((((a/a0)))^4)j*Pj*((nr[f])/Hr),{a,aminr,aeq},MaxRecursion->20,WorkingPrecision->16],{j,1,ss}];
NRi[f_?NumericQ]:=NIntegrate[((((a/a0)))^4)j*Pj*((nr[f])/Hr),{a,aminr,aeq},{j,ss1,(10^5)},MaxRecursion->20,WorkingPrecision->16];
NR[f_]=NRs[f]+NRi[f];
ΩrGW[f_]=(h^2)*((16*π)/3)(((Gμ/H0))^2)(1/(a0*f))(NR[f]);

f=(10^f1);kk=0;
Do[
Clear[ΩGWTotSum];
ΩGWTotSum[f_]=ΩrGW[f];
kk=kk+1;
ddf[kk]={f,ΩGWTotSum[f]};
Print[ddf[kk]];
ddd=Table[ddf[jj],{jj,1,kk}];
,{f1,Log10[0.31622776601683794`],Log10[(10^3)],0.2}]

ddd

cc={{1.`*^-12,2.387992815460308`*^-20},{3.1622776601683794`*^-12,1.3428659051720894`*^-19},{1.`*^-11,7.551469668241913`*^-19},{3.1622776601683794`*^-11,4.246467435574246`*^-18},{1.`*^-10,2.3879000649252278`*^-17},{3.1622776601683795`*^-10,1.3427009812130997`*^-16},{1.`*^-9,7.548537556973553`*^-16},{3.1622776601683795`*^-9,4.24125724135352`*^-15},{1.`*^-8,2.3786568563816526`*^-14},{3.162277660168379`*^-8,1.3263863917068893`*^-13},{1.`*^-7,7.265105498643671`*^-13},{3.162277660168379`*^-7,3.771645611509287`*^-12},{1.`*^-6,1.693651380688711`*^-11},{3.162277660168379`*^-6,5.596343752145578`*^-11},{0.00001`,1.2143170387412448`*^-10},{0.000031622776601683795`,1.8545473320185802`*^-10},{0.0001`,2.2990103790072095`*^-10},{0.00031622776601683794`,2.5572136241355057`*^-10},{0.001`,2.6940085293627206`*^-10},{0.0031622776601683794`,2.7629192262618254`*^-10},{0.01`,2.796631122065546`*^-10},{0.03162277660168379`,2.812823078810208`*^-10},{0.1`,2.8204891564907916`*^-10},{0.31622776601683794`,2.824025096002165`*^-10},{0.5011872336272722`,2.824798743528717`*^-10},{0.7943282347242815`,2.82533884505459`*^-10},{1.2589254117941675`,2.8257078900715945`*^-10},{1.9952623149688797`,2.825954968534554`*^-10},{3.1622776601683795`,2.826117568128351`*^-10},{5.011872336272725`,2.826223150019687`*^-10},{7.943282347242818`,2.826291056068594`*^-10},{12.589254117941675`,2.826334429579627`*^-10},{19.952623149688797`,2.826362064886411`*^-10},{31.622776601683793`,2.826379570299117`*^-10},{50.11872336272725`,2.82639065229726`*^-10},{79.43282347242821`,2.8263976582007043`*^-10},{125.89254117941675`,2.8264020817557667`*^-10},{199.52623149688807`,2.826404871483842`*^-10},{316.22776601683796`,2.826406623222553`*^-10},{501.18723362727246`,2.826407707412721`*^-10},{794.3282347242822`,2.826408361580744`*^-10}};
cc1={{1.`*^-12,2.387992815460308`*^-20},{3.1622776601683794`*^-12,1.3428659051720894`*^-19},{1.`*^-11,7.551469668241913`*^-19},{3.1622776601683794`*^-11,4.246467435574246`*^-18},{1.`*^-10,2.3879000649252278`*^-17},{3.1622776601683795`*^-10,1.3427009812130997`*^-16},{1.`*^-9,7.548537556973553`*^-16},{3.1622776601683795`*^-9,4.24125724135352`*^-15},{1.`*^-8,2.3786568563816526`*^-14},{3.162277660168379`*^-8,1.3263863917068893`*^-13},{1.`*^-7,7.265105498643671`*^-13},{3.162277660168379`*^-7,3.771645611509287`*^-12},{1.`*^-6,1.693651380688711`*^-11},{3.162277660168379`*^-6,5.596343752145578`*^-11},{0.00001`,1.2143170387412448`*^-10},{0.000031622776601683795`,1.8545473320185802`*^-10},{0.0001`,2.2990103790072095`*^-10},{0.00031622776601683794`,2.5572136241355057`*^-10},{0.001`,2.6940085293627206`*^-10},{0.0031622776601683794`,2.7629192262618254`*^-10},{0.01`,2.796631122065546`*^-10},{0.03162277660168379`,2.812823078810208`*^-10},{0.1`,2.8204891564907916`*^-10},{0.31622776601683794`,2.824025096002165`*^-10},{0.5011872336272722`,2.824798743528717`*^-10},{0.7943282347242815`,2.82533884505459`*^-10},{1.2589254117941675`,2.8257078900715945`*^-10},{1.9952623149688797`,2.825954968534554`*^-10},{3.1622776601683795`,2.826117568128351`*^-10},{5.011872336272725`,2.826223150019687`*^-10},{7.943282347242818`,2.826291056068594`*^-10},{12.589254117941675`,2.826334429579627`*^-10},{19.952623149688797`,2.826362064886411`*^-10},{31.622776601683793`,2.826379570299117`*^-10},{50.11872336272725`,2.82639065229726`*^-10},{79.43282347242821`,2.8263976582007043`*^-10},{125.89254117941675`,2.8264020817557667`*^-10},{199.52623149688807`,2.826404871483842`*^-10},{316.22776601683796`,2.826406623222553`*^-10},{501.18723362727246`,2.826407707412721`*^-10},{794.3282347242822`,2.826408361580744`*^-10}};

Stop

Part-2

V1=ListLogLogPlot[{cc,cc1},Joined->True,Frame->True,FrameLabel->{{"(h^2)(Subscript[Ω, GW])(f)",None},{"f(Hz)",None}},PlotRange->{{(10^(-10)),2*(10^2)},{1*(10^(-13)),3*(10^(-9))}},FrameStyle->Directive[Red,22,Bold],ImageSize->500,PlotStyle->{{Black,Thickness[0.03],Opacity[0.2]},
{Purple,Thickness[0.003],Dashing[0.09]},{Orange,Thickness[0.003]},{Darker[Green],Thickness[0.003],Dashing[0.006]},{Darker[Red],Thickness[0.003]}},LabelStyle->Directive[Black,15],PlotLegends->Placed[LineLegend[{"Gμ = (10^(-10)), Y = 0","Gμ = (10^(-10)), Y = 0.9"},LabelStyle->{12,Background->White},LegendMarkerSize->{{10,10}},LegendFunction->(Framed[#,RoundingRadius->20]&),LegendMargins->10],{0.2,0.8}]]

Some unanswered Questions

Use Wolfram Cloud : If you are using Wolfram Cloud, you can share a notebook with multiple users . While users can edit their copies, real - time collaboration is still limited . Coordination between users is required .

Loop, Data Import, Export, Table Formation

Nested loop

function[x_,y_]=(x^3)+(y^4)+4(y^3)+(x^2)+(y^2)+y;

x=x1;
kk=0;
xmin=-4;
xmax=4;
ymin=-4;
ymax=4;
y=y1;
Do[
Clear[function];
Do[function[x_,y_]=(x^3)+(y^4)+4y+(x^2);
kk=kk+1;
ddf[kk]={x,y,function[x,y]};
Print[ddf[kk]];
ddd=Table[ddf[jj],{jj,1,kk}];,{y1,ymin,ymax,1}];,{x1,xmin,xmax,1}]

ddd

(*Table helps in: Multiplying a pre-factor, shuffle the axis, Log,*)

ddd[[All,3]]

Length[ddd]

gg=Table[{ddd[[jj,1]],ddd[[jj,2]],ddd[[jj,3]]},{jj,1,Length[ddd]}]

gg[[All,3]]

ListContourPlot[gg,Contours->{6,12,18}]

Clear[x,y,function]

(*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*)

Professor Movahed’s Question

function1[x_,y_]=(x^3)+(y^4)+4y+(x^2)+(x^4);

ss=Table[function1[x,y],{y,-4,4,1},{x,-4,4,1}];

ss//MatrixForm

ss

tt={{448,303,252,241,240,243,268,357,576},{277,132,81,70,69,72,97,186,405},{216,71,20,9,8,11,36,125,344},{205,60,9,-2,-3,0,25,114,333},{208,63,12,1,0,3,28,117,336},{213,68,17,6,5,8,33,122,341},{232,87,36,25,24,27,52,141,360},{301,156,105,94,93,96,121,210,429},{480,335,284,273,272,275,300,389,608}}

Dimensions[%88]

Table[function1[x,-4],{x,-4,4,1}]

Dimensions[ss]

ListContourPlot[ss,Contours->50,ColorFunction->"TemperatureMap"]

(*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*)

function[x_,y_]=(x^3)+(y^4)+4(y^3)+(x^2)+(y^2)+y;

ss1=Flatten[Table[{x,y,function[x,y]},{y,-2,2,0.1},{x,-4,4,0.1}],1]

Table[{ss1[[jj,2]],ss1[[jj,3]]},{jj,1,Length[ss1]}]

ListContourPlot[ss1,ColorFunction->"Rainbow",AspectRatio->0.8,Frame->True,FrameLabel->{"x","y","Data"},FrameStyle->Directive[Black,15],ImageSize->440,PlotLegends->Placed[BarLegend[Automatic,LegendLabel->"Intensity",LabelStyle->Directive[FontSize->15,Black],LegendMargins->{{-5,5},{10,5}},LegendMarkerSize->260],Right],Contours->{2}]

ddd

SetDirectory[NotebookDirectory[]];

Export["function_1.DAT",ddd];

a1=Import["function_1.DAT"]

Conversion to FORTran and LATEX

TeXForm[(xx^2)+(xx^4)-(xx^6)+1]

((xx^2)+(xx^4)-(xx^6)+1)//TeXForm

FortranForm[(xx^2)+(xx^4)-(xx^6)+1]

Extras

𝒜={{δ},{δx},{δy}};
𝒜traspose=Transpose[𝒜];
𝒦={{((σ0)^2),0,0},{0,((σ1x)^2),0},{0,0,((σ1y)^2)}};
det𝒦=Det[𝒦];
𝒦2inverse=Inverse[𝒦];

{𝒦//MatrixForm,MatrixForm[𝒦]}

Pdf=(1/((Sqrt[(((2π))^3)])(Sqrt[det𝒦])))Exp[((-1)/2)𝒜traspose.𝒦2inverse.𝒜][[1,1]]

normalrsd=Integrate[Pdf,{δ,-Infinity,Infinity},{δx,-Infinity,Infinity},{δy,-Infinity,Infinity},Assumptions->{((σ0)^2)>0,((σ1x)^2)>0,((σ1y)^2)>0}]

Crossing Statistics in (1+2)D

Ncr1=Abs[δx];
Ncr1Gauss=Integrate[Pdf*Ncr1*DiracDelta[δ-σ0*θ],{δ,-Infinity,Infinity},{δx,-Infinity,Infinity},{δy,-Infinity,Infinity},Assumptions->{σ0>0,σ1x>0,σ1y>0,θ>0}]

a=1;
Which[a==1,x,a==2,b]

cc=100;
Which[cc>200,0,True,Exp[-cc]]

Normal[Series[Exp[x1],{x1,0,6}]]

Expand[(((1+x))^3) (5 (x^2)+1) ((x^5)+1)]

ExpToTrig[(E^x1)]

TrigToExp[Cosh[x1]+Sinh[x1]]

Ctrl + 4

sd=1;
d=2;
sd**d*2

Plotting

Plotting With Padding

PP=LogLogPlot[{(xx^2),(xx^4),(xx^6)},{xx,-1,1},Frame->{{True,True},{True,False}},PlotRange->{{-1,1},{(10^(-12)),(10^0)}},PlotStyle->{{Darker[Blue],Thickness[0.0025],Dashed},{Darker[Green],Thickness[0.0025]},{Red,Thickness[0.0025],DotDashed},{Blue,Dashing[0.006]},{Red},{Red,Dashing[0.006]}},FrameLabel->{"ϕ((Subscript[m, Pl]))","V(ϕ)"},FrameStyle->Directive[Black,15],ImagePadding->65,ImageSize->490]

mpl=2.435515*(10^18) (*GeV*)

a22=ListLogLogPlot[{Centrald1p5pm5},Joined->True,FrameLabel->{{"",""},{"","ϕ(GeV)"}},FrameStyle->Directive[Black,15],PlotStyle->{{Black,Opacity[0]}},PlotRange->{{-2.435515*(10^18),2.435515*(10^18)},{(10^(-12)),(10^0)}},ImageSize->490,ImagePadding->65,Frame->{{False,False},{False,True}},Axes->False,FrameTicks->All]

Pixe=Import["C:\\Users\\adeel\\OneDrive\\Desktop\\Notes_CS_PBH\\CSs_Bounds_Program_code\\PBHbounds-master\\PBHbounds-master\\bounds\\PowerSpectrum\\PIXIE_1.DAT"];
Lyalpha=Import["C:\\Users\\adeel\\OneDrive\\Desktop\\Notes_CS_PBH\\CSs_Bounds_Program_code\\PBHbounds-master\\PBHbounds-master\\bounds\\PowerSpectrum\\Lyman-alpha_1.DAT"];
Lyalpha2=Import["C:\\Users\\adeel\\OneDrive\\Desktop\\Notes_CS_PBH\\CSs_Bounds_Program_code\\PBHbounds-master\\PBHbounds-master\\bounds\\PowerSpectrum\\Lyman-alpha2_1.DAT"];
PBHDM=Import["C:\\Users\\adeel\\OneDrive\\Desktop\\Notes_CS_PBH\\CSs_Bounds_Program_code\\PBHbounds-master\\PBHbounds-master\\bounds\\PowerSpectrum\\PBHDM_1.DAT"];
Planck=Import["C:\\Users\\adeel\\OneDrive\\Desktop\\Notes_CS_PBH\\CSs_Bounds_Program_code\\PBHbounds-master\\PBHbounds-master\\bounds\\PowerSpectrum\\planck_1.DAT"];
Planck2=Import["C:\\Users\\adeel\\OneDrive\\Desktop\\Notes_CS_PBH\\CSs_Bounds_Program_code\\PBHbounds-master\\PBHbounds-master\\bounds\\PowerSpectrum\\planck2_1.DAT"];
Lisa=Import["C:\\Users\\adeel\\OneDrive\\Desktop\\Notes_CS_PBH\\CSs_Bounds_Program_code\\PBHbounds-master\\PBHbounds-master\\bounds\\PowerSpectrum\\LISA_1.DAT"];
Lyalpha2mod=Table[{Lyalpha2[[jj,1]],Lyalpha2[[jj,2]]},{jj,1,Length[Lyalpha2]}];
Lyalphamod=Table[{Lyalpha[[jj,1]],Lyalpha[[jj,2]]},{jj,1,Length[Lyalpha]}];
COBEmu=Import["C:\\Users\\adeel\\OneDrive\\Desktop\\Notes_CS_PBH\\CSs_Bounds_Program_code\\PBHbounds-master\\PBHbounds-master\\bounds\\PowerSpectrum\\COBE_mu.csv"];
COBEy=Import["C:\\Users\\adeel\\OneDrive\\Desktop\\Notes_CS_PBH\\CSs_Bounds_Program_code\\PBHbounds-master\\PBHbounds-master\\bounds\\PowerSpectrum\\COBE_y.csv"];
BNSBBH=Import["C:\\Users\\adeel\\OneDrive\\Desktop\\PBH_An_Gh\\Neutrino_Physics\\Bounds\\2306-15555-fig6-SMBHB.csv"];
PSBounds=ListLogLogPlot[{Pixe,Lyalphamod,PBHDM,Planck,COBEmu,COBEy},Joined->True,Frame->{False,False,False,False},FrameLabel->{"k [Mpc]^(-1)","(Subscript[𝒫, R])(k)","(Subscript[N, k])",None},FrameStyle->Directive[Black,15],PlotStyle->{{Darker[Magenta],Thickness[0.003],Dashing[0.005]},{Brown,Thickness[0.003]},{Black,Thickness[0.003]},{Darker[Yellow],Thickness[0.003]},{Hue[0.65,0.37,0.9],Thickness[0.003]},{Hue[0.11,0.89,0.9],Thickness[0.003]}},Epilog->{Style[Text["Lyman-alpha",{Log[1*(10^2)],Log[3*(10^(-10))]}],Brown,12],
Style[Text["Planck",{Log[1.3],Log[6*(10^(-11))]}],Darker[Yellow],12],Style[Text["PIXIE",{Log[2*(10^3)],Log[1*(10^(-6))]}],Darker[Magenta],12],
Style[Text["COBE/Firas μ",{Log[4*(10^3)],Log[1*(10^(-3))]}],Hue[0.65,0.37,0.9],12],
Style[Text["COBE/Firas y",{Log[2*(10^1)],Log[1*(10^(-4))]}],Hue[0.11,0.89,0.9],12],Style[Text["PBH Overproduction",{Log[4*(10^16)],Log[1*(10^(-1))]}],Black,12]},ImagePadding->65,ImageSize->490,Axes->False,Filling->Top,PlotRange->{{(10^(-2)),6.9*(10^25)},{(10^(-12)),(10^0)}}]

PSBounds1=ListLogLogPlot[{(*Pixe,*)Lyalpha2mod,Planck2},Joined->True,Frame->{False,False,False,False},FrameLabel->{"k [Mpc]^(-1)","(Subscript[𝒫, s])","(Subscript[N, k])",None},FrameStyle->Directive[Black,15],PlotStyle->{{Brown,Thickness[0.003]},{Darker[Yellow],Thickness[0.003]},{Blue,Thickness[0.003]},{Blue,Thickness[0.003]}},(*Epilog->{Style[Text["M=0.055 (Subscript[m, p])",{Log[2*(10^15)],Log[1*(10^(-8))]}],Darker[Gray],15]},*)PlotRange->{{(10^(-2)),6.9*(10^25)},{(10^(-12)),(10^0)}},ImagePadding->65,ImageSize->490,Axes->False,Filling->Bottom]

ee=Overlay[{a22,PSBounds,PSBounds1,PP}]

Plotting Residuals

n1=1;
PNcmdn1=Plot[{NcmdGaussTot[Gμ,n1]/.{Gμ->1*(10^(-6))},NcmdGaussTot[Gμ,n1]/.{Gμ->8*(10^(-7))},NcmdGaussTot[Gμ,n1]/.{Gμ->5*(10^(-7))},NcmdGaussTot[Gμ,n1]/.{Gμ->2*(10^(-7))},NcmdGaussCMB[n1]},{θ,-4,4},PlotRange->All,FrameLabel->{"","(Subscript[(N^G), cmd◇])","cmd statistics: n = 1"},FrameStyle->Directive[Black,15],ImageSize->450,Axes->False,PlotLegends->Placed[LineLegend[{"CMBCS: Gμ = 1 × (10^(-6))","CMBCS: Gμ = 8 × (10^(-7))","CMBCS: Gμ = 5 × (10^(-7))","CMBCS: Gμ = 2 × (10^(-7))","CMB"},LabelStyle->{8,Background->White},LegendMarkerSize->{{10,10}},LegendFunction->(Framed[#,RoundingRadius->15]&),LegendMargins->2],{0.82,0.76}],PlotStyle->{{Hue[0.81,0.5,0.8],Thickness[0.002],Dashing[0.01]},{Darker[Blue],Thickness[0.002],Dashing[0.015]},{Darker[Green],Thickness[0.002],Dashing[0.02]},{Darker[Red],Thickness[0.002],Dashing[0.025]},{Darker[Black],Thickness[0.002]},{Darker[Yellow],Thickness[0.008],Dotted},{Darker[Black],Thickness[0.002],Dotted}},Frame->True,AspectRatio->0.7,ImagePadding->{{65,10},{0,40}}]

Residual

PNcmdResdn1=Plot[{NcmdGaussResd[Gμ,n1]/.{Gμ->1*(10^(-6))},NcmdGaussResd[Gμ,n1]/.{Gμ->8*(10^(-7))},NcmdGaussResd[Gμ,n1]/.{Gμ->5*(10^(-7))},NcmdGaussResd[Gμ,n1]/.{Gμ->2*(10^(-7))}},{θ,-4,4},PlotRange->{-0.0006,0.009},FrameLabel->{"θ","(Subscript[((ΔN)^G), cmd◇])",""},FrameStyle->Directive[Black,15],ImageSize->450,Axes->False,PlotStyle->{{Hue[0.81,0.5,0.8],Thickness[0.002],Dashing[0.01]},{Darker[Blue],Thickness[0.002],Dashing[0.015]},{Darker[Green],Thickness[0.002],Dashing[0.02]},{Darker[Red],Thickness[0.002],Dashing[0.025]}},Frame->True,AspectRatio->0.3,ImagePadding->{{65,10},{40,0}}]

Column[{PNcmdn1,PNcmdResdn1},Spacings->0]

Vector/ Stream Plots

f1=VectorPlot[{x1+y1, y1 - x1}, {x1, -3, 3}, {y1, -3, 3},PlotLayout -> "Row",VectorMarkers->"DotArrow"]

VectorPlot3D[{x,y,z},{x,-1,1},{y,-1,1},{z,-1,1},VectorMarkers->"Tube"]

f2=StreamPlot[{x1+y1, y1 - x1},{x1, -3, 3}, {y1, -3, 3},StreamScale->Small]

Show[f1,f2]

Plotting with LATEX  fonts

SetDirectory[NotebookDirectory[]];
<<MaTeX`
ConfigureMaTeX["pdfLaTeX"->"C:\\Program Files\\MiKTeX\\miktex\\bin\\x64\\pdflatex.exe","Ghostscript"->"C:\\Program Files\\gs\\gs10.01.2\\bin\\gswin64c.exe"

]
SetOptions[MaTeX,"Preamble"->{"\\usepackage{color}"}]
SetOptions[MaTeX,"Preamble"->{"\\usepackage{xcolor}"}]

ContourPlot[θ*n+(n^2)*θ,{θ,-4,4},{n,0,6},ColorFunction->(Opacity[0.5,ColorData["Pastel"][#1]]&),Contours->10,ColorFunctionScaling->True,PlotLegends->Placed[BarLegend[5,LegendLabel->MaTeX["\\text{Amplitude}",FontSize->30],LabelStyle->Directive[FontSize->28,Black],LegendMarkerSize->205,LegendMargins->-1],Right],Frame->True,FrameStyle->Directive[Black,30],ImageSize->550,AspectRatio->0.5,FrameTicks->{True,True,False,False},FrameLabel->{{MaTeX["n",FontSize->30],None},{MaTeX["\vartheta",FontSize->30],MaTeX["\\text{MaTeX}",FontSize->30]}}]

Plotting with Animation

Projectile Motion

x[t_]=t v0 Cos[θ0];
y[t_]=(1/2) (-g (t^2)+2 t v0 Sin[θ0]);

{x[t],y[t]}/. {v0->10,g->9.8};
Manipulate[ParametricPlot[%,{t,0,3},AspectRatio->0.75,Frame->True,FrameLabel->{"x(t)","y(t)"},PlotRange->{{0,10},{0,5.25}},FrameStyle->Directive[Black,18,FontFamily->"Andalus"],PlotStyle->{Red},ImageSize->500,Epilog->{Text[Style["θ0 = "<>ToString[NumberForm[θ0,{3,2}]],16,Black],Scaled[{0.8,0.9}]]}],{θ0,-π,π}]

Kousha Ebrahimi’s Integral

Integrate[(Sqrt[1+(x/((c^2)-(x^2)))]),x]

dd=(2 (Sqrt[(((c^2)+x-(x^2))/((c^2)-(x^2)))]) ((1/8) c (1-2 c+(Sqrt[1+4 (c^2)])) (1+(Sqrt[1+4 (c^2)])-2 x) (c+x) (-1+(Sqrt[1+4 (c^2)])+2 x)-(c^2) (1+2 c+(Sqrt[1+4 (c^2)])) (((c-x))^2) (Sqrt[-((c (1+(Sqrt[1+4 (c^2)])-2 x))/((1+2 c+(Sqrt[1+4 (c^2)])) (-c+x)))]) (Sqrt[(((1-2 c+(Sqrt[1+4 (c^2)])) (c+x))/((1+2 c+(Sqrt[1+4 (c^2)])) (-c+x)))]) (Sqrt[((c (-1+(Sqrt[1+4 (c^2)])+2 x))/((-1-2 c+(Sqrt[1+4 (c^2)])) (c-x)))]) EllipticF[ArcSin[(Sqrt[(((1-2 c+(Sqrt[1+4 (c^2)])) (c+x))/((1+2 c+(Sqrt[1+4 (c^2)])) (-c+x)))])],((2 c+(Sqrt[1+4 (c^2)]))/(2 c-(Sqrt[1+4 (c^2)])))]-c (1+2 c+(Sqrt[1+4 (c^2)])) (((c-x))^2) (Sqrt[-((c (1+(Sqrt[1+4 (c^2)])-2 x))/((1+2 c+(Sqrt[1+4 (c^2)])) (-c+x)))]) (Sqrt[(((1-2 c+(Sqrt[1+4 (c^2)])) (c+x))/((1+2 c+(Sqrt[1+4 (c^2)])) (-c+x)))]) (Sqrt[((c (-1+(Sqrt[1+4 (c^2)])+2 x))/((-1-2 c+(Sqrt[1+4 (c^2)])) (c-x)))]) (EllipticF[ArcSin[(Sqrt[(((1-2 c+(Sqrt[1+4 (c^2)])) (c+x))/((1+2 c+(Sqrt[1+4 (c^2)])) (-c+x)))])],((2 c+(Sqrt[1+4 (c^2)]))/(2 c-(Sqrt[1+4 (c^2)])))]-2 EllipticPi[((1+2 c+(Sqrt[1+4 (c^2)]))/(1-2 c+(Sqrt[1+4 (c^2)]))),ArcSin[(Sqrt[(((1-2 c+(Sqrt[1+4 (c^2)])) (c+x))/((1+2 c+(Sqrt[1+4 (c^2)])) (-c+x)))])],((2 c+(Sqrt[1+4 (c^2)]))/(2 c-(Sqrt[1+4 (c^2)])))])-(1/2) c (1+2 c+(Sqrt[1+4 (c^2)])) (((c-x))^2) (Sqrt[-((c (1+(Sqrt[1+4 (c^2)])-2 x))/((1+2 c+(Sqrt[1+4 (c^2)])) (-c+x)))]) (Sqrt[(((1-2 c+(Sqrt[1+4 (c^2)])) (c+x))/((1+2 c+(Sqrt[1+4 (c^2)])) (-c+x)))]) (Sqrt[((c (-1+(Sqrt[1+4 (c^2)])+2 x))/((-1-2 c+(Sqrt[1+4 (c^2)])) (c-x)))]) ((-2 c+(Sqrt[1+4 (c^2)])) EllipticE[ArcSin[(Sqrt[(((1-2 c+(Sqrt[1+4 (c^2)])) (c+x))/((1+2 c+(Sqrt[1+4 (c^2)])) (-c+x)))])],((2 c+(Sqrt[1+4 (c^2)]))/(2 c-(Sqrt[1+4 (c^2)])))]-(1+(Sqrt[1+4 (c^2)])) EllipticF[ArcSin[(Sqrt[(((1-2 c+(Sqrt[1+4 (c^2)])) (c+x))/((1+2 c+(Sqrt[1+4 (c^2)])) (-c+x)))])],((2 c+(Sqrt[1+4 (c^2)]))/(2 c-(Sqrt[1+4 (c^2)])))]+2 EllipticPi[((1+2 c+(Sqrt[1+4 (c^2)]))/(1-2 c+(Sqrt[1+4 (c^2)]))),ArcSin[(Sqrt[(((1-2 c+(Sqrt[1+4 (c^2)])) (c+x))/((1+2 c+(Sqrt[1+4 (c^2)])) (-c+x)))])],((2 c+(Sqrt[1+4 (c^2)]))/(2 c-(Sqrt[1+4 (c^2)])))])))/(c (1-2 c+(Sqrt[1+4 (c^2)])) ((c^2)+x-(x^2)));

Solve[(dd/.x->(1/2)-dd/.x->-(1/2))==(π/4),c]

ff[c_?NumericQ]:=NIntegrate[(Sqrt[1+(x/((c^2)-(x^2)))]),{x,((-1)/2),(1/2)}]

ReImPlot[{(π/4),ff[c]},{c,-2,2}]

Style["End of the Begenning ⟶ آغاز پایان",FontFamily->"Cambria Math",FontSize->37,FontWeight->"Bold"]

Speak["End of the Begenning"]