4

And just a few minutes after asking I found an answer. The procedure above is called "updating LU". This question has a nice generic answer with links to other more specific questions. full rank update to cholesky decomposition So the short answer is no, in my case. You cannot update LU decomposition with a full rank matrix in less than $O(n^3)$, ...


4

You would need to linearize the problem. I prefer to do it before discretization but it's possible to do also after discretization. (I'm a bit skeptical of linearization after discretization because I have never looked into the details. In general, discretization and linearization steps do not commute.) In the following I assume that the equation is actually ...


3

There is another factorization you could consider: the Hessenberg upper-triangular reduction. It's usually used as a preprocessing step in the QZ algorithm, but it has other uses as well. Consider the reduction $(A,M) = Q^T(H,T)Z$. Then $\frac{M}{\mu_j} + A = Q^T(\frac{T}{\mu_j} + H)Z$, which is relatively cheap to solve as it only involves orthogonal ...


3

Expanding (sort of) on @MPIchael's answer, you can pick any smooth function you like and plug it into the heat equation to give a problem to then work the other way. In numerical methods, we call this the Method of Manufactured Solutions, and it is used extensively for verifying computer programs designed to simulate PDEs. You'll have to add a forcing ...


2

The solutions of the Schroedinger equation are complex-valued, so your inner product needs to be $$ (u,v) = \int_\Omega \bar u(x) v(x)\; dx, $$ and the norms then become $$ \|u\| = (u,u)^{1/2}. $$ But it is also worth pointing out that you shouldn't think of the Schroedinger equation as a variation of the heat equation that just happens to have an ...


2

TL DR: $$u_1(x_1) = \cos(2\pi~(\frac{x_1}{L_1}) - \pi) + 1$$ $$u_2(x_2) = \cos(2\pi~(\frac{x_2}{L_2}) - \pi) + 1$$ $$u(x,t) = \exp(-a t) u_1(x_1) u_2(x_1)$$ How to construct it: Sines and cosines are easily differentiable so they make a good starting point to construct such a solution. We chose a section and offset of the cosine which has a derivative of ...


2

Let's reconstruct this from first principles: Defining the ODE system In the method-of-lines discretization you solve an ODE system $\dot U=F(U)$, $U=(U_0,U_1,...,U_{M+1})$, $U_k(t)=u(x_k,t)$, and similarly $F=(F_0,F_1...,F_{M+1})$. Because of the boundary conditions $$ u(x, 0) = 40 · x^2 · (1 - x) / 3 \\ u(0, t) = u(1, t) = 0 $$ $U_0=U_{M+1}=0$ and ...


1

I'm not going to debug your code, but since $$(1-x)u_{xx}$$ can be discretized, using second order, centered, finite differences with: $$(1-x_i) \frac{u_{i+1}-2u_i+u_{i-1}}{h^2}$$ where $x_i$ is one of the grid points, $h$ your discretization parameter, this means that the $i$-th row of the second derivative matrix is multiplied by the factor $1-x_i$ The $i-$...


1

First off, I'd note that your initial condition doesn't satisfy the boundary conditions, so you might want to instead use $u_0(x) = e^{-x^2} - e^{-L^2}$. A great sanity check for problems like yours is the conservation property -- the total mass of $u$ should stay the same. $$\begin{align} \frac{d}{dt}\int_{-L}^Lu\, dx & = \int_{-L}^L\frac{\partial u}{\...


1

You forgot to multiply the norm of the difference between the numerical solution and the exact one by the discretization step. In your case it is enough to divide the err_n by Nt when computing the order of time discretization, and by NS when computing the order of space discretization. I got a perfect first order accuracy for the time discretization, in the ...


Only top voted, non community-wiki answers of a minimum length are eligible