Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [numerics]

The tag has no usage guidance.

7
votes
2answers
3k views

Which Runge-Kutta method is more accurate: Dormand-Prince or Cash-Karp?

I simply want to know whether the Dormand-Prince Numerical Method or the Cash-Karp Numerical Method is more accurate.
22
votes
3answers
3k views

What's the state-of-the-art in highly oscillatory integral computation?

What's the state-of-the-art in the approximation of highly oscillatory integrals in both one dimension and higher dimensions to arbitrary precision?
14
votes
1answer
9k views

How should boundary conditions be applied when using finite-volume method?

Following from my previous question I am trying to apply boundary conditions to this non-uniform finite volume mesh, I would like to apply a Robin type boundary condition to the l.h.s. of the domain (...
2
votes
1answer
245 views

Finite difference discretization on a circle

I am trying to discretize the differential operator $\frac{d^2}{dx^2}$ acting on $S^1 = [0,1]$ using finitely many points around a circle at $0, \frac{1}{N}, \frac{2}{N}, \dots, \frac{N-1}{N}$. Here ...
3
votes
0answers
172 views

logsumexp with one very large term and many very small terms

I want to compute an expression of the form: $$L = \ln\sum_i e^{x_i}$$ Suppose that there are many small terms, say $e^{x_i} \approx \epsilon$. If there are $N_\epsilon$ such terms, their ...
6
votes
1answer
2k views

computing turbulent energy spectrum from isotropic turbulence flow field in a box

I have my 3 dimensional velocity flow-field u, v and w at a given instant of time from DNS using pseudo-spectral method. I need to calculate the energy spectrum ( in Fourier space ) as a function of ...
11
votes
3answers
1k views

How should non-constant coefficients be treated with finite-volume first order upwind scheme?

Starting with the advection equation in conservation form. $$ u_t = (a(x)u)_x $$ where $a(x)$ is a velocity which depend on space, and $u$ is a concentration of a species which is conserved. ...
10
votes
2answers
348 views

How much regularization to add to make SVD stable?

I've been using Intel MKL's SVD (dgesvd through SciPy) and noticed that results are are significantly different when I change precision between ...
4
votes
2answers
2k views

Does the finite element method impose any restrictions on the Peclet number for numerical stability?

Background on finite volume method When discretising the flux with a central difference stencil of the the advection-diffusion equation restriction $\frac{ah}{d} < 2$ must be observed for the ...
7
votes
1answer
461 views

How to check the correctness of my implementation of a numerical scheme for differential equation

I know the method of constructing solutions. For example I have a BVP: $$ u_{xx} + u = 0 $$ subjected to: $$ u_{x}(0) = f_1, $$ $$ u_{x}(1) = f_2 $$ If I want to check the correctness of my ...
-1
votes
1answer
486 views

Pde problem with robin boundary condition

I have my pde 2D problem with robin condition (form: du/dn +ku=g) to solve with matlab. i have the exact function u and I want to find the function g in robin condition. How can i do it? thanks for ...
1
vote
1answer
1k views

Implicit heat diffusion with kinetic reactions

I am using the implicit finite difference method to discretize the 1-D transient heat diffusion equation for solid spherical and cylindrical shapes: $$ \frac{1}{\alpha}\frac{\partial T}{\partial t} = ...
7
votes
1answer
240 views
1
vote
1answer
739 views

How can I call the Boost C++ odeint Runge-Kutta integrator for a system of ODEs?

I would like to use Boost C++ odeint Runge-Kutta integrator on a system that looks like this : $$\ddot x = - \frac A{||x||^3} * x $$ $ x $ is a vector in 3D space, so basicaly $ x(i, j, k) $ $ \...
40
votes
4answers
1k views

Scientific standards for numerical errors

In my field of research the specification of experimental errors is commonly accepted and publications which fail to provide them are highly criticized. At the same time I often find that results of ...
39
votes
3answers
3k views

What's the state of the art in parallel ODE methods?

I'm currently looking into parallel methods for ODE integration. There is a lot of new and old literature out there describing a wide range of approaches, but I haven't found any recent surveys or ...
12
votes
2answers
330 views

Oscillations in singularly perturbed reaction-diffusion problems with finite elements

When FEM-discretizing and solving a reaction-diffusion problem, e.g., $$ - \varepsilon \Delta u + u = 1 \text{ on } \Omega\\ u = 0 \text{ on } \partial\Omega $$ with $0 < \varepsilon \ll 1$ (...
9
votes
1answer
5k views

Applying the Runge-Kutta method to second order ODEs

How can I replace the Euler method by Runge-Kutta 4th order to determine the free fall motion in not constant gravitional magnitude (eg. free fall from 10 000 km above ground)? So far I wrote simple ...
3
votes
2answers
1k views

How to plot orbit of binary star and calculate its orbital elements?

I have a set of dates, position angles ($\theta$) and angular separations ($\rho$) for visual binary star. For example: ...
2
votes
1answer
637 views

Doubt regarding stopping criterion for Newton method

I am solving an unconstrained convex optimization problem, which can easily have a million variables. I am trying to get a working system with a toy problem of around 200 variables. I am noticing that ...
16
votes
1answer
807 views

How do you debug numerical code, what could be source of this oscillatory error?

Quiet a lot of insight can be gained form experience, I was just wondering if anybody has seen something similar to this before. The plot shows the initial condition (green) for the advection-...
15
votes
3answers
6k views

Efficient computation of the matrix square root inverse

A common problem in statistics is computing the square root inverse of a symmetric positive definite matrix. What would be the most efficient way of computing this? I came across some literature (...
10
votes
4answers
601 views

Relevance of fixed-point and arbitrary precision computations

I see very few non-floating point computing libraries/packages around. Given the various inaccuracies of floating point representation, the question arises why there aren't at least some fields where ...
9
votes
2answers
999 views

What does the Von Neumann's stability analysis tell us about non-linear finite difference equations?

I am reading a paper [1] where they solve the following non-linear equation \begin{equation} u_t + u_x + uu_x - u_{xxt} = 0 \end{equation} using finite difference methods. They also analyse the ...
4
votes
2answers
3k views

Error in result of finite-difference approximation when refining

I have calculated the first derivative of following equation using Euler method (first order), Three point Finite Difference method (second order) and Four point Finite Difference method (third order)....
4
votes
1answer
794 views

How do I form the Chebyshev differentiation matrix in MATLAB?

I have some code that does exactly this, but I do not like to use things I do not understand. Here is the code ...
4
votes
0answers
280 views

Frozen coefficient method (von Neumann stability analysis)

Earlier it was considered that frozen coefficients method for Neumann stability analysis for finite difference scheme is more heuristic than rigorous. But I have read some information in a book by ...
3
votes
2answers
305 views

Precision loss in Matrix-Vector product when applying Finite-Difference scheme

I am applying a 6th order Finite-Difference differentiation scheme as seen in http://www.scholarpedia.org/article/Method_of_lines/example_implementation/dss006 There seems to be severe numerical/...
3
votes
3answers
1k views

Solving nonlinear differential equations with Newton's method

I have difficulties with this equation $$\frac{d^2 u}{d x^2} + u^2 - x^2 = 0$$ with boundary conditions: $u(0)=u(1)=0$ I do not know how to solve nonlinear differential equations with Newton's ...
2
votes
1answer
80 views

Implementation details for high order IMEX methods by Kennedy and Carpenter

This question is a continuation of Fourth order IMEX Runge-Kutta method, concerning the implementation. Is seems to me that the first implicit stage value involves a direct evaluation, rather than ...
2
votes
1answer
288 views

ground state from the Schroedinger equation with a central potential what happens to the origin

I have code that attempts to implement a solution to the Schrödinger equation where there is a central potential (more or less im thinking of hydrogen), in 1-D using the numerov method to construct ...
1
vote
0answers
59 views

Euler's first order Error

I was estimating a falling object's position versus time by using a simple first order step function, where ...
1
vote
1answer
5k views

Numerically determining convergence order of Euler's method

I need to numerically determine the convergence order of Euler's method for various step-sizes. I am unsure how to go about doing this. Here is the question: Problem statement: $\frac{dy}{dt}=\alpha ...
11
votes
1answer
805 views

Numerical methods for inverting integral transforms?

I'm trying to numerically invert the following integral transform: $$F(y) = \int_{0}^{\infty} y\exp{\left[-\frac{1}{2}(y^2 + x^2)\right]} I_0\left(xy\right)f(x)\;\mathrm{d}x$$ So for a given $F(y)$ ...
7
votes
1answer
199 views

Does mean removal increase accuracy of numerical differentiation?

I wish to compute the derivative of a vector through numerical differentiation. Let's say, we use a standard 2nd order central difference scheme, to arrive at a differentiation matrix, and apply it on ...
6
votes
2answers
183 views

Continuation procedure to solve for a 2D curve that satisfies f(x,y) = 0

I have some function of $R^2$, that must be numerically computed. For instance, I might be interested in a real-valued contour integral that begins from (x,y) = 0. $$ f(x,y) = \Re\left[\int_0^{x + iy}...
6
votes
1answer
309 views

Caveats of Hessian free method

Hessian free iterative optimization techniques like Newton-CG, do not explicitly compute the Hessian but instead approximate the product of the Hessian with a vector through finite difference. The ...
4
votes
2answers
165 views

Optimization of known function with respect to two unknown function arguments

I have a data set, composed of points $(x_i, y_i)$ for $i=1,N$. I also have a known function $F$, which maps these points $x_i$ to $y_i$ as such $F(x_i, a(x_i),b(x_i)) = y_i$, where $a(x_i)$ and $b(...
4
votes
2answers
214 views

Determine numerical infinity for Schrodinger equation $−\psi''(x) + x^ 2 \psi(x) = E\psi(x)$

Consider the following Schrodinger equation for the harmonic oscillator with real $x$: $$ −ψ''(x) + x^ 2 ψ(x) = Eψ(x). $$ I solve the last equation using shooting method and implicit Runge-Kutta ...
4
votes
1answer
795 views

FEM: which is the correct way to impose Dirichlet B.C

I know the Neumann B.C. is implicit in FEM language. However, I have seen at least two ways to impose Dirichlet B.C. e.g. for the following problem 1D, $$\nabla^2 u + \nabla u= 0, u_{left}= 1, u_{...
4
votes
1answer
240 views

Points on the interface

We consider the problem $\left\{\begin{matrix} k(x)\Delta u(x)=f(x) & \text{ in } \Omega\\ u=0 & \text{ in } \Gamma \end{matrix}\right.$ where $\Omega \subset \mathbb{R}^2$ open and ...
4
votes
1answer
184 views

Interpolating a mathematical function using a Hermite Cubic Finite Element Space

I have a Hermite Cubic Finite Element Space on a computer in the form of Matlab m-files. More specifically, I can evaluate four "shape functions" $N_1, N_2, N_3,$ and $N_4$, for which the following ...
4
votes
1answer
150 views

Numerical computation of the velocity in the steady Navier-Stokes equation

I've asked this question on Math.SE too. Let $d\in\left\{1,\ldots,4\right\}$ $\Lambda\subseteq\mathbb R^d$ be bounded, nonempty and open and $\partial\Lambda$ be Lipschitz $V:=\left\{u\in H_0^1(\...
4
votes
1answer
123 views

Stable method for solving a HJB equation

I am considering finite difference methods and their error analysis for solving HJB equation of the following form: $$ v_t=|\sigma(x)v_x|,\quad x\in \mathbb{R}, $$ where $\sigma$ is a given function ...
3
votes
1answer
296 views

Finite difference method basic implementation on Octave

Trying to study the error of FDM for a second order derivative versus step size I calculated the coefficients and validated them, but the output has errors for small step sizes. The function in ...
3
votes
0answers
67 views

Backward stable algorithm to get orthogonal projection onto the column space of a matrix

I have to find the orthogonal projection of a vector $b$ onto the matrix $A$ of size $m \times n$. In my application, I don't have the luxury of calculating the QR factorization. All I have are ...
3
votes
1answer
938 views

How can I solve wave equation for circular membrane in polar coordinates?

The original equation is $$\frac{1}{c^2} \frac{\partial^2 u}{\partial t^2} = \frac{\partial^2 u}{\partial r^2} + \frac{1}{r}\frac{\partial u}{\partial r} + \frac{1}{r^2}\frac{\partial^2 u}{\partial \...
3
votes
1answer
232 views

Finite volume with cell averages vs cell totals for conservation equations

What implementation details need to change if I use a cell average approach rather than a cell total approach for the finite-volume method? For example, consider the conservation law, $$ u_t + \...
3
votes
1answer
127 views

How can I avoid roundoff error when calculating the difference $\textrm{erfc}(a) - \textrm{erfc}(b)$?

In this excellent answer, it is recommended that one make use of the $\textrm{erfcx}$ function to avoid roundoff error in calculating dealing with $x < 25$ (approximately). So, one scales their ...
3
votes
1answer
2k views

How do I program periodic boundary conditions? [duplicate]

Hi I have a code below that solves non linear coupled PDE's given Dirichlet boundary conditions. However I need to implement periodic boundary conditions. The periodic boundary conditions are ...