Questions tagged [numerics]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
59 views

How to Break Coupled ODEs down to first order for Runge-Kutta

My question might seem a bit simple. I am trying to solve a system of ODEs using Runge-Kutta method. I am having difficulty breaking down the equations into a system of first order ones required ...
2
votes
1answer
53 views

How to robustly and numerically expand a $k$-order polynomial in two variables defined on a polygon domain?

Given a $k$-order polynomial in two variable $p(x, y)$ defined on a polygon domain $K$. And I want to numerically expand it to the following form $$ p(x, y) = c_0 + c_1 x + c_2 y + c_3 x^2 + c_4 xy + ...
1
vote
0answers
46 views

Numerical Method for Equation System of two depending Equation Systems

I am searching a solution method for the following equation system of equation systems: Let $A \in \mathbb{R}^{n \times n}$ be an invertible Matrix, $f, b_1, b_2 \in\mathbb{R}^n$ given vectors and $ ...
6
votes
1answer
101 views

Computing square root of diag(u)-uu'?

I need an efficient way to take square root of a matrix which is a sum of diagonal matrix and rank-1 matrix. More specifically it's the following matrix $$A=D-uu'=\text{diag}(u)-uu'$$ Where entries ...
1
vote
2answers
47 views

Numerical integral with symbolic integral in exponent

Many times in fourier approximation we come across integrals such as $$\int_0^1 e^{-\gamma\int_0^xu_0(\eta)d\eta}dx$$ where $\gamma$ is a constant and the data for $u_0$ is provided as a discretely ...
3
votes
1answer
52 views

Bounding error of float32 matrix multiplication

Some numerical debugging led me to the minimal example below. I'm observing relative error of 0.75 on individual elements. Is there a way to estimate/bound this error without resorting to higher ...
2
votes
1answer
44 views

Passing data as arguments in ODE45

I need to import data from file in order to describe the structure of a network. I used the following: weights = readtable('weights192.txt'); W = weights{:,:}; ...
2
votes
0answers
48 views

Numerical integration of SDE: choice of $dt$ and algorithm

I am working on the following Stochastic Differential Equation (SDE) in the Quantum Mechanics context: $$dX_{t} = a X_{t} dt + b X_{t} dW$$ where $X_{t}$ is my stochastic varible, $dt$ is my ...
1
vote
1answer
28 views

Weighted moving variance

i have a time-series and, in analogy with exponentially weighted moving average, i would like to compute the exponentially weighted moving standard deviation or variance in an efficient, numerically ...
2
votes
0answers
37 views

Inverses of many standard subspaces of one large matrix

i have a large rectangular invertible matrix M (about 5000x5000) and i have a loop in which i do the following for each iteration i (there are about 6000 iterations): i am given a subspace S_i (which ...
1
vote
0answers
59 views

Runge-Kutta for PID and system in separate calculations without filter

I need to calculate a closed-loop system in Python; specifically, obtain the PID response and then use the output to obtain the system response sample-by-sample with my own loop. For this, I am ...
0
votes
0answers
63 views

How to implement the following Finite Element method for Burgers' equation?

I am trying to replicate this result. It involves using the Galerkin finite element approach onto the viscous Burgers' equation. However, my implementation (in R) seems to be giving me wrong results....
0
votes
1answer
83 views

Well-posedness of Navier-Stokes equation

Before running a simulation for turbulence (e.g Rayleigh-Benard Convection), how do we check for well-posedness of Navier-Stokes with other equations for a given boundary condition?? Can someone ...
7
votes
0answers
90 views

Numerically estimating expected value of f(x) when x is normally distributed

I need to estimate $$ \mathbb{E}_x[f_i(x)] = \int_{\mathbb{R}^n} f_i(x) p(x) dx $$ for many functions $f_i(x)$, where $p(x)$ is the density of a normal distribution. The evaluation of all the ...
5
votes
0answers
47 views

Evaluate Nth root of a rational to a correctly rounded float

Excuse my lack of vocabulary for I have no formal training in this field, which is also why I ask this question - it may be trivial or it may be impossible. I want to evaluate an expression in the ...
1
vote
0answers
70 views

How to compute the following Crank-Nicolson scheme for the viscous Burgers' Equation?

I am attempting to replicate results from this article. I'm not sure why but my results are completely different and wrong. For example, the exact solution with parameters ($x=0.1$, $T=0.01$, $Re=0....
1
vote
0answers
78 views

What's the more efficient way to solve this matrix equation?

This is intended to be a more generic question not about a specific system. Given a hermitian matrix $H(x_1,\dots,x_n)$ depending non-linearly on some real parameters $x_1,\dots,x_n$. We want these to ...
3
votes
0answers
70 views

Integrators for Nonlinear/Stiff PDE

It was suggested I ask this question in this section. Anyway: I have a particular nonlinear PDE of the form $$ u_t(x,t)=iu_{xx}(x,t)+f(x,u(x,t)) \tag{1} $$ Where f is some nonlinear function. With ...
1
vote
0answers
46 views

WENO scheme on curvilinear coordinates

I've been developing a curvilinear FVM code. So far I've implemented the PPM scheme and am looking into adding WENO schemes. So far I've been discretizing the grid metrics using a second-order central....
4
votes
0answers
65 views

Complex differentiation of linear solvers

I have a linear system $$Ax=b$$ which I'm solving approximately, and I need to take the frechet derivative of x with respect to z. Were I solving the problem exactly (either analytically or to machine ...
1
vote
1answer
56 views

How to get started with numerically solving a Stochastic Navier Stokes equation

I originally posted the question on the math stackexchange, and was told I should try here. I’m researching Stochastic PDE, in particular the Navier Stokes Equation, and would like to estimate the ...
0
votes
2answers
320 views

(FEM) 1D time-dependent heat equation convergence problem

I'm simulating a simple 3-node bar with convection BCs at the edges to validate my FEM code. The following data was used: Initial temperature = 25 ºC Temperature surrounding the rod = 10 ºC Thermal ...
0
votes
0answers
38 views

Techniques to optimise the integral of a function of known analytical form

I need to compute repeatedly a function that depends on an integral. The integral is not solvable analytically, but it depends on the argument of the function parametrically, like this: $$ f(x) = \...
6
votes
1answer
88 views

Going back in time in an initial value problem

Consider an initial value problem (IVP) $y'=f(t,y)$ with the initial value given by $y(t=0) = 0$. If I need to find $y(t^*)$, hence finding the path for $y$ in $t \in [0,t^*]$ and $t^*<0$; is the ...
3
votes
1answer
72 views

How to show the stability of $L^2$ projection?

If $\mathcal{T}_h$ is a regular and quasi-uniform triangulation of $\Omega$, and $V_h$ is the $H^1$-conforming linear finite element space. Moreover, let $P_h$ be the $L^2$ projection to $V_h\subset H^...
2
votes
1answer
139 views

In iterative methods, are matrix decompositions considered useful for implementation?

When we study an iterative method from textbooks, for example, see the Gauss-Seidel Method, the given matrix is decomposed with suitable splittings. In the example, $A = L+U$. So we can proceed with ...
1
vote
0answers
60 views

How to use Wolfe-Powell step-size control in quasi-Newton method?

I'm trying to find the minimum of a function using the quasi-Newton method with the Broyden-Fletcher-Goldfarb-Shanno (BFGS) algorithm. But I want to change the following implementation, so that: 1) ...
2
votes
1answer
54 views

Computing face fluxes in FVM

In FVM, we have to compute fluxes at some face of a cell. There are many ways to compute this face flux value, but the most common and easiest way involves some simple averaging at the face. However, ...
0
votes
0answers
28 views

Fit exponential convergence

I'm working with a numerical algorithm whose output $y$ asymptotically approaches a certain unknown value $a$. I expect an exponential convergence, i.e. the data $y$ given by my algorithm should be ...
4
votes
1answer
161 views

Accurate way of getting the square root inverse of a positive definite symmetric matrix

What is the most accurate algorithm to get the square root inverse of a positive definite symmetric matrix? I am not looking as much for efficiency, though using quadruple precision computation is out ...
0
votes
0answers
32 views

How to show equivalence between two programs?

Consider the following space $A = \{(x_1,x_2,x_3)\in \mathbb{R}^3|x_1+x_2+x_3 = 1\}.$ Then say that we want to minimize a function $J(y):\mathbb{R}^{3}\to \mathbb{R}$ subjected to the constraint that $...
-2
votes
1answer
79 views

How to : numerical integration by quadrature in C language / remove NaN

What I wanna solve it the problem following ( by quadrature method ) I want to get two arrays of data ( z & tau ) from z[0], tau[0] to z[2249], tau[2249]. Since the integrand diverges at z=0.9, ...
2
votes
0answers
37 views

How to determine the order of convergence of the Euler-Maruyama method?

This question is originally posted in Quant.StackExchange but has been unanswered for some time so I ask in here. To make this simple let us consider the Geometric Brownian Motions (GBM). My ...
1
vote
1answer
84 views

Dirichlet to Neumann Operator

EDIT: I am trying to specify my Question. Also I am not going to clearify which spaces I use, because I am only interested in the basic idea. I am looking at a standard elliptic second order PDE: \...
0
votes
1answer
146 views

Solving $n$ coupled equations numerically in Matlab

I would like to solve the following equations simultaneously and numerically for all $X, Y, Z, W$ where i = 1:Nw, j = 1:Nl, k = 1:K. $W_\text{net1}$, $W_\text{net2}...
1
vote
0answers
49 views

Singular Spectrum Analysis Explanation

I need you to help me understand the Singular Spectrum Analysis algorithm. I already read a lot of articles about the subject but they never answered my questions like what is the mathematical reason ...
0
votes
1answer
61 views

Fast Poisson solver (with Dirichlet BC zero) on a *truncated* Cartesian 3D grid

I find myself in the position of having to solve $-\Delta u = f$ on a subset of Cartesian grid points that don't necessarily form a cuboid domain subject to a homogenious Dirichlet boundary condition ...
2
votes
2answers
73 views

Stability of Crank-Nicolson for $u_t = iu_{xx}+2iu$

I want to use the Crank-Nicolson scheme to solve the equation $$u_t = iu_{xx}+2iu$$ Here's the analysis: Suppose we make a grid, with $k = dt$ and $h = dx$, the usual notation, and also $u_j^n = u(...
0
votes
0answers
55 views

The final Boundary Condition is Unknown, Is Backward Euler is still valid to be implemented?

I am working on conductive polymer modeling and supposed to do one-dimensional diffusion model in the thickness of the polymer, however, due to the small value of thickness in micro, when I use the ...
1
vote
0answers
30 views

Why does the correlation function of this stochastic differential equation starts at different points?

I am working with the following differential equation: The equation is $$x=\beta +\sqrt{2D} \xi(t)$$ where $\xi(t)$ is a white noise term, with a reflecting wall boundary conditions. After solving ...
2
votes
0answers
61 views

How to implement adaptive step size Runge-Kutta Cash-Karp?

Trying to implement an adaptive step size Runge-Kutta Cash-Karp but failing with this error: ...
3
votes
1answer
45 views

Stability region of explicit midpoint method

Consider the explicit midpoint method, i.e $$y_{n+1}-y_{n-1} = 2hf(y_n).$$ I'm asked to apply this method to the linear test equation, $f(y_n) = \lambda y_n,$ in order to find the method's stability ...
5
votes
0answers
81 views

Numerical methods for the continuity equation with Sobolev vector field

Consider the continuity equation $$ \partial_t \rho(x,t) + \operatorname{div} (b(x,t) \rho(x,t)) = 0, \qquad t \in [0,T], \quad x \in \mathbb R^N, $$ with $b \in L^1((0,T), W^{1,p}(\mathbb R^N))$. ...
0
votes
0answers
39 views

Time sampling changes solution

I'm currently trying to solve a problem using numerical methods. The set-up is rather long, so I apologize in advance... TL;DR: My solutions change depending on how big my steps are and I don't know ...
2
votes
1answer
112 views

Why the numerical solution of advection-dominant problem is challenging

In many CFD text books, usually there is a dedicated chapter for advection term discretization. Why discretization of such term in advection-dominated problems and near the discontinuities is ...
0
votes
0answers
61 views

Need help applying Implicit Eulers Method together with Newtons Method on Burgers' Equation

From the inviscid Burgers' equation: $\frac{\partial u}{\partial t}+u\frac{\partial u}{\partial x} = 0$, I get the discretization $\frac{u_i^{n+1}-u_i^n}{\Delta t}+\frac{(u_i^{n+1})^2-(u_{i-1}^n)^2}{\...
3
votes
4answers
203 views

Numerical integration in Python with unknown constant

I’d like to solve the below equation for the unknown $T$: $$\int_0^\infty \frac{x^2}{\exp\left(\frac{x}{T}\right)-1}\kappa_x \mathrm{d}x = C,$$ where $C$ is a known constant and $\kappa_x$ is some ...
1
vote
1answer
61 views

Is there a better way to do run time analysis than this?

I currently have 2 different functions with options to vectorise them: acc_rej_sine(max_iter, algorithm=None) and ...
1
vote
1answer
72 views

Approximation Error in a Finite Difference Approximation of the Square of Derivative

First Part: (First-order derivative) Assuming $f$ is an infinitely differential function everywhere, the Taylor series of $f(x + h)$ at $x$ is \begin{align}\tag{1} f(x + h) = f(x) + hf'(x) + \frac{1}...
0
votes
0answers
69 views

Analytic vs discrete understanding of PDE

The PDE I am working with: $$\partial_tu = \nabla \cdot (a(x)\nabla u)-\beta(x)u\\ \partial_nu=0, x \in \Omega \subset \mathbb{R}^2\\ \beta(x)>0$$ Integrate the PDE: $$\int_\Omega \partial_t u=\...