SetDirectory[$HomeDirectory<>"/Documents/handouts/math467/UnboundedHeat"]

Infinite Rod

u[x_,t_]:=(E^(k((α^2)-(β^2))t+α x))Cos[β(2k α t+x)]

u[x_,t_]:=Exp[-(x^2)/(4 k t)]/Sqrt[4π k t]

D[u[x,t],t]-k D[u[x,t],x,x]//Simplify

v[x_,t_]:=(E^(k((α^2)-(β^2))t+α x))Sin[β(2k α t+x)]

D[v[x,t],t]-k D[v[x,t],x,x]//Simplify

u[x_,t_]:=(1/(Sqrt[4π k t]))(E^(-(x^2)/(4 k t)))

D[u[x,t],t]

D[u[x,t],t]//Simplify

D[u[x,t],x,x]

D[u[x,t],x,x]//Simplify

Limit[u[x,t],t->0,Assumptions->{k>0,x∈Reals},Direction->-1]

D[(E^(-(x^2)/(4 k t))),t]/D[(Sqrt[4π k t]),t]//Simplify

D[(E^(-(x^2)/(4 k t))),{t,2}]/D[(Sqrt[4π k t]),{t,2}]//Simplify

Integrate[(1/(Sqrt[4π k t]))(E^(-x/(4 k t))),{x,1,∞},Assumptions->{k>0,t>0}]

Integrate[r (E^(-(r^2)/(4 k t))),{r,0,∞},Assumptions->{k>0,t>0}]

