Assignment 3 = Exam 1 Fall 2021

Problem 7

precoeff[L_,j_]=Integrate[(L x - x^2) Sin[ j Pi x/L], {x,0,L}]

coeffseven[L_,M_,j_]=-(2/L) precoeff[L,j]/Sinh[j Pi M/L]
useven[x_,y_,L_,M_,k_]:= Sum [coeffseven[L,M,j] Sin[j Pi x/L] Sinh[j Pi (y-M)/L],{j,1,k}]

usevent[x_,y_]= useven[x,y,2,1,3]

Plot[{usevent[x,0],2 x-x^2},{x,0,2}]

Plot3D[usevent[x,y],{x,0,2},{y,0,1},BoxRatios->{2,1,1},ViewPoint->{1.3, 1.4, 0.5}]

Problem 8

Piecewise constant g

mycoeff[k_]=8 (-1)^(k+1)/((2 k+1)^2 Sinh[(2 k+1) Pi/2] Pi^2)

myueight[x_,y_,ell_]:= Sum[mycoeff[k]  Cos[(2 k+1) Pi x/2]  Cosh[(2 k+1) Pi y/2],{k,0,ell}]

myueighty[x_,y_,ell_]:= D[Sum[mycoeff[k]  Cos[(2 k+1) Pi x/2]  Cosh[(2 k+1) Pi y/2],{k,0,ell}],y]

Plot[myueight[x,1,20],{x,0,2}]

evalmyueighty[x_,y_]=myueighty[x,y,10];

Plot[evalmyueighty[x,1],{x,0,2}]

Plot3D[myueight[x,y,20],{x,0,2},{y,0,1}]

Plot3D[myueight[x,y,20],{x,0,2},{y,0,1},BoxRatios->{2,1,1},ViewPoint->{1.3, 1.4, 1.5}]

Piecewise linear g (Julian’s choice)

julianintegral[j_]=Simplify[Integrate[(2x) Cos[ j Pi x/2], {x,0,1}]+Integrate[(2x-4) Cos[ j Pi x/2], {x,1,2}]]

juliancoeff[j_]=2 julianintegral[j]/( j Pi Sinh[j Pi /2])
ujulian[x_,y_,k_]:= Sum [juliancoeff[j] Cos[j Pi x/2] Cosh[j Pi y/2],{j,1,k}]

ujulian[x,y,2]

ujulianeval[x_,y_]=ujulian[x,y,100];
uyjulian[x_,y_]=D[ujulianeval[x,y],y];

Plot[uyjulian[x,1],{x,0,2}]

Plot[{uyjulian[x,1],2 x,2x-4},{x,0,2}]

Plot[ujulian[x,1,100],{x,0,2}]

ujulian[x,y,1]

Plot3D[ujulian[x,y,100],{x,0,2},{y,0,1},BoxRatios->{2,1,1},ViewPoint->{1.3, 1.4, 1.5}]

Sum Plots U_7 + U_8

Plot3D[usevent[x,y]+myueight[x,y,20],{x,0,2},{y,0,1},BoxRatios->{2,1,1},ViewPoint->{1.3, 1.4, 1.5}]

Plot3D[usevent[x,y]+ujulian[x,y,100],{x,0,2},{y,0,1},BoxRatios->{2,1,1},ViewPoint->{1.3, 1.4, 1.5}]