Posts

Showing posts from March 25, 2019

Including a bat with arguments (that launchs a cmd window and adds commands to the path) into another bat

Image
1 I have a bat file running a command : C:WindowsSystem32cmd.exe /E:ON /V:ON /K ""C:Program Files (x86)pathtothecompilersscript.bat" option1 option2" It basically opens a cmd windows for which different commands (intel compilers etc) are already in the path. Then, in this command window I cd to a specific location and I use these intel commands as follows : ifort -c -fpp file1.f90 ifort -c -fpp file2.f90 ifort -c -fpp file3.f90 ifort -dll -o libfinal.dll file1.obj file2.obj file3.obj lib /out:./libfinal.lib file1.obj file2.obj file3.obj xcopy /s .libfinal.dll "..libfinal.dll*" /Y xcopy /s .libfinal.lib "..libfinal.lib*" /Y which compile (with ifort intel fortran compiler, but the question doesn't depend on it) libraries and copies them somewhere. I wou...

$u_{i,j}=frac{u_{i-1,j}+u_{i+1,j}+u_{i,j-1}+u_{i,j+1}}{4}$

Image
1 $begingroup$ Let your living room be the unit square. We denote the coordinates in the square by x and y. The dots are at locations $(x_i,y_j)$ (see the image here: https://imgur.com/a/IPbyuzp). We denote the temperature in $(x_i ,y_j)$ by $u_{i,j}$ . The temperature is the average of the temperatures in the four neighboring points: $$u_{i,j}=frac{u_{i-1,j}+u_{i+1,j}+u_{i,j-1}+u_{i,j+1}}{4} (1).$$ Now assume that $u_{i,j}=u(x_i,y_j)$ with $u(x,y)=x^2-y^2$ . Show that $(1)$ holds. My attempt : The average of the temperatures in the four neighboring points is $$frac{x_{i-1}^2-y_j^2+x_{i+1}^2-y_j^2+x_i^2-y_{j-1}^2+x_i^2-y_{j+1}^2}{4}.$$ We note that $frac{x_{i-1}+x_{i+1}}{2}=x_i, frac{y_{j-1}+y_{j+1}}{2}=y_j$ . Then consider x coordinates first: $x_{i-1}^2+x_{i+1}^2+2x_i^2=(x_{i-1}+x_{i+1})^2-2x_{i-1}x_{...