Plot3D[u[x,t]/.k->1,{x,-3,3},{t,1/20,1},AxesLabel->{"x","t","u"},MeshFunctions->(#2&),PlotRange->All]

Export["fundsoln.pdf",%,"PDF"]

Export["fundsoln.eps",%%,"EPS"]

u[x_,t_]:=(1/(Sqrt[4π k t]))(∫_(-∞)^∞)((E^(-(((x-y))^2)/(4 k t)))f[y])\[DifferentialD]y

D[u[x,t],t]

D[u[x,t],x,x]

Integrate[(E^(-(z^2)/(4k t))),{z,δ,∞},Assumptions->{δ>0,k>0,t>0}]

Integrate[(E^(-(((x-y))^2)/(4 t)))(E^(-(y^2)))Sin[y],{y,-∞,∞},Assumptions->{t>0,x∈Reals}]

-(((x-y))^2)/(4 t)-(y^2)+I y

-(x^2)/(4t)+((-(1+4t)(y^2)+2(x+2I t)y)/(4t))

-((x^2)/(4t))-(((1+4t)(y^2)-2(x+2I t)y)/(4t))

-((x^2)/(4t))-((1+4t)/(4t))((y^2)-((2(x+2I t)y)/(1+4t)))

-((x^2)/(4t))-((1+4t)/(4t))((y^2)-((2(x+2I t)y)/(1+4t))+((((x+2I t))^2)/(((1+4t))^2))-((((x+2I t))^2)/(((1+4t))^2)))

-((x^2)/(4t))-((1+4t)/(4t))((y^2)-((2(x+2I t)y)/(1+4t))+((((x+2I t))^2)/(((1+4t))^2)))+((((x+2I t))^2)/(4t(1+4t)))

-((x^2)/(4t))-((1+4t)/(4t))(((y-(((x+2I t))/((1+4t)))))^2)+((((x+2I t))^2)/(4t(1+4t)))

%-%%//Simplify

-((x^2)/(4t))+((((x+2I t))^2)/(4t(1+4t)))//Simplify

%-(((I x)/(1+4t))-(((x^2)+t)/(1+4t)))//Simplify

Integrate[(E^(-((1+4t)/(4t))(((y-(((x+2I t))/((1+4t)))))^2))),{y,-∞,∞},Assumptions->{t>0,x∈Reals}]

((((2t-x)-2I t))^2)/(4 t)//Expand

Example (-∞ < x < ∞)

u[x_,t_]:=(E^(-((x^2)+t)/(1+4t)))Cos[(x/(1+4t))]/(Sqrt[1+4t])

Limit[u[x,t],t->0]

D[u[x,t],t]-D[u[x,t],x,x]//Simplify

ContourPlot[u[x,t],{x,-2π,2π},{t,0,1/2},FrameLabel->{"x","t"},PlotRange->All,PlotPoints->50]

DensityPlot[u[x,t],{x,-2π,2π},{t,0,1},FrameLabel->{"x","t"},PlotRange->All,PlotPoints->50,PlotTheme->"Detailed"]

Export["example01.pdf",%,"PDF"]

Export["example01.eps",%%,"EPS"]

ContourPlot[u[x,t],{x,-2π,2π},{t,0,1/2},FrameLabel->{"x","t"},PlotRange->All,PlotPoints->50,PlotTheme->{"Detailed","Monochrome"}]

Export["Example01Infinite.eps",%]

Export["Example01Infinite.pdf",%%]

ContourPlot[u[x,t],{x,-2π,2π},{t,0,1},Contours->10,FrameLabel->{"x","t"},PlotRange->All,PlotPoints->50,ColorFunction->(Lighter[GrayLevel[#]]&)]

D[u[x,t],t]-D[u[x,t],x,x]//Simplify

Example (Dirichlet on 0 < x < ∞)

-(((x-y))^2)/(4t)-y

Together[-(((x-y))^2)/(4t)-y]

((-(x^2)-4 t y+2 x y-(y^2))/(4 t))==-((x^2)-2(x-2t)y+(y^2))/(4t)//Simplify

Together[-(((x+y))^2)/(4t)-y]

((-(x^2)-4 t y-2 x y-(y^2))/(4 t))==-((x^2)+2(x+2t)y+(y^2))/(4t)//Simplify

-(x^2)/(4t)+(((x-2t))^2)/(4t)-(((y-(x-2t)))^2)/(4t)==-(((x-y))^2)/(4t)-y//Simplify

-(x^2)/(4t)+(((x+2t))^2)/(4t)-(((y+(x+2t)))^2)/(4t)==-(((x+y))^2)/(4t)-y//Simplify

-(x^2)/(4t)+(((x-2t))^2)/(4t)//Simplify

-(x^2)/(4t)+(((x+2t))^2)/(4t)//Simplify

Integrate[(y-x+2t)Exp[-(((y-x+2t))^2)/(4t)]/(Sqrt[4t]),{y,0,Infinity},Assumptions->{t>0,x≥0}](Exp[-x+t]/Sqrt[π])//Simplify

Integrate[(y+x+2t)Exp[-(((y+x+2t))^2)/(4t)]/(Sqrt[4t]),{y,0,Infinity},Assumptions->{t>0,x≥0}](Exp[x+t]/Sqrt[π])//Simplify

(x-2t)Exp[-x+t]Integrate[Exp[-(((y-x+2t))^2)/(4t)],{y,0,Infinity},Assumptions->{t>0,x>0}]/Sqrt[4π t]//Simplify

Simplify[%34-(Exp[-x+t](x-2t)(1+Erf[(x-2t)/(2Sqrt[t])])/2),Assumptions->{t>0,x>0}]

Plot[{Erf[z],Erf[-z]},{z,-1,1}]

(x-2t)Exp[-x+t]Integrate[Exp[-(((y-x+2t))^2)/(4t)],{y,0,Infinity},Assumptions->{t>0,x>0}]/Sqrt[4π t]//Simplify

(x-2t)Exp[-x+t]Integrate[Exp[-(z^2)],{z,-Infinity,(x-2t)/(2Sqrt[t])},Assumptions->{t>0,x>0}]/Sqrt[π]//Simplify

(x+2t)Exp[x+t]Integrate[Exp[-(((y+x+2t))^2)/(4t)],{y,0,Infinity},Assumptions->{t>0,x>0}]/Sqrt[4π t]//Simplify

(x+2t)Exp[x+t]Integrate[Exp[-(z^2)],{z,(x+2t)/(2Sqrt[t]),Infinity},Assumptions->{t>0,x>0}]/Sqrt[π]//Simplify

Simplify[%12-%13,Assumptions->{x>0,t>0}]

Integrate[Exp[-(z^2)],{z,-Infinity,Infinity}]

Integrate[Exp[-(z^2)/2]/Sqrt[2π],{z,-(x-2t)/Sqrt[2t],Infinity}]

Φ[z_]:=CDF[NormalDistribution[],z]

Φ[0]

U[x_,t_]:=(1-Φ[-(x-2t)/Sqrt[2t]])(x-2t)Exp[-x+t]+(1-Φ[(x+2t)/Sqrt[2t]])(x+2t)Exp[x+t]

Limit[U[x,t],t->0]

D[U[x,t],t]-D[U[x,t],x,x]//Simplify

DensityPlot[U[x,t],{x,0,10},{t,0,10},FrameLabel->{"x","t"},PlotRange->All,PlotTheme->"Detailed"]

Export["example02.pdf",%,"PDF"]

Export["example02.eps",%%,"EPS"]

u[x_,t_]:=(x-2t)Exp[-x+t](1+Erf[(x-2t)/(2Sqrt[t])])/2+(x+2t)Exp[x+t](1-Erf[(x+2t)/(2Sqrt[t])])/2

D[u[x,t],t]-D[u[x,t],x,x]

Simplify[%,Assumptions->{t>0,x>0}]

u[x_,t_]:=(x-2t)Exp[-x+t]Sqrt[t](1+Erf[(x-2t)/(2Sqrt[t])])/Sqrt[2]

U[x,t]/.k->1

u[x_,t_]:=(1/Sqrt[1+4t])Exp[-((x^2)+t)/(1+4t)]Sin[x/(1+4t)]

Limit[u[x,t],x->0]

Limit[u[x,t],t->0,Direction->"FromAbove",Assumptions->{x>0}]

D[u[x,t],t]-D[u[x,t],x,x]//Simplify

ContourPlot[u[x,t],{x,-0,2π},{t,0,1/2},FrameLabel->{"x","t"},PlotRange->All,PlotPoints->50,PlotTheme->{"Detailed","Monochrome"}]

Integrate[Exp[-(((y-(2I t+x)/(1+4t)))^2)(1+4t)/(4t)],{y,0,Infinity},Assumptions->{x>0,t>0}]

Integrate[(U[x-y,t]-U[x+y,t])Exp[-y]Sin[y]/.k->1,{y,0,Infinity}]

Integrate[(U[x-y,t]-U[x+y,t])Exp[-(y^2)+I y]/.k->1,{y,0,Infinity}]

Im[Integrate[Exp[I x/(1+4t)]Exp[-((1+4t)/(4t))(((y-(x+2I t)/(1+4t)))^2)],{y,0,Infinity},Assumptions->{x>0,t>0}]]

Im[Integrate[Exp[-I x/(1+4t)]Exp[-((1+4t)/(4t))(((y+(x-2I t)/(1+4t)))^2)],{y,0,Infinity},Assumptions->{x>0,t>0}]]

Integrate[Exp[I x/(1+4t)]Exp[-((1+4t)/(4t))(((y-(x+2I t)/(1+4t)))^2)]-Exp[-I x/(1+4t)]Exp[-((1+4t)/(4t))(((y+(x-2I t)/(1+4t)))^2)],{y,0,Infinity},Assumptions->{x>0,t>0}]

Simplify[%]

Im[%]

Example (Neumann on 0 < x < ∞)

1-Φ[-(x+I 2t)/Sqrt[2t(1+4t)]]

Re[%]//Simplify

u[x_,t_]:=(E^(-((x^2)+t)/(1+4t)))Cos[(x/(1+4t))]/(Sqrt[1+4t])

DensityPlot[u[x,t],{x,0,5},{t,0,5},FrameLabel->{"x","t"},PlotRange->All,PlotTheme->"Detailed"]

Export["example03.pdf",%,"PDF"]

Export["example03.eps",%%,"EPS"]

Limit[u[x,t],t->0]

D[u[x,t],x]

%/.x->0

ContourPlot[u[x,t],{x,0,2π},{t,0,1},FrameLabel->{"x","t"},ContourLabels->All,PlotRange->All,PlotPoints->50,PlotTheme->{"Detailed","Monochrome"}]

Export["semiinfiniteNeumann.eps",%]

Export["semiinfiniteNeumann.pdf",%%]