Problem 1: The 1D linear heat equation

heatTransfer[T_,l_,h_,d_]:=(
τ=h^2 /(3d);
n=Ceiling[l/h];
m=Ceiling[T/τ];
t=Table[(j-1)τ,{j,1,m+1}];
x=Table[{i-1}h,{i,1,n+1}];
y=Table[0,{i,1,n+1},{j,1,m+1}];
(*initial condition*)
For[i=1,i≤ n+1,i++,
y[[i,1]]=0;
];
For[j=1,j≤ m,j++,
For[i=2,i≤ n,i++,
y[[i,j+1]]=τ+(1-2d τ/h^2) y[[i,j]]+d τ/h^2 (y[[i-1,j]]+y[[i+1,j]]);
];
y[[1,j+1]]=0;
y[[n+1,j+1]]=(1-2d τ/h^2)y[[n+1,j]]+2d τ/h^2 y[[n,j]]+τ;
];
{x,t,y}
)

{x,time,solution}=heatTransfer[1,1,0.1,1];

Manipulate[Quiet[
ListPlot[Table[{x[[i,1]],solution[[i,j]]},{i,1,Length[x]}],PlotRange-> {0,1}]],{j,1,Dimensions[solution][[2]],1}]

Problem 2: The 2D linear heat equation

heatTransfer[T_,l_,h1_,h2_,d_]:=(
τ=1 /(2((2 d)/h1^2+(2d)/(h2^2)));
n=Ceiling[l/h1];
m=Ceiling[l/h2];
time=Ceiling[T/τ];
t=Table[(j-1)τ,{j,1,time+1}];
x1=Table[(i-1)h1,{i,1,n+1}];
x2=Table[(i-1)h2,{i,1,m+1}];
y=Table[0,{i,1,n+1},{j,1,m+1},{k,1,time+1}];
(*initial condition*)
For[i=1,i≤ n+1,i++,
For[k=1,k≤ m+1,k++,
y[[i,k,1]]=0;
];
];

For[j=1,j≤ time,j++,
For[k=2,k≤ m,k++,
For[i=2,i≤ n,i++,

y[[i,k,j+1]]=τ+d τ/h1^2(y[[i+1,k,j]]+y[[i-1,k,j]])+d τ/h2^2(y[[i,k+1,j]]+y[[i,k-1,j]])+(1-2 d τ/h1^2-2d τ/h2^2) y[[i,k,j]];
];
];

For[i=2,i≤n,i++,
y[[i,1,time+1]]=0;
y[[i,m+1,time+1]]=0;
];

For[k=2,k≤m,k++,
y[[1,k,time+1]]=0;
y[[n+1,k,time+1]]=0;

];
];
{x1,x2,t,y}
)

T=1;
l=1;
h1=0.1;
h2=0.1;
d=1;
solution=heatTransfer[T,l,h1,h2,d];
x1=solution[[1]];
x2=solution[[2]];
t=solution[[3]];
result=solution[[4]];

(*First approach for visualization*)
Manipulate[
Quiet[ListDensityPlot[result[[All,All,j]],PlotLegends-> True]],{j,1,Dimensions[result][[3]],1}]

(*Second approach for visualization*)
interpolate=Interpolation[Flatten[Table[{x1[[i]],x2[[j]],result[[All,All,2]][[i,j]]},{i,1,Length[x1]},{j,1,Length[x2]}],1]];
Manipulate[
heat=Interpolation[Flatten[Table[{x1[[i]],x2[[k]],result[[All,All,j]][[i,k]]},{i,1,Length[x1]},{k,1,Length[x2]}],1]];
Quiet[DensityPlot[heat[xx,yy],{xx,0,1},{yy,0,1},PlotLegends-> True]],{j,1,Dimensions[result][[3]],1}]

Problem 3: The logistic function - parameters estimation

y={0.04,0.35,1.05,1.9,1.98,1.97,1.99,1.999};
f[t_]:=((Subscript[x, 0])/((1-((Subscript[x, 0])/K))E^(-r t)+((Subscript[x, 0])/K)));

Clear[(Subscript[x, 0]),r,K];
error=f[Range[0,7,1]]-y;min=NMinimize[Sum[error[[i]]^2,{i,1,Length[error]}],{(Subscript[x, 0]),r,K}];
{x0,r,K}={(Subscript[x, 0])/. min[[2]],r/. min[[2]],K/. min[[2]]}

Show[ListPlot[Table[{i-1,y[[i]]},{i,1,Length[y]}]],Plot[f[t]/. {r-> r,(Subscript[x, 0])->x0,K-> K},{t,0,8}],PlotRange-> All]