New answers tagged

2

There is a difference between the requirements for a hyperbolic pde like $$ u_t + a u_x = 0 $$ and for a purely parabolic pde like $$ u_t = u_{xx} $$ Suppose the solutions are smooth and you approximate them by some finite difference method. Then in case of hyperbolic problem, the maximum error in the numerical solution depends on the time interval of ...


5

I'm afraid the method only works to compute derivatives of real-valued functions (of which you happen to have an implementation that also works on complex values).


2

Indeed the problem was that you were trying to calculate your nonlinear term incorrectly and you forgot that: $$\mathcal{F}[(f(x))^{2}] \neq (\mathcal{F}[f(x)])^{2}$$ I changed your code to this: import numpy as np import matplotlib.pyplot as plt from matplotlib.pyplot import cm nu = 1 L = 100 nx = 1024 t0 = 0 tN = 200 dt = 0.05 nt = int((tN - t0) / 0....


2

Are you sure that you have the correct boundary conditions? I think the equation you state for the analytical case, $$H=x/\tanh(x)-1$$ is incompatible with the boundary condition $H(\bar{\epsilon})=\bar{\epsilon}$ where $\bar{\epsilon}$ is large. Maybe this is why you are getting incorrect behaviour for large $x$? I tried solving your equation for the $\...


2

You could use a discretization method such as the finite element or finite difference method with a linearization technique such as Picard or Newton method to solve this problem. A similar question is this. The main idea of these solution techniques is as follows: Pick an initial guess for the solution. Linearize your equation and write an updated solution ...


0

I believe this does what you are looking for: import math import numpy as np from scipy.integrate import solve_ivp import matplotlib.pyplot as plt #-------------------------------------- # Problem parameters #-------------------------------------- # --- coefs --------------------------- eta = 2.088 v0 = 1. fs = 8. fk = 5. # --- time -------------------------...


0

It can be done. Back in the 1990s certain groups (think radar cross section computation) were working with 1,000,000 x 1,000,000 dense systems. Consistent with other replies, this was done iteratively and out of core.


1

Let us proceed systematically: numerical precision of data (you said from medical imaging) number of operations required for standard methods (as from libraries) possible out-of-core computation (i.e. not the whole matrix at all times in memory). In all cases, I am afraid, you would have to be prepared to suffer. Incidentally, out-of-core methods are very ...


4

Take a look at the literature that does similar things for facial recognition -- search for the term "eigenface", for example. The point to make in this context is that the information you are looking for does not actually require you to consider high-resolution images. You may have $10,000\times 10,000$ pixels, for which any non-trivial ...


1

As noted above by Thijs Steel a randomized svd is a solution but the number 78800000 is out of our computers computation ability.So you can proceed to the rsvd algorithm by : import numpy as np n = 788 mu = 0 sigma = 1 A = np.random.normal(mu, sigma, (n,n)) Omega = np.random.normal(mu, sigma, (n,n)) def rsvd(A, Omega): Y = A @ Omega Q, _ = np....


5

You want a numerical solution, but this might help you check your computed results. If $a$ satisfies the ODE, you know $e^{a(t)}a'(t) = f(t)$. Integrating you get \begin{align} \int_0^t\, f(\tau)\, d\tau &= \int_0^t e^{a(\tau)}a'(\tau)\, d\tau \\ &= \int_{a(0)}^{a(t)} e^a da \\ &= e^{a(t)} - e^{a(0)}. \end{align}


Top 50 recent answers are included