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.

1
vote
0answers
165 views

Double Integrating acceleration data to obtain position: 2 Problems

I have a data sample from an accelerometer from my phone (pretty bad accelerometer though). I'm trying to double integrate it in order to obtain the position as a function of time. I'm using a program ...
1
vote
0answers
191 views

1d turbulent energy spectra in homogenuous direction (non-isotropic)

I am trying to compute the one-dimensional energy spectra for my channel-flow simulation. I have already written a post-processing script to achieve this, however I need to validate my code before ...
1
vote
1answer
52 views

Calculating a limit as parameter goes to infinity

I have a fair background in pure mathematics and right now my project is a numerical implementation of a certain algorithm. I have some numerical background, but not all that much, so the question is ...
1
vote
0answers
324 views

How accurate is cumtrapz in MatLab?

Say I have a set of discrete acceleration data and want to integrate it to get a set of velocity data. How accurate is the cumtrapz (Cumulative trapezoidal ...
4
votes
1answer
127 views

Stability of PDE Discretizations with Multistep Time Discretizations

Let's pretend we have a spatially discretized PDE of the following form: \begin{align} \frac{\partial^2 \boldsymbol{u}^k}{\partial t^2} = D\boldsymbol{u}^k \end{align} where $D$ can be any form for ...
0
votes
1answer
382 views

Set of linear ordinary differential equations with a mass matrix

What methods are known for efficiently solving a large set of linear homogeneous ordinary differential equations of the following form? \begin{equation} \mathbf{B} \frac{d\mathbf{y}}{dt} = \mathbf{A} \...
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 ...
3
votes
1answer
67 views

Legendre expansion of $r(x) = f(x)/g(x)$ using a finite number of samples from $f(x)$ and $g(x)$

I have two finite sets of events $\{x_1, ..., x_N\}$ and $\{y_1, ..., y_N\}$ that are sampled from the PDFs $f(x)$ and $g(x)$, respectively, where $x \in [-1,+1]$. I want to estimate the Legendre ...
1
vote
0answers
26 views

Simulation of a lens, insufficient points

I am simulating the propagation of a light pulse using the equation $$\frac{\partial}{\partial z}A=\frac{1}{2\cdot k_0}\nabla^2_rA$$ with $$k_0=\frac{2\pi}{\lambda_0}$$ The propagation with a step ...
0
votes
1answer
407 views

How to construct an ellipsoid using Ansys design modeller (or any other 3D CAD software) [closed]

I am working on numerical simulation of breast model to evaluate the use of thermal imaging for breast cancer detection. To do this I need to construct an ellipsoid rotated 30 degrees around y-axis ...
2
votes
0answers
590 views

Using RK2 Method to solve the simple harmonic oscillator of a horizontal mass on a spring (1D)

Being new to numerical analysis techniques, in particular RK2, I decided the best way to jump in is by using python to solve the well known mass-spring oscillator using RK2 techniques. My problem is ...
4
votes
2answers
67 views

Bounded approximation to a bounded function

I have a non-negative function $f(x) \ge 0$ defined on the interval $[a,b]$. I would like to have a finite-dimensional approximation to this function that is guaranteed to be non-negative on $[a,b]$. ...
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
0answers
54 views

How to do numerical computation of $L^p$ norm of a $p$ dimensional trigonometric polynomial

Id like to know methods for numerical computation of $L^2$ norm of a two dimensional trigonometric polynomial. I have the coefficients. If I want to compute the L^1 norm, I can do so by sampling in ...
5
votes
1answer
290 views

How can I interpolate $z_t = x(1-t)+y t$ with single-precision floats so that it satisfies $x\leq z\leq y$, $z_0=x$, $z_1=y$?

Given two (here and below: single-precision, IEEE 32-bit floats) normalized floating-point numbers $x, y$ (perhaps of reasonable range: my counterexamples don't have unusual magnitudes), and another ...
1
vote
0answers
229 views

Stability of nonlinear partial differential equation

I want to find an expression for the stability of the nonlinear Poisson equation. I know about von Neumann stability analysis which applies to linear equations as far as I know. Any suggestion how to ...
0
votes
1answer
213 views

Example Problem to Demonstrate BiCGStab

So our team has been able to code up a BiCGStab implementation for a class project, and we'd like a potential example problem to try it out on. So far, we've talked about a 1D Laplacian with Neumann ...
1
vote
0answers
72 views

Quadrature in finite element methods | How should I compute integrals involving the solution of the last time step?

Let $\Delta\subseteq\mathbb R^2$ denote the triangle spanned by $(0,0)$, $(1,0)$ and $(0,1)$ and $$\mathbb P_r(\Delta):=\left\{p:\Delta\to\mathbb R\mid p(x)=\sum_{|\alpha|\le r}\lambda_\alpha x^\alpha\...
1
vote
1answer
145 views

Trouble getting steady-state solution by solving system of nonlinear algebraic equations in MATLAB

Background I have a stiff system of 6 ODEs, represented in MATLAB as follows: ...
5
votes
0answers
276 views

Convergence rate of Picard iterations

Given a first order ODE $y'(x)=f(x,y)$ with the initial condition $y(x_0)=x_0$ such that it satisfies Picard thoerem of existence and uniquness, one can compute the solution by Picard iterations : $$ ...
2
votes
1answer
100 views

Solving a system of DAEs versus ODEs (which is preferable)

Assume I have the following system of equations. I am trying to figure out if it's better for me to be solving this as a system of ODEs or as a system of DAEs. The real code can have up to a dozen or ...
2
votes
1answer
103 views

Another way to evaluate the gravitational force from a uniform cube?

Appendix A of Liu, Baoyin, and Ma (2011) Equilibria, periodic orbits around equilibria, and heteroclinic connections in the gravity field of a rotating homogeneous cube shows an analytic expression ...
1
vote
0answers
115 views

Eigenvalues using QR iteration

I'm trying find the eigenvalues of a matrix A using QR iteration with Householder. I used this code which I found from Cornell University that decomposes QR with Householder. ...
3
votes
2answers
217 views

Given x,y,z data of a periodic object, calculate the period of the object (if possible)

So the problem I am working on is as such. Given the x,y,z data of a periodic object over time (from the origin in 3d space) (need not be uniform), calculate the period of the object (if the data ...
1
vote
0answers
62 views

Discretization of a multi-function term

I'm trying to do discretization to the following system: $\frac{{\partial \rho }}{{\partial t}} = - \frac{{\partial \rho }}{{\partial x}}u - \rho \frac{{\partial u}}{{\partial x}}$ $\frac{{\partial ...
8
votes
2answers
222 views

Compute powers close to zero

What is a simple way to compute $10^x - 1$ where $x$ is close to zero? Using exponentiation and then subtraction isn't good enough because the fractional part is very small compared to the one that ...
1
vote
1answer
100 views

Efficiently determine whether a curve intersects a given rectangle?

Suppose we have a straight line in Cartesian space such that $$ x_k = x_0 + k \delta x, \quad \quad y_k = y_0 + k \delta y, \quad \quad z_k = z_0 + k \delta z $$ where $k$ can take any real value. If ...
1
vote
0answers
77 views

Problem in analyzing the program of Gauss Jordan Inverse problem

I had to code a program which calculates Inverse of a matrix by Gauss-Jordan Inverse method , I was trying to analyse the program and then code it myself. the link http://hullooo.blogspot.in/2011/...
1
vote
0answers
80 views

How do we derive the elemental equation for Discontinuous Galerkin method using Centered Numerical Flux?

If we take a 1st order polynomial approximation in each cell, we can find the (2x2) -mass matrix, differentiation matrix, and flux matrix through the integration of Lagrange polynomials. However, I ...
1
vote
0answers
230 views

How to use “fill_factor” in spilu (scipy) [closed]

I am using spilu (incomplete LU decomposition for sparse matrix) in scipy: https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.sparse.linalg.spilu.html However there is an option call "...
4
votes
1answer
163 views

Is it possible to solve Euler equation numerically without using any flux limiter (in DG scheme)?

I have recently learned about Discontinuous Galerkin method to solve differential equations and I was trying to implement it to solve Euler equation. For now, consider the standard Sod Shock Tube Case....
1
vote
0answers
99 views

Smoothness indicator calculation for WENO methods

I am trying to calculate the smoothness indicators for the WENO methods using the method given by Jiang and Shu. $\beta_k = \sum_{l=1}^k \Delta x^{2l-1} \int_{x_{i-1/2}}^{x_{i+1/2}} \Big(\frac{\...
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 ...
2
votes
0answers
210 views

How to impose Neumann boundary conditions in finite volume problems?

I'm trying to better understand finite volume methods and have started coding up a basic script to solve the diffusion equation $$u_t = u_{xx}$$ which has the finite volume form: $$\frac{\bar{u}^{n+1}...
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/...
1
vote
2answers
101 views

Trotter expansions in ode solver?

Trotter expansions say: $$ e^{A+B} = \lim_{P\to\infty} \big(e^{A/2P} e^{B/P} e^{A/2P} \big)^P. $$ With $P = 2$, it becomes (with high accuracy) $$ e^{A/4} e^{B/2} e^{A/2} e^{B/2} e^{A/4}. $$ Let's ...
2
votes
0answers
76 views

Literature on numerical solving based on multiple meshes?

Consider solving a differential equation system for 1D, 2D, or 3D. It involves various input and output "field" variables, which, more often than not, correspond to various physical quantities ...
1
vote
1answer
196 views

Numerical Free Fall Analysis with RK4

I am trying to calculate real speed and time in free fall of a body. I wrote a code in Fortran and I am trying to improve it by using RK4 method x=time y=total free fall Purple line using: ...
4
votes
1answer
80 views

Finding Numerical Stability of Simple System with Integral Term Due to Low Pass Filter

As a toy problem, I was looking at a classical second order system of the following form: \begin{align} \ddot{x}(t) + c \dot{x}(t) + k x(t) = 0 \end{align} Instead of the basic system above, I want ...
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(\...
8
votes
1answer
498 views

Time discretization of the variational formulation of the Navier-Stokes equation

I've asked this question on mathoverflow too. Let $T>0$ $I:=(0,T]$ $d\in\mathbb N$ $\Lambda\subseteq\mathbb R^d$ be nonempty and open, $$\mathcal V:=\left\{\phi\in C_c^\infty(\Lambda,\mathbb R^d):...
7
votes
3answers
351 views

ODE $x''(t)+\eta x'(t)+x(t)=0$ with the $\eta$ extremely small

I want to numerically solve the damped oscillator equation $$\frac{d^2x}{dt^2}+\eta\frac{dx}{dt}+x=0 .$$ Usually it's very easy to solve this kind of ODE analytically and numerically. But now the ...
1
vote
2answers
141 views

Numerical optimization algorithm with approximated derivatives

Suppose I have a energy functional E depending on X, where X is a N-dimensional real value vector and N could be very large (~=2000). I assume that there exists (at least) a (local) minimizer for E. ...
2
votes
1answer
184 views

Software/code to extract a solenoidal (a.k.a. divergence-free) field from a 2D vector field numerically

Can somebody point me to software/code to extract a solenoidal (a.k.a. divergence-free) field from a 2D vector field numerically? There are a plethora of papers and documents describing how to do ...
1
vote
1answer
90 views

If I discretize a PDE in space with WENO and in time with an implicit method, do I need to solve a nonlinear algebraic system at each time step?

I am attempting to solve a nonlinear advection diffusion equation $$\frac{\partial u}{\partial t} = \frac{\partial}{\partial x}(\frac{\partial u}{\partial x} + u^2)$$ with Robin boundary conditions ...
4
votes
2answers
117 views

In numerical methods, eg, finite differencing approaches, does there exist convergent schemes that are not both consistent and stable?

In a book that our course is following this semester, the theorem given is only in one direction: if the scheme is both consistent and stable, then the scheme is convergent. However, since this ...
1
vote
1answer
161 views

How to correctly define the flux in a finite volume method for Poisson's equation with a piecewise constant material

How do we correctly define the flux in a finite volume method applied to Poisson's equation where we have a piecewise constant material? Specifically, say we have the equation \begin{align*} -\nabla\...
0
votes
1answer
118 views

Initial Condition in a Numerical Problem

In a initial value problem does the initial condition has to satisfy the boundary condition and the governing equation? For example: If a non-homogeneous Neumann boundary condition for the pressure ...
1
vote
1answer
162 views

Converge rate analysis: issue with time convergence

I have written a code which solves the incompressible formulation of the Navier-Stokes equations. It uses high-order methods both for time and spatial derivatives. I have been conducting convergence ...
4
votes
2answers
159 views

Failing integration with the radau5-implementation in DotNumerics, over a discontinuity

Summary We are trying to solve some models of emission of substances to the air. In these models, emission stops at a certain point. We are using the DotNumerics implementation of radau5 We had ...