“…In [4]:= SolveDiffusion1D@Nx_, dt_, nnz_, xasize_, U_D := ModuleA8k, x, dx, kt, rhsmat, colmat, rowmat, valmat, amat, asubmat, xamat<, H*initialize variables and arrays*L kt = 0; dx = 1 ê HNx -1L; rhsmat = Table@0., 8Nx<D; colmat = Table@0, 8nnz<D; rowmat = Table@0, 8nnz<D; valmat = Table@1., 8nnz<D; amat = Table@1., 8nnz<D; asubmat = Table@0, 8nnz<D; xamat = Table@0, 8xasize<D; H*define the matrices*L For@x = 1, x < 2, x = 1 + x, rhsmatPxT = 0.; H++kt; colmatPktT = x; rowmatPktT = x; valmatPktT = 1LD; ForAx = 2, x < Nx, x = 1 + x, rhsmatPxT = UPxT ê dt + HUP-1 + xT -2 UPxT + UP1 + xTL ë dx 2 ; H++kt; colmatPktT = x; rowmatPktT = x; valmatPktT = 1 ê dtLE; For@x = Nx, x < 1 + Nx, x = 1 + x, rhsmatPxT = 0.; H++kt; colmatPktT = x; rowmatPktT = x; valmatPktT = 1LD; H*transform the matrices into SuperLU format*L kt = 0; Do@Do@If@colmatPk1T ã k, ++kt; amatPktT = valmatPk1T; asubmatPktT = -1 + rowmatPk1TD, 8k1, 1, nnz<D, 8k, 1, Nx<D; kt = 0; Do@Do@If@colmatPk1T ã k, ++ktD, 8k1, 1, nnz<D; xamatP1 + kT = kt, 8k, 1, Nx<D; H*call SuperLU-based function to solve the matrix system A.x=B*L linsolvepp@Nx, Nx, nnz, 1, amat, asubmat, xamat, rhsmatD E…”