All Questions
9,344
questions
0
votes
0answers
3 views
Shape recognition of tangientially connected polygons using openCV
Lately, I have encountered the following problem, namely how to recognize the shapes of particular polygons. I have realized that quite straightforward to do so when the polygons are separated by ...
0
votes
1answer
13 views
How to solve a Stiffness matrix?
I am quite new in this field. For my university I prepared a stiffness matrix to solve for a project group. This matrix consists of 450 equations with 450 unknows (it's a Matlab script) and I have the ...
0
votes
1answer
16 views
Solve for large array of PD matrices
I have N matrices that are positive definite, and I have to solve for a M vectors.
As M is large in my case, doing all solves simultaneously using np.linalg.solve ...
0
votes
0answers
12 views
Error estimation in perturbative term of ode approximate solution
I've implemented a code which allow me to find the solution of a perturbed orbit (3-body system) and I was wondering how could I find the numerical error caused by the method I'm using (Runge-Kutta 4)....
1
vote
0answers
36 views
Model and solve nutrition optimization problem: how to?
How to solve/assess the following problem?
Given: $N$ ingredients like apples, bread etc. Mass of an ingredient $j$ is in this simplified model a sum of macro nutrients carbohydrates, proteins and ...
3
votes
1answer
68 views
Adaptive Lagrangian-Eulerian methods and practical benchmark results
Does anyone know of any published study that talks about the practical aspects of running Adaptive Lagrangian-Eulerian techniques for solid and/or fluid mechanics problems?
I'm looking for things ...
3
votes
1answer
111 views
Fast Multipole Method (FMM) 3D (Laplace)
While implementing the Multipole-to-Multipole translation (M2M) with the following equation,
$$\phi(P) = \sum_{j=0}^\infty \sum_{k=-j}^j \frac{M_j^k}{r^{j+1}} Y_j^k(\theta,\phi)$$
where,
$$M_j^k=\...
1
vote
0answers
21 views
Understanding Illumination Optimisation Problem
I am a newbie to convex optimisation and I am learning with the aid of CVXPY. I am requesting for clarity on the illumination problem as described in Boyd & Vandenberghe lecture 1 slides here. I ...
0
votes
1answer
48 views
Verification of order of convergence of Implicit Euler Method to numerically solve Black-Scholes PDE
I'm trying to verify the order of convergence for implicit Euler method to numerically solve Black-Scholes PDE. Theory says that it should be $O(\Delta t + \Delta S^2).$ My code is working absolutely ...
0
votes
0answers
12 views
high order harmonic generation [closed]
I want to simulate the high order harmonics spectrum; target atom is Hydrogen; driving laser is a Ti:Sapphire laser with 800nm wavelength; Its electric field strength is 0.05 a.u..
I do not have cut ...
2
votes
2answers
153 views
+100
Matlab - Compute approximative common eigenvectors basis between two matrices as a function of tolerance
I am looking for finding or rather building common eigenvectors matrix X between 2 matrices A and B such as :
...
-1
votes
0answers
12 views
Simulating a combustion process
I want to try simulation-(and not experimental)-driven approach to design custom fireplace fuel burners.
What software applications, libraries, code and model templates can I use to model and ...
0
votes
1answer
34 views
Algebraic multigrid as solver and as preconditioner
My question is around the efficiency of AMG. In which case AMG can perform better,as solver or as a preconditioner(for example a Krylov space method as CG)? Assume the case of elliptic pdes.
0
votes
0answers
22 views
When to stop iterations in SOR solver for 3D Poisson equation
I'm writing a solver (in C) for 3D incompressible fluids, using the finite-differences method, and I'm finding a somewhat surprising behaviour: the solver provides "good-looking" solutions, ...
-1
votes
1answer
61 views
Solve integral $ \int_{-\infty}^{\infty} e^{-x^2}dx$
i trying to solve this integral
$$\int_{-\infty}^{\infty} e^{-x^2}dx$$
I'm using this
CODE
...
3
votes
1answer
148 views
similarity/distance measurement between two ranked sequence
Is there an efficient way to measure similarity/distance between two sequences of ranked numbers/letters. The two sequences are of different length, and only have some elements in common?
For example,...
1
vote
0answers
12 views
Minimize MAE for sum of powers
The model is
$$y_i=\beta\big(x_{i1}^\alpha+x_{i2}^\alpha+...+x_{im_i}^\alpha\big)+\epsilon_i\textrm{ for }i=1, 2, ..., n$$
I want to minimize the MAE, i.e.
$$\Sigma_{i=1}^n{\big|y_i-\beta\big(x_{i1}^\...
-1
votes
0answers
12 views
I need help to code logical exor funtion in C++ [closed]
[![logical exor funtion][1]][1]
I'm done on the first definition where input is two intergers in a logical exor funtion. Now I have no idea on how to do it binary integers in a dynamic array. Please ...
0
votes
1answer
248 views
Gmsh for .inp file
How do I get an .inp file from Gmsh? I need to create a simple geometry and mesh it and define the boundary conditions in Gmsh and export it as an ...
5
votes
2answers
104 views
Exponent log to compute reciprocal power?
A MATLAB library seems to overcomplicate a computation:
exp( (log(a) - log(b))/b )
which is mathematically equivalent (assuming real & positive ...
3
votes
1answer
81 views
How frequently scientific code uses comparisons NaN == NaN?
How frequently scientific code uses comparisons NaN == NaN?
Reason of asking: from time to time compilers / software floating-point library implementations have ...
2
votes
1answer
43 views
How to Invert a Poorly Conditioned Matrix
In my research, I need to invert a Fisher matrix in order to get a covariance matrix for me to do parameter estimation. Unfortunately, the values of Fisher matrix vary by many orders of magnitude, and ...
0
votes
0answers
38 views
Is there a commercial program to compile a Finite Element Fortran program (1980)?
The fortran used come from Montreal Ecole polytechical in 1980
I need some thing that can read fortran and compile it in a Windows 7 or windows 8 operating system.
6
votes
3answers
2k views
Need for quad precision in scientific computing?
Even if quad precision is not directly supported by most CPUs, many Compilers (GNU, Intel) support them. Also some software packages allow to compile with quad precision, e.g. PETSc. But is there ...
-1
votes
0answers
53 views
Running numerical hydrodynamics simulation on Apple Silicon M1?
My PC just broke and I'm looking for a replacement and thinking about getting the Apple Mini M1. But I need to run PLUTO CODE, an numerical hydrodynamics simulation, do anybody knows if this will run? ...
1
vote
0answers
33 views
Computing matrices for Model Predictive Control
In model predictive control, an optimization problem is solved at every time instant and it is very common to write down the matrices in a compact form. Without going into the details of the ...
3
votes
1answer
34 views
Algorithm to merge two polygons (using connectivities)?
I am struggling with implementing an algorithm that does one simple thing:
Consider two polygons (one can just draw any two polygons and number their vertices), whose connectivities in a node list are:...
11
votes
1answer
241 views
How to compute Singular value decomposition of a large matrix with Python
Language: Python3
Problem: I have a matrix Q of shape [51200 rows x 51200 cols] stored in a binary file, each of the element in this matrix has a data type of complex64. To load the data into memory I ...
2
votes
1answer
44 views
Why is CVXPY throwing a DCP error with cp.sqrt but no error with cp.norm
I am trying to use CVXPY to optimise signal-to-noise-plus interference ratio (SINR) for a visible light communication (VLC) system. I have one of my SINR constraints stated as
\begin{equation}
\...
3
votes
1answer
41 views
Nonlinear root solving libraries which accept a Jacobian in band-storage
I'm in search for a library for solving large systems of non-linear equations, similar to MINPACK, but unlike MINPACK, can accept a Jacobian in band-storage.
My Jacobian is sometimes not invertible, ...
8
votes
2answers
8k views
Use of machine learning in computational fluid dynamics
Background:
I have only built one working numeric solution to 2d Navier-Stokes, for a course. It was a solution for lid-driven cavity flow. The course, however, discussed a number of schemas for ...
1
vote
1answer
50 views
nquad Integration in SciPy
I am trying to self-learn SciPy and evaluate the following quadruple integral using scipy.integrate.nquad:
$$\int_{0}^{1} \int_{0}^{1} \int_{0}^{1} \int_{0}^{1-x} (...
0
votes
1answer
34 views
Implementing Dirichlet BC for the Advection-Diffusion equation using a second-order Upwind Scheme finite difference discretization
i am implementing a Matlab code to solve the following equation numerically :
$$
(\frac{\partial c}{\partial t} =-D_{e} \frac{\partial^2 c}{\partial z^2} +U_{z}\frac{\partial c}{\partial z})
$$
with ...
4
votes
1answer
163 views
Time Reversibility of Velocity Verlet Algorithm
I'm very new to computational Physics and am finding conflicting statements on whether the velocity Verlet algorithm, defined as:
$\begin{align}
x_{n+1} &= x_n + v_n \Delta t + \frac{1}{2} a_n \...
3
votes
1answer
255 views
Poisson image blending artifacts
I am trying to implement Poisson image blending as in the paper Poisson Image Editing. This is the task of filling in a masked region of an image by minimizing
$$\min_f\int_\Omega \left | \nabla f - \...
2
votes
1answer
62 views
Determining the voxels between two boundary surfaces
Issue description
I am working on human brain tACS simulations where I have the models of the skin, skull, csf, brain and ventricles in STL format. The shape does not matter and there are no ...
0
votes
0answers
11 views
How to convert this code to scan random datas instead of binned datas?
I am new to fortran and I am trying to write a code using random datas instead of binned datas in x, y, z as shown in my sample code.
...
3
votes
1answer
113 views
How to find a pair of divisors as close as possible to each other?
For a given integer $n\in\mathbb{N}^*$, I want to find a pair $(x,y)\in{\mathbb{N}^*}^2$ such that $x*y=n$ and $|y-x|$ is as small as possible.
A naive algorithm I found is :
...
3
votes
1answer
99 views
Quick way to find a common basis of eigenvectors between 2 matrices : valid or not?
Following the advise of @Federico Polonion a previous post, one suggested, to find a basis of common eigen vectors between 2 matrices, to simply do :
Generate 2 ...
0
votes
1answer
67 views
Compute 1st derivative with backward difference approximation in python
I am trying to write a function to compute 1st derivative with backward difference approximation. $ u'(x_i) = \frac{u(x_i) - u(x_i - \Delta_x)}{\Delta x} \equiv D_- u(x_i).$
And for the first point, ...
0
votes
0answers
24 views
Estimating the Jacobian in Harmonic Balance Method
I am trying to solve a set of ODEs using the Harmonic Balance method. In order to do this, I need to compute the Jacobian of the set of equations. However I am very confused regarding the dimensions ...
0
votes
1answer
59 views
Finite Element Analysis based on contractions of a subset of edges in enterior of mesh
I am modelling a problem that is "driven", not by typical boundary conditions but, by contractions in its interior.
In a finite element analysis, I can specify the new lengths (not ...
0
votes
0answers
27 views
“This DAE appears to be of index greater than 1” daeic12 (line76) error code
Hi I am trying to solve a set of pde converted into ODE and DAE using central finite difference method. I have used the MATLAB 'solve' command to determine the coefficients of fictitious nodes for ...
3
votes
1answer
55 views
Understand the need for Welford's online algorithm
I am puzzled by the Wikipedia entry discussing many online algorithms for computing the sample variance, including the Welford's online algorithm.
In particular, the sample variance $s_n^2$ can be ...
-1
votes
0answers
30 views
Calling scipy.integrate.odeint, solve_ivp, or any possible python solver in matlab
Do you know any way to call scipy.integrate.odeint, solve_ivp, or any python solver directly within a Matlab code? I have tried ...
7
votes
4answers
18k views
Plot integral function with scipy and matplotlib
I want to plot a numerical integral function of some function $f$ using scipy and matplotlib. How can I do this?
I tried the ...
3
votes
1answer
649 views
Interpolation using compactly supported radial basis function
I have been struggling for two days with the following problem.
I would like to do a $d$-dimensional interpolation over some data. I tried first
to use polyharmonic splines, but when the size of data ...
-1
votes
0answers
28 views
What is the issue with my Code here? [closed]
I am trying to read in a CSV file for one of my boundary condition in OpenFoam, but for some reason OpenFoam is not reading the file. There is no error message or anything, it just not showing the ...
4
votes
1answer
55 views
Backwards Difference Implicit Method for Nonlinear Parabolic PDE in Python
Original Stack Overflow Question: https://stackoverflow.com/questions/65683788/indexerror-index-31-is-out-of-bounds-for-axis-1-with-size-31?noredirect=1#comment116218335_65683788
PDE: u_t = u_xx + u(...
0
votes
1answer
58 views
Technique to find the CFL condition using the Galerkin method in space and finite-difference in time?
I am using the Galerkin method (Discontinuous to be precise) to discretize in space the scalar linear wave equation and the explicit second order centered finite difference scheme to discretize in ...