New answers tagged

2

For the first question: You should look into continuation. I don't know python so i can't write the code for you, but basically, you change the algorithm into something like this: search for some solutions for phi = -2. use those solutions as initial guesses when looking for phi = -1.9 repeat step 2 for the rest of the interval Because you are using the ...


2

Browsing the paper I can confirm that all integrations of the trajectories is done with a fixed time step. The authors compute approximations $A_h(t)$ for all $t \in \Sigma_h$ where $$\Sigma_h = \{ nh \: : \: 0 \leq nh \leq T\}.$$ They use at least two different values of $h$, namely $h_1=0.125$ days and $h_2 = 8$ days. It is important to recognize that $$ \...


1

From what I come to understand about the equation of cosmological inflation, you actually do not know the Hubble constant $H$, but in fact $H$ is a function of $\varphi$. More precisely, the equation is $$\frac{d^2 \varphi}{dt^2} \, + \, 3H\, \frac{d \varphi}{dt} \, + \, V'(\varphi) \, = \, 0$$ where $$H^2 \, = \, \frac{1}{3M_p^2}\, \left(\, \frac{1}{2}\Big(...


1

Use $\psi = \phi'$, that's one 1st order ODE; the second one is $\psi' + 3H\psi + V′(φ)=0\,$


2

odenumjac calls your function in a vectorized manner it seems, and your function is not vectorized. You can easily change that by changing the second index of f in your function to : instead of 1, for instance: f(10,:) = 2*(x(end-1,:) - x(end,:)); I thought the setting joptions.vectvars=1 would not allow the vectorised call (see one of your other questions). ...


3

This problem is too small to actually be sparse. Sparse handling has a big overhead because the indexing is not "direct", i.e. you don't necessarily know where the next value will be without branch checking. So you need it to be "sparse enough" that the O(n^3) dense LU-factorization cost shrinking to the purely non-zero terms overcomes ...


1

The simple example as posted wasn't stiff, but I put it together in Julia anyways for show. I modified it to be a system of 2 PDEs with N=1200 and get in the 10's of ms using ModelingToolkit, LinearAlgebra, BenchmarkTools, DifferentialEquations # Setup matrices N = 1200 mat1 = hcat(zeros(N),Tridiagonal(ones(N-1),-2*ones(N),ones(N-1)),zeros(N)) mat1[1,1] = 1 ...


2

Crank-Nicholson is usually used for linear ODE but can also be extended to a nonlinear ODE $$\dot z = f(z)$$ like so: $$\frac{z_{n + 1} - z_n}{\delta t} = \frac{f(z_{n + 1}) + f(z_n)}{2}.$$ Another similar alternative is the implicit midpoint rule: $$\frac{z_{n + 1} - z_n}{\delta t} = f\left(\frac{z_{n + 1} + z_n}{2}\right).$$ The Crank-Nicholson and ...


Top 50 recent answers are included