Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [numerics]

The tag has no usage guidance.

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

Physical interpretation of divergence theorem

In a diverging pipe section like the following, Pipe of radius r, splits into two pipes of radius r/2. Consider a solute transported by convection from node 1. $$\frac{\partial C}{\partial t} = - v\...
-1
votes
1answer
35 views

Integrate using Composite Simpson's rule

In a question, we have been given the speed of a car at time t= 0,2,4,6,.......,20 minutes.But it asks us to approximate the distance travelled by the car in 30 minutes using Composite Simpson's rule. ...
0
votes
0answers
29 views

Coding of density of states of a 2D square lattice in python [closed]

I want to get python code for the calculation of density of states. I am very new on coding. Can anyone help me out this situation?
0
votes
0answers
47 views

Problem with rate of convergent of numerical scheme for hyperbolic conservation law

I need help to verify my code in C++ that developed to solve the Burgers equation $$\\u_t + (\frac{u^2}{2})_x =0$$ $$u(x,0)=\sin(\pi x),\text{ } -1\leq x \leq 1$$ using a third-order ...
1
vote
1answer
68 views

Solve linear system with Newton-Raphson method

Is it possible to solve a linear matrix system $A x = b$ using the Newton-Raphson method? If yes, how can this be done? More special, how is the derivative build?
-1
votes
1answer
26 views

Recursive Algorithm to Calculate Determinant via Expansion of Minors in C#

I have been recently trying to attempt to write an algorithm in C# that would calculate the determinant of a matrix via recursion using the expansion of minors method. I understand that there are ...
2
votes
0answers
52 views

What exactly is the cause(s) of blow-up for too-large step size in a method like RK4?

I have been working on creating a few home-made numerical methods, and I am using them to visualize text-book problems from my Strogatz dynamics textbook. It feels like a good way to learn numerical ...
-1
votes
0answers
10 views
0
votes
0answers
21 views

Interpreting results of using no-flux boundary condition

I am solving for solute transport in 1 D. $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2} - v\frac{\partial C}{\partial x}$$ No-flux boundary condition is imposed at both the ...
1
vote
1answer
58 views

Implementing Robin Boundary condition (finite difference)

I'm interested in applying Robin boundary condition to a convection-diffusion problem in 1D. In the following system, $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2} - v\frac{\...
2
votes
0answers
71 views

Extracting FEM matrices in matlab pde toolbox

I am trying to follow the dynamic linear elasticity in Matlab, link here. My goal is to extract the FE Matrices using the function assembleFEMatrices in matlab and solve the resulting system of second-...
-1
votes
1answer
90 views

Imposing periodic boundary condition for linear advection equation - Node problem

I've spent the whole day trying to figure out what is the correct way to impose (and implement) periodic boundary conditions $u(0,t)=u(1,t)$ for all $t>0$ for the simple advection equation $u_t + v ...
0
votes
1answer
61 views

Robin Boundary Condition with Implicit Upwind - Finite Difference Method for 2D Convection-Diffusion Equation

I am trying to solve a problem with 2D Convection-Diffusion equation with U = Concentration ($mg/m^{2}$) using Implicit Upwind Finite Difference Method like this $$ \frac{\partial U}{\partial t} + ...
-2
votes
0answers
65 views

2D Heat equation - MatLab implementation (FD in space, Expl. Euler in time)

I'm trying to solve the heat equation in 2D in $\Omega=[0,1] \times [0,1]$, with homogeneous Dirichlet boundary conditions, and initial condition $u(x,y,0)=\sin(2 \pi x y)$ i.e. \begin{cases} u_t=u_{...
1
vote
1answer
69 views

Runge-Kutta fourth order method. Integrating backwards

I am using a Runge-Kutta fourth order method to solve numerically the usual equation of motion of a background scalar field in curved spacetime with a quartic potential: $\phi^{''}=-3\left(1+\frac{H^{...
1
vote
1answer
65 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
57 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
50 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
111 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
46 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
51 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
32 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
63 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
64 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
84 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
1answer
121 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
82 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
79 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 ...
4
votes
0answers
97 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
47 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
66 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
334 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
90 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
73 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
143 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
62 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
163 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
38 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
92 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}...