All Questions

Filter by
Sorted by
Tagged with
3
votes
1answer
295 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
2answers
440 views

Graphing electric potential of a ring of charge using MATLAB help

Here is a summary of what I am trying to do: Use MATLAB to compute the potential $V$ at any point $(x, y, z)$ in space due to a uniform ring of charge. Use a Riemann sum to compute the integral ...
3
votes
2answers
152 views

Generate Random Number outside Bounds:

Say I have a random number generator that generates a number within [0, RAND_MAX], and RAND_MAX < UINT_MAX. How do I ...
3
votes
5answers
1k views

Speed of solving linear system with block diagonal matrix

I have a bunch of 3x3 linear systems of the form $Ax=b$. In general, would it be faster to solve each individual system, or to formulate it as a giant block diagonal system and solve that? I expect ...
3
votes
0answers
380 views

On solution of a class of discrete-time Lyapunov equation for systems with multiplicaitve noise

Let's consider the following equation $$X=F_{1}XF_{1}^{T}+...+F_{p}XF_{p}^{T}+C$$ where $p$ is an positive integer and $C$ is a known positive semidefinite matrix. If we augment $F=[F_{1}...F_{p}]$ ...
3
votes
1answer
302 views

Designing a preconditioner for a very Ill-conditionned matrix

I am a physicist with limited numerical methods knowledge and I am trying to speed up the inversion of a very ill-conditioned problem ($rcond>10^{30}$). The same sparse square matrix is used ...
3
votes
2answers
2k views

Subgradients of non-convex functions

In these notes (section 2.3), it is stated that: A point $x^*$ is a minimizer of a function $f$ (not necessarily convex) if and only if $f$ is subdifferentiable at $x^*$ and $0 \in\partial f(x^*).$ ...
3
votes
1answer
1k views

Solving a Nonlinear BVP using Finite Difference Method

I am trying to write a code to solve a nonlinear BVP using the Finite Difference Method. The BVP is: $(T^2)\frac{\partial^2 T}{\partial x^2} + T \left( \frac{\partial T}{\partial x}\right)^2 + Q = 0$ ...
3
votes
1answer
155 views

Derivatives of Approximate Matrix inverses

I am cross posting this question to the mathermatics stack exchange. please find it either at this link, https://math.stackexchange.com/q/2952989/430980, or below: I have a question concerning the ...
3
votes
2answers
317 views

Nanoseconds vs. picoseconds in numerical quantum problems with Matlab ODEs

Hello there and thanks for taking a look at this problem. This problem is related to my previous question and I will therefore use a similar introduction from, Choice of step size using ODEs in ...
3
votes
1answer
620 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
1answer
717 views

Add User-defined/custom differential equations in OpenFoam (CFD)

I am new to OpenFoam. And I am trying to add a set (user defined) of differential equations to OpenFoam. I want to solve this user defined set of equations at each time point in addition to standard ...
2
votes
2answers
249 views

Solve a very large linear system (question about a library linear algebra to do this)

I need to solve a very large linear system (coming from finite element method). I'm currently using the Intel MKL library, but the system has been delayed more than 20 hours. The matrix of the system ...
2
votes
1answer
1k views

Derivatives Approximation on non uniform grid

I was trying to approximate 1st derivative of a function $\phi$ on a non uniform grids: basically my aim is to do this on a uniform grid on the same domain, so I can calculate it on the "new" grid. ...
2
votes
1answer
2k views

Parallel vs Serial Thomas Algorithm

I am currently writing a code that solves a large tridiagonal matrix every iteration and runs for 1,000's of iterations. I am currently using a Thomas algorithm to solve the matrix serially. I found a ...
2
votes
1answer
340 views

Analytical Solution of Transport Equation

I'm looking at the analytical solution of the convection-diffusion equation $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2}-v\frac{\partial C}{\partial x}$$ with initial ...
2
votes
3answers
3k views

How to avoid the round-off errors in the larger calculations?

Now I need to sum up more than one thousands of terms and then make the four-dimmensional integral in my Fortran program. I found that there are some numerical errors. Can you give me some suggestions ...
2
votes
2answers
247 views

Automatic Differentiation - reverse accumulation of linear system solve

I am studying the reverse mode of automatic differentiation. The reverse mode of automatic differentiation allows the efficient computation of a the derivative of a single dependent variable $y$ with ...
2
votes
0answers
95 views

C++: How to find the roots of polynomial modulus N [duplicate]

I need to know what library, given a vector of coefficients and modulus N return the roots of polynomial modulus N. The library should support big integer. I'm coding in C++.
2
votes
1answer
136 views

Boundary conditions in a finite element eigenvalue problem

I've been reading multiple papers and related posts for a while now, but I can't seem to find a specific answer to the issues I'm having so I hope someone can clarify things here. I'll provide some ...
2
votes
1answer
80 views

How to add extra constraints to a linear system for probabilities?

Background: I have an equation which looks like as follows: $W \times P = R$ $$\left[\begin{array} &{1}&{0}&{0}&-\frac{w_{1}}{w_{o1}} &\dots &{0} &-\frac{w_{1}}{w_{0} } \...
2
votes
1answer
294 views

Numerical integration of a function whose expression is unknown

I want to compute the value of an integral of a function. This function, however, is not given by a formula, say $f(x) \: \forall x \in [0,1]$, but is only known through its values on some given ...
2
votes
2answers
670 views

Schrödinger equation with time dependent Hamiltonian

I need to solve the Schrödinger equation with a time dependent Hamiltonian $$i\hbar \frac{\partial}{\partial t} \Psi = \left[-\frac{\hbar^2}{2m}\nabla^2 +\frac{1}{2} k(t)(x^2+y^2) + V(r)\right]\Psi $...
2
votes
2answers
372 views

computing Newton-Cotes weights

For the closed Newton-Cotes quadrature over $[x_1, x_n]$, the coefficients $H_{n,i}$ for $$ \int_{x_1}^{x_n} f(x)\:\text{d}x = h \sum_{i=1}^n H_{n,i} \; f(x_i) $$ are given explicitly by $$ H_{n,r+1} =...
2
votes
1answer
2k views

2D cross section from 3D surface

I am trying to apply the "restoring force surface" method to a dynamic linear system. The idea behind this method is that, knowing acceleration, displacement, velocity and input force it is possible ...
2
votes
2answers
367 views

2d Euler manufactured solutions

Where can I find manufactured solutions for the 2d Euler equations, with the complete analytical terms, including the Jacobian of the source term ?
2
votes
2answers
118 views

General Lagrange basis formula (usual problem in finite element context)

It is easy to prove that, $$\{p_1(x,y)=1-x-y\;,\;p_2(x,y)=x\;,\;p_3(x,y)=y\}$$ is a Lagrangian basis of $\mathbb{P}_1(\hat{T})$ (polynomials of total degree less that 1 living on $\hat T$), where $\...
2
votes
0answers
61 views

How can I numerically solve a saddle point problem with repeated constraints?

I am interested in numerically solving the following constrained minimization problem; Find the value of $x\in \mathbb{R}^n$ that minimizes $f$ where $f\colon \mathbb{R}^n\to \mathbb{R}$ is defined ...
2
votes
2answers
154 views

Preconditioner for scalar laplacian system

Suppose that I have a large (on the order of 10^6 unknowns) 3D scalar Poisson system which I would like to precondition. The boundary conditions have been treated so that the system is SPD. I.e., $$\...
2
votes
2answers
1k views

visualization of 3D probability flow

I have a master equation for $P(N_A^+,N_B^+,N_C^+,t)$, with $N_A^+,N_B^+,N_C^+$ all discrete. The numerical integration is done by this Matlab program using Euler's method. Despite the crude Euler's ...
2
votes
0answers
71 views

Efects from the boundary in advection equation [duplicate]

I am implementing the advection equation $u_x+(1/c)u_t=0$ following a Crank-Nicholson finite difference scheme. The equation for this is \begin{eqnarray*} -\frac{\gamma}{4} w_{n-3 j+1} + w_{n-2 j+1} ...
2
votes
1answer
4k views

Plot a surface from data sets in MATLAB

I tried to plot a surface in MATLAB but, since it is the first time I had to do something like this, I need a confirmation on the process I followed because it is important for my project to plot the ...
2
votes
1answer
120 views

Prevent single node spikes in a FEM-simulation (using continuous Galerkin)

I am trying to solve a non-linear time-dependent heat equation $$\partial_tT=\nabla \left(k_T(T)\nabla T\right) + f$$ (similar to question Solving a non-linear heat equation with the galerkin method ...
2
votes
3answers
1k views

stop condition in scipy.integrate.ode for stiff system

I'm using Python scipy.integrate.ode, and I want to stop my integration at a certain condition. So I use the integrator "dopri5" and use the method "set_solout" to specify a function for my stop ...
2
votes
2answers
338 views

Integration of a diverge function in c++ GSL Library

I am trying to perform an Integral of Hypergeometric function 2F1(a,b,c,x) from -1 to 1 for some good values of $a,b,c$ (lets say $a=1,b=2,c=3$) . I did it in ...
2
votes
1answer
70 views

Computation of equivalent thermal resistance and thermal capacitance from FE model

I need to compute the equivalent thermal resistance and thermal capacitance of a structure used for heat transfer. For illustration purpose let’s say it’s the 2D problem of the following figure. In ...
2
votes
0answers
65 views

Solving a nonlinear equation with a Markov process and RVs

Assume that we have the following equation and the following assumption. The scope is to solve for some particular variables expressed later. Update $$E_{t}\left[ b(A_{t+1})^{1-\gamma} *R_{t+1}^{-\...
2
votes
1answer
149 views

Question on how MATLAB's pdepe solver works

I'm solving the following 1D transport equation in MATLAB's pdepe solver. $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2}-v\frac{\partial C}{\partial x}$$ At the inlet (left ...
1
vote
1answer
1k views

Convex Polygon Intersection

Determining the intersection of two convex polygons is one of the fundamental problems in computational geometry . I'm asking for an algorithm having: INPUT: Given two convex polygons P and Q in 2D (...
1
vote
0answers
59 views

Discretization used for steady linear elasticity - followup to previous question

This is a follow-up of my previous scicomp question (https://scicomp.stackexchange.com/posts/28863/edit). I figured I'd start a new thread on this as the question is a bit different from my previous ...
1
vote
1answer
110 views

How to compute turbulent energy cascade

I need to compute the kinetic energy cascade using a finite volume solution in an equally spaced grid. I wonder if it is more correct to first compute the kinetic energy in the space (or time) domain, ...
1
vote
2answers
103 views

Writing a single PDE from a gradient equation

I have a differential system like this, where $\Phi$ is a scalar valued unknown function: $$\nabla\Phi = \left(f_1(x, y), f_2(x,y)\right)^T$$ I'm trying to solve it in a FEM solver (COMSOL ...
1
vote
1answer
185 views

Use SLEPc from Matlab

Is there a direct way to use SLEPc from Matlab? I remember that in some old manuals there was some Matlab interface. However, in the last one, I cannot find any reference to this. For me, it would be ...
1
vote
1answer
204 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 ...
1
vote
1answer
975 views

Improper Numerical integral

I am self teaching myself python and computational physics via Mark Newmans book Computational Physics the exercise is 5.17 of Computational Physics. I have to shift the limits of integration for an ...
1
vote
2answers
401 views

What method do you suggest to solve this minimax, quadratic in both variables problem?

I have a problem of the form, \begin{align} minimize_{y} maximize_{x}&\quad x^T y - y^T (B\odot x x^T) y\\ s.t. &x\in [l,u]\\ &Ay=b \end{align} How to efficiently solve this problem? ...
1
vote
0answers
65 views

Determine Lagrange nodal variables of a simplex $T$

Consider a simplex $T$ in $R^d$ with $N_1(T) = \left\{N_i\right\}_{i=0}^{d}\subset P_1^{*}(T)$ be the Lagrange nodal variables (or nodal evaluation). By the Riesz representation theorem, there exist ...
1
vote
1answer
29 views

Four-noded rectangular element shape functions

I works on a project where I need to compute a modal analysis of an acoustic cavity. The cavity is rigid which translates the problem to the following equation $$\frac{\partial^2p}{\partial{}x^2}+\...
1
vote
1answer
97 views

Crank-Nicholson for diffusion-advection vs diffusion equation

Let's consider the following 1D diffusion equation: $\frac{\partial u}{\partial t} = xk \frac{\partial}{\partial x}(\frac{1}{x}\frac{\partial u}{\partial x})$ where we assume that the diffusion ...
1
vote
2answers
107 views

Solving a parameter estimation problem using trajectory optimization

This is a follow-up to my previous question here I've the following system of equations for studying information flow in the below graph, $$ \frac{d \phi}{dt} = -M^TDM\phi + \text{noise ...

15 30 50 per page