We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [numerics]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
2answers
261 views

Boundary conditions for streamlines in enclosed flow

I am trying to solve Lid driven square cavity flow problem of Stokes equation using finite element method. I have boundary conditions for velocity as zeros on every boundary but u=1 on top boundary. ...
2
votes
1answer
122 views

How to deal with numerical errors in electrostatic field calculations

I want to trace electrostatic field lines emerging from 2D surfaces in 3D space. Eventually I want to find their intersection with an (uncharged) mesh. The charge distribution $\sigma(x), x \in \...
0
votes
3answers
144 views

How to determine a PDE which is structure-preserving (energy, mass conserved)?

How to determine if a PDE is structure-preserving (energy,mass conserved)? Are there some standards in judging the preserving-structure? Or rather, how to derive the formulation of energy-preserved ...
1
vote
3answers
668 views

Pressure boundary condition in lid driven cavity using finite element method

Thank you all 1.) I am trying to solve lid driven cavity problem for an incompressible Stokes and Navier Stokes equations using general "Mixed" finite element method. dirchlet boundary conditions are ...
1
vote
0answers
75 views

Computing the change of function at two close points without cancellation

I want to compute the difference $\Delta f(x_1,x_2) = f(x_1)-f(x_2)$ of a smooth function $f(x)$ at two points $x_1$ and $x_2$ which are close to each other. The magnitude of the expected result, $|\...
1
vote
0answers
49 views

Discrepancy in estimating boundary stencil for finite difference method

I am trying to estimate the FD stencil for boundary as mentioned in this paper (section 4.1) using MATLAB. The stencil order (6th) is higher than the one mentioned in paper (4th). $$ f_1' +\alpha f_2'...
2
votes
2answers
461 views

Runge Kutta (RK4) to solve coupled harmonic oscillators [duplicate]

I have the same problem as in this question. But can someone elaborate on the answer? The poster says that: Solving this system of 4 ODE's with rk4 will solve for all your state variables ...
0
votes
1answer
295 views

Trying to plot 1D wave equation for benchmarking

I am trying to plot a reference solution for the 1D wave equation using python. The above link states the following: For a rod fixed at the right end and free at the left end and subjected to a ...
3
votes
2answers
373 views

Difference in performance of preconditioned GMRES and MINRES

I have two matrices $A, B$ coming from a finite element discretization of a system of partial differential equations. $A$ represents the system matrix and is symmetric and indefinite. $B$ is symmetric ...
0
votes
1answer
555 views

How can this multidimensional integral be efficiently implemented in python using Gauss-Hermite quadrature

I'm playing around with dynamic programming and need to calculate a multidimensional integral $E[V(W)]$ where we assume $W$ has a log normal distribution. I was looking at the following example in ...
1
vote
2answers
146 views

How to deal with big numbers in intermediate calculations?

I have a rather long expression (https://pastebin.com/jUsxdCCs) that is an analytical solution of a set of differential equations generated symbolically from Maple. I need to solve a set of equations ...
-1
votes
1answer
1k views

Using scipy.odeint to solve coupled equations [closed]

I have a set of three coupled autonomous equations: ${y_{1}}\prime = y_{1}(\frac{\Omega_{m}}{y_{1}^3} + \frac{y_{3}^2}{6.0} + \frac{V(y_{2})}{2.H_{0}^2})$ $y_{2}\prime = y_{3}$ $y_{3}\prime = -3\frac{...
1
vote
0answers
145 views

Time-dependent Schrodinger equation(time-dependent Hamiltonian)

This question was already asked here and this is a suitable form of the equation for numerically solving. \begin{align*} i\frac{\partial}{\partial t}u_{\ell}(r,t) = \Bigg(-\frac{1}{2} \frac{\partial ^...
4
votes
3answers
1k views

How to solve the transcendental equation: $\tan(x) = \frac{2x}{x^2-1}$

I'm interested in finding the roots of the following equation: $\tan(x) = \frac{2x}{x^2-1}$. It is easily seen that 0 is a root and the roots are symmetric w.r.t. 0. I wonder if an analytical ...
1
vote
0answers
225 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
1answer
285 views

1-D turbulent energy spectra in homogeneous 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
56 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
404 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 ...
3
votes
1answer
134 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
544 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
259 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 ...
2
votes
1answer
69 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
29 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
675 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
929 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 ...
3
votes
2answers
68 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]$. ...
9
votes
2answers
464 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 ...
3
votes
0answers
61 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 ...
4
votes
1answer
383 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 ...
0
votes
0answers
322 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
261 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
73 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
207 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: ...
4
votes
0answers
343 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
105 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
122 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
57 views

Growing error from a smooth initial condition for Fisher KPP equation

I'm studying the Fisker-KPP equation on the line (and in $]0, 100[$ numerically): $$ \partial_t u = \Delta_{xx} u + u(1-u) $$ I notice a behavior I don't understand with a smooth initial condition $...
1
vote
0answers
131 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
229 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
63 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 ...
7
votes
2answers
229 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
101 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
86 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
91 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
352 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 "...
3
votes
1answer
183 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
131 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{\...
6
votes
1answer
204 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 ...
1
vote
0answers
286 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}...
2
votes
2answers
392 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/...