Questions tagged [numerics]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
35 views

Scheme Solving CCZ4 Formalism Numerically

For my thesis, I have to implement the CCZ4 formalism into an existing code (I tried to type the evolution equations here but does not seem to work). However, I can't seem to come up with a scheme to ...
Kabouter9's user avatar
  • 111
2 votes
1 answer
136 views

Computing numerical derivatives

I am trying to create a sweeping surface, for which I need the frenet frame of a curve. I am trying to compute this for arbitrary curves but for testing I am just using the parametric unit half circle....
Makogan's user avatar
  • 263
1 vote
1 answer
92 views

Solving basic barystochrone problem in python

I am trying to solve $\frac{u''}{1+u'^2} - \frac{1}{2(1-u)} = 0$ subject to $u(0)=1, u(1)=0$. If I understand how to do this properly, I first do the variable substitutions: $u = y$, $y_1 = y; y_2 = y'...
Makogan's user avatar
  • 263
0 votes
1 answer
91 views

Integration of a singular kernel function over a triangle

Problem: I am currently trying to integrate a singular kernel function of the type $$G(x,y)=\frac{\exp(ik||x-y||_2)}{4\pi ||x-y||_2}$$ which lies at the centre of a triangle, over this triangle. $i$ ...
Bulbasaur's user avatar
  • 101
0 votes
0 answers
152 views

discrete definition of curl $ \nabla \times \vec{A}$ on a 3D grid?

I have the data for 3D vector field $\vec{A}$ (with components $\vec{A_1}$, $\vec{A_2}$ and $\vec{A_3}$) sampled on a 3D grid with integer indices i, j and k. Assuming that only the third component $\...
rockonkl's user avatar
0 votes
0 answers
79 views

Is it possible to globally solve a general coordinate-wise monotone nonlinear system 3x3?

Consider a system $$ F_i(x, y, z) = 0, \quad i = 1, 2, 3 $$ with $F_i$ monotonic w.r.t. $x, y$ and $z$. The system 2x2 can be easily solved with alternating direction method that will find all its ...
jokersobak's user avatar
3 votes
0 answers
124 views

Numerical integration of a rapidly varying complex exponential

I have a function $f : \mathbb{R}^2 \mapsto \mathbb{R}^+$ and I wish to numerically evaluate the integral below over a finite domain $\Omega \subset \mathbb{R}^2$ $$ I = \int_\Omega e^{i k \cdot f(\...
Thomas's user avatar
  • 131
2 votes
0 answers
98 views

Compact Finite Differences for the Heat Equation with Robin Boundary Conditions

I am trying to solve the Heat equation with Robin Boundary condition: $$ u_t(x,t) = u_{xx}(x,t), \\ u(x,0) = g(x), \\ u(0,t) + u_x(0,t) = h_0(t), \\ u(1,t) + u_x(1,t) = h_1(t)$$ for $ 0\leq x\leq1$ ...
Jules's user avatar
  • 21
1 vote
1 answer
195 views

Nonlinear Robin boundary condition involving square root

If you have a nonlinear second-order boundary value problem where the domain of the problem is $x \in [a,b]$, the boundary conditions imposed are the Robins condition at $x=a$ and the Dirichlet ...
mathemania's user avatar
4 votes
2 answers
361 views

computing higher order derivatives with linear elements

Consider the following equation on $(0,1)$, with Dirichlet boundary conditions on both ends. $$ \frac{d}{dx}\left(k(x)\frac{du}{dx}\right) = 0 $$ Let us solve this using simple linear finite elements. ...
NNN's user avatar
  • 758
1 vote
1 answer
463 views

Solving a 2nd order complex-valued matrix differential equation in Python

I am trying to solve the following complex-valued matrix differential equation backwards (i.e. not starting at $r=0$, but rather at $r > 0$): $F'' = 2ikF' + VF$. Here $F=F(r)$ and $V=V(r)$ are 2x2 ...
Martin C.'s user avatar
  • 229
0 votes
0 answers
42 views

Numerical Method for Multivariate Inversion Formula

For my research, I need to evaluate the density of a random vector $\boldsymbol{X} \in \mathbb{R}^p$ using the multivariate inversion formula. Let the density function of $\boldsymbol{X}$ be $f (\...
little_sky's user avatar
1 vote
0 answers
62 views

Finite-difference produces a derivative off by one order

I have a nonlinear 2nd order boundary value differential equation where I used finite-difference method (central finite-difference) to solve it. $$z''(x)-\frac{\frac{1}{100} z(x)^4 \left(2 z'(x)^2+12\...
mathemania's user avatar
1 vote
0 answers
142 views

How do the current FEM opensource libraries compare?

Almost all FEM libraries are good enough, but I want to start with a FEM package and stick to it for some time. Instead of trying all of them, or going with what everyone else is using, I want to ...
CuteCompute's user avatar
3 votes
1 answer
110 views

Wrong Boundary Conditions Result Using Wavelet Collocation

I have a functional $S$, $$S = \int_{x_0}^{x_b} dx \frac{1}{z(x)^d} \sqrt{1 + \frac{z'(x)^2}{f(z)}}, \qquad f(z) = 1-\left(\frac{z(x)}{z_h}\right)^{d+1} $$ where $d=3$ is the dimension and $z_h$ is ...
mathemania's user avatar
4 votes
3 answers
1k views

How can I numerically integrate the Kepler problem?

I tried to solve a simple Kepler problem numerically. I have discrete time steps, a starting position $(x_0,y_0)$ and starting velocity $(u_0, v_0)$. I used this iteration by calculating the forces ...
MichaelW's user avatar
  • 151
1 vote
0 answers
19 views

Given a set of 1d-points, find the most probable periodicity that models the points (with possible omissions) as equidistant occurences

I try to detect interference fringes in a bunch of pictures. I projected on one axis, and I was able to detekt the peaks that indicate one of the fringes. So now I'm having a list with points (e.g. $(...
Quantumwhisp's user avatar
2 votes
0 answers
35 views

How to exploit QR factorization implicitly

I meet a problem when I try to develop an iterative method for discrete inverse problem $$Ax+e=b$$ where $A\in\mathbb{R}^{m\times n}$ and $e$ is a noise. I want to approximate the true solution $x_{...
Haibolee's user avatar
1 vote
1 answer
75 views

blown up solution for linear advection in upwind method with finite difference

I am going to solve this advection equation regarding the flow simulation of an energy tower \begin{equation} Y_t+ v(t) Y_x =0 \end{equation} with the following boundary conditions which depend on ...
TMW's user avatar
  • 11
3 votes
1 answer
122 views

Scipy solve_ivp sensitivity to random phase shifts

I am trying to solve a coupled system of ODE's using the solve_ivp function from scipy. The general form of the equation is given via $$\dot{y}(t) = M(t)y(t).$$ The time dependence of matrix is ...
raeel's user avatar
  • 31
8 votes
1 answer
221 views

Accurate computation of logbinomial(x,y)

I need to compute the logarithm of the binomial coefficient, $$\log\binom{x}{y} = -\log\mathrm{B}(y + 1, x - y + 1) - \log(x + 1)$$ accurately, where $\mathrm{B}(x,y)$ is the Beta function. I'm aware ...
a06e's user avatar
  • 1,729
0 votes
1 answer
180 views

Solve discontinuous ODE with lsode

I am trying to solve a discontinuous ODE using the lsode solver. I tried setting the t_crit parameter to specify the time where the discontinuity is present, but it ...
Bruno's user avatar
  • 101
2 votes
1 answer
130 views

Deterministic SIR metapopulation model and coupling behavior

Context: I am trying to reproduce a figure from Keeling 2007 that illustrates time lags that can occur between the peaks (maximum) of the infected solutions for two subpopulations of a metapopulation ...
Jared Frazier's user avatar
0 votes
1 answer
217 views

solve_ivp not giving out any output and no error while souple 3 coupled 2nd order ODES

Please, someone tell me what is wrong in my code it does not give any outputs ( No plot nor print). The code is as below: ...
Lunthang Peter's user avatar
0 votes
1 answer
98 views

Averaging oscillatory data

I have an oscillatory data generated vs time as shown below. Essentially, I want this data to be averaged and free of any oscillations. I am not satisfied with the results from a simple moving average ...
Sthavishtha Bhopalam's user avatar
0 votes
0 answers
62 views

Can I use MOL to solve 2D steady state PDE in terms of r and z spatial coordinates?

recently I need to solve a 2D steady state PDE equation. It’s not time dependent, and the only two independent variables are z and r direction. So far for this solution, I was thinking using Method ...
Chi Chi 's user avatar
2 votes
0 answers
54 views

Dispersion of Runge-Kutta methods when applied to systems of ODEs

I am interested in computing the dispersion / phase error(s ?) of an (explicit) Runge-Kutta method when applied to a linear system of ODEs $$ u'(t) = A u(t). \tag{1} \label{1} $$ To begin, consider ...
Dan Doe's user avatar
  • 1,083
3 votes
2 answers
712 views

Python bifurcation diagram of seasonally forced epidemiological models

TL:DR How can one implement a bifurcation diagram of a seasonally forced epidemiological model such as SEIR (susceptible, exposed, infected, recovered) in Python? I already know how to implement the ...
Jared Frazier's user avatar
2 votes
0 answers
108 views

Numerical precision on tricky coupled nonlinear boundary value problem on infinite interval

I am trying to solve with high precision the following coupled system $(f,h)$ on $[0,\infty]$: $$-h''-\frac{1}{r}h'+\lambda_c h(f^2-1)+4\lambda_h h^3=0$$ $$-f''-\frac{1}{r}f'+\frac{1}{r^2}f+ f(-\...
phyphy's user avatar
  • 33
1 vote
1 answer
188 views

Boundary value problem solver fails on trivial case

I am trying to solve a boundary value problem on $[0, \infty]$, using scipy's scipy.integrate.solve_bvp and I am seeing that the solutions are not converging even ...
phyphy's user avatar
  • 33
3 votes
1 answer
227 views

Correctness of direct numerical solution of ill-conditioned linear system

To what extent can you put trust in a numerical solution obtained by direct solver for an ill-conditioned linear system? In other words, how can you test the solution? Dropping it into the system says ...
Fidel Pestrukhine's user avatar
-1 votes
1 answer
83 views

How to find armijo step length for a neural network?

The armijo step length formula states that f(x+lr*descent_direction) <=f(x)+c*lr*f_gradient*descent_direction In the above formula lris the learning rate and f ...
Jeet's user avatar
  • 113
0 votes
0 answers
48 views

How to calculate Landau levels for a system e.g., Graphene numerically?

I am currently trying to calculate Landau levels for any system numerically in python. But, I am clueless about where to start rather, how to construct the Hamiltonian. Can anyone help?
S Das's user avatar
  • 11
1 vote
1 answer
207 views

Differential equation for radioactive cooling in fortran

Today I'm trying to evaluate this differential equation for internal energy in a gas in Fortran: $$ \frac{du}{dt} = - \frac{n_H^2}{\rho}\frac{\Lambda}{n_H^2} $$ Where nH is the density of hydrogen in ...
Marco Leonardi's user avatar
5 votes
1 answer
124 views

What are the various methods in adding an additional constraint to the quadratic spline interpolation problem

I am taking a class on numerical analysis. While the professor was deriving the theory behind quadratic splines, the professor mentioned that a quadratic spline function has the form: $$ p_{i}(x)=a_{i}...
User19212341's user avatar
0 votes
0 answers
45 views

Rectangular problem to use for benchmarking a large dense linear solver?

Can anyone suggest a rectangular problem I can use for evaluating a large dense linear solver? ($m,n>1000$) IE, ideally something that's easy to download and has been evaluated for some solvers ...
Yaroslav Bulatov's user avatar
1 vote
0 answers
43 views

How to calculate a product of two real functions of large, but opposite magnitude?

I need to evaluate a product of two real functions, namely $F(x)\cdot G(x)$. The function $F(x)$ is a diverging and obscure member of scipy.special, while $G(x)$ is a gaussian. While the product is a ...
i_prob_should_know_this's user avatar
1 vote
1 answer
71 views

Efficient and stable QR factorization of partially orthonormal matrix

Let $U \in \mathbb{C}^{m \times n_U}$ be an orthonormal matrix, let $A \in \mathbb{C}^{m \times n_A}$, and $m \geq n_U + n_A$. I want to compute a QR factorization $X = \left[U A\right] = QR$, with $Q ...
coolguy1000000's user avatar
2 votes
0 answers
169 views

Error in implementation of Crank-Nicolson method applied to 1D TDSE?

Some context, I've posted this question on physics SE and stack overflow. The former had nothing to offer, the latter had a great commenter that agreed with the phase looking off being one of the ...
MinimalCodingIQ's user avatar
3 votes
2 answers
2k views

Inaccurate results of integration using scipy solve_ivp

I am trying to use solve_ivp to solve the following 1st order ODE: $$ \frac{d \rho}{d z} = \frac{m \theta}{(1+\theta z)} \, \rho, $$ subject to $\rho(z=0)=1$, where ...
Fryderyk's user avatar
0 votes
0 answers
30 views

What are the known or used numerical methods for integration over the sphere $S^2$ ? and what about over $S^3$?

What are the numerical methods available to compute integrals over $S^2$, for the particular integration : $$\int_{S^2} f(\omega)\,d\sigma(\omega)\ , \quad \text{ where $d\sigma$ is the usual measure ...
NotaChoice's user avatar
0 votes
1 answer
92 views

finding discretization error in Burger equation

I was reading the paper given in the link http://www.unige.ch/~hairer/preprints/parareal.pdf and I have a problem in understanding in page 10 for the Burger equation on implementing Parareal method ...
420's user avatar
  • 41
14 votes
3 answers
2k views

Why aren't Krylov subspace methods popular in the Machine Learning community compared to Gradient Descent?

Historically, iterative methods for solving relatively simple-structured systems $Ax=b$ with $A$ being a $4\times 4$ matrix or to find the eigenvalues of that matrix assuming in both problems that $A$ ...
SPARSE's user avatar
  • 169
1 vote
0 answers
98 views

Numerical methods for $u_t+c u_x= \frac{-c}{x}u$?

I am looking for possible numerical methods to solve the PDE $$u_t+c u_x= \frac{-c}{x}u$$ I am particularly interested in a Finite elements method, although I am also curious if you can expose some ...
NotaChoice's user avatar
4 votes
1 answer
126 views

A priori FEM estimates without $H^2$ regularity

In basic lectures on finite elements theory, people always assume $H^2$ regularity of the solution in order to derive $O(h^k)$ a priori estimates in the norms $H^{2-k}$, $k=1,2$. For simplicity let's ...
Lilla's user avatar
  • 259
1 vote
1 answer
136 views

Efficiency of developing PDE solvers using sparse matrices versus loops

I am new to solving PDEs, but have been looking at different implementations of finite difference and finite volume schemes. One thing I have noticed in different implementations is that some ...
krishnab's user avatar
  • 297
1 vote
1 answer
352 views

A question on the Poisson equation with Neumann and periodic boundary conditions on a rectangular region

I am trying to solve the following PDE by using finite difference \begin{eqnarray*} \Delta u&=& f ~~on~~(0,1)\times(0,1)\\ \frac{\partial u}{\partial y}(x,0)&=&0=\frac{\partial u}{\...
User124356's user avatar
0 votes
0 answers
67 views

Reference request for finite elements theory

Consider a domain $\Omega \subseteq \mathbb{R}^{2,3}$ which is non convex and with $C^2$ boundary. Could you recommend a good reference where it is explained how: without needing isoparametric ...
Lilla's user avatar
  • 259
2 votes
0 answers
101 views

FEM applied to heat equation and incompatible conditions

Consider the problem $$u_t - \Delta u = f \text{ on } \Omega\times (0,T)\\u=0 \text{ on } \partial \Omega\times (0,T) \\ u(x,0)=g(x) \text{ on } \Omega$$ with $g$ NOT vanishing on the boundary. If I ...
Lilla's user avatar
  • 259
1 vote
2 answers
127 views

Secant Method for finding $\sup f^{-1}(0)$

Let $f \in C^0[0, 1]$, and suppose $f \ge 0$. How can I compute $\sup f^{-1}(0)$ efficiently?
Joe Shmo's user avatar
  • 121

1 2
3
4 5
22