All Questions

Filter by
Sorted by
Tagged with
-1
votes
0answers
10 views

Problems with function in python

I'm doing homework, which I have to build a code that resolves a system of linear equations. But I'm having a problem. I have to use a matrix and a column matrix in the 3 functions. But, when I do a ...
0
votes
1answer
17 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, ...
0
votes
0answers
16 views

How to assign Eigen Matrix value at particular index to variable

I have a function that returns double and in that function, I have to have to do some matrix computation and I am using Eigen library for that and it yields a scaler. However, I am not sure how to ...
1
vote
1answer
27 views

How to avoid unnecessary checks when inverting this LU decomposition

Background for the question I am currently working on a Matlab code in which the systems of linear equations $Ax_1 = b_1$, $Ax_2 = b_2$, ... have to be solved. As the matrix $A$ is constant during ...
1
vote
0answers
16 views

Compute the function between two images

Take an image $f$ with some characters on it (below, hjFu3). Let's apply a filter $h$ on it to obtain a second image $g$ where the text is not visible. Is there a way to compute what kind of filter $...
2
votes
1answer
45 views

Givens rotation vs 2x2 Householder reflection

The usual story of Givens rotations vs Householder reflections is that Householder reflections are better if you want to map a long vector to $e_1$, while Givens is better if you want to map a 2-...
1
vote
0answers
13 views

How to avoid gsl root finder evaluate function outside its domain

When I use the newton's method or hybrid solver in the GSL package to deal with 1-D or multidimensional root solving problems, the code frequently crashes when the solver requests function value ...
0
votes
1answer
26 views

GNU Octave - display numeric approximation of expression

I have a derivative of a function, and Octave displays it as an expression: 10____ ⎛ 10 ⎞ ╲╱ 11 ⋅⎜- ── + log(11)⎟ ⎝ 11 ⎠ This is ...
1
vote
1answer
24 views

Evaluation of slope at iteration ith - Newton-Raphson method

I'd like to know how Ansys computes the slope (=stiffness matrix) at point x1 in figure. I'm studying the way in which Ansys uses the Newton-Raphson method when there are nonlinearities. In the slide ...
1
vote
1answer
212 views

Reformulate a strictly convex QP problem containing absolute value term

Can the following strictly convex optimization problem be reformulated into a standard form that is also a strictly convex problem? $$\begin{align} &\text{Minimize }\frac{1}{2} x^T Q x + a^T x + ...
3
votes
2answers
66 views

When Using Taylor Expansion for a Simple Function is a better way to compute?

Let's say that we have the function $$f(x) = 1- \frac{\sqrt{1 + x^2}}{1 + x^2/2}$$ for small $x$. What I am asking is the following: I am going to solve this function numerically for $10^{-10}<...
1
vote
1answer
47 views

Problem about rotation matrix of elastic matrix

I have a transformation matrix $K$ which transfers elastic constitutive matrix $C$ between two coordinate systems. According to textbooks such as T.C.T. Ting's "Anisotropic Elasticity", the elastic ...
2
votes
1answer
30 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{:,:}; ...
21
votes
10answers
5k views

Which algorithm is more accurate for computing the sum of a sorted array of numbers?

Given is an increasing finite sequence of positive numbers $z_{1} ,z_{2},.....z_{n}$. Which of the following two algorithms is better for computing the sum of the numbers? ...
0
votes
0answers
33 views

Implementing adaptive timestepping in CUDA

I want to implement a CUDA solver for the 2D shallow water equations using adaptive timestepping with a Courant number fixed by the user. The algorithm pseudocode looks something like this: ...
2
votes
0answers
29 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 ...
1
vote
0answers
22 views

Monte Carlo domain not-so-dense

I already posted it on Physics SE, but maybe this is a better place: I have a 5D integral being calculated with a Monte Carlo uniform random sampling. The issue is that the region of integration is ...
0
votes
0answers
22 views

Simulation of calculations in a tetrahedral matrix 1x1x1 [on hold]

I am trying to create an simulation of computational processes inside a three-dimensional vector matrix, which is 5 closed tetrahedrons. This is the introduction of a simple calculator into a grid of ...
3
votes
1answer
38 views

Weighted QR Implementation

Say I want a QR decomposition of matrix $A$, where orthogonality of $Q$ is with respect to a generic non-degenerate positive-definite bilinear form $\phi$ (in my case, $\phi$ is "defined" by a finite-...
10
votes
1answer
331 views

How should errors be reported in scientific libraries?

There are many philosophies in different software engineering disciplines about how libraries should cope with errors or other exceptional conditions. A few of the ones I've seen: Return an error ...
4
votes
3answers
83 views

Maximize a function of an orthogonal matrix

I'm trying to write up a small code that, given a set of normal vibrational modes for a molecule, will convert them to localized vibrational modes. To do this I'm following the procedure from J. Chem. ...
5
votes
3answers
9k views

The real myth of GPU (specifically CUDA) really speed up FEM/CFD

Now I have been believing that FEM/CFD is supposed to be faster on a GPU unit - here I am using CUDA as solid example. However, I have not been able to find a convincing paper where the benchmark ...
2
votes
1answer
43 views

Confusion about Zabusky and Kruskal's stepper for the KdV equation

In Zabusky and Kruskal's paper about solitons, they derive the following update for the Korteweg de Vries equation (their footnote 6): \begin{align*} u_{i}^{j+1} = u_{i}^{j-1} - \frac{1}{3} \frac{k}{...
0
votes
0answers
9 views

How to find string similarity in 2 columns other than using fuzzy-wuzzy? [on hold]

from fuzzywuzzy import fuzz result=[] for i in range(len(data['output'])): result1=(fuzz.token_set_ratio(data['output'][i],data['input'][i])) result.append(result1) fuzz.token_set_ratio('...
1
vote
3answers
85 views

Bilinear interpolation for large grids

I need to make a bilinear interpolation of a function $Y(i,j)$ tabulated on a $100\times 100$ grid. I tried to do it with the Fortran polin2.f and ...
1
vote
0answers
26 views

Fusing callbacks with FFTs: an open-source GPU FFT implementation?

I'm using cuFFT to do some 2D FFTs on matrices of size 2048x2048 or larger. The FFTs are preceded and followed by various scaling operations. These scaling operations are memory-bound, so they take ...
2
votes
1answer
53 views

1-D boundary value problem: How implement mixed boundary conditions using a FD method?

I have been given a convection-diffusion ODE modeling the steady state temperature of a pipe (through which flows a fluid) as $$-\frac{d}{dz}\left(\kappa \frac{dT}{dz} \right)+v\rho C\frac{dT}{dz}=Q(...
2
votes
2answers
117 views

Singular values of $X$ in $AX+XA=C$?

Suppose I have semi-positive definite matrices $A$ and $C$, is there an efficient approach to get top singular values of X entering the following expression? $$ AX+XA=C $$ My matrices are 4k-by-4k ...
2
votes
0answers
79 views

Small residual but wrong results

When I use BiCGStab to solve a linear matrix system, I use the relative residual to exit the iteration and output the results. For calculating the relative residual I divide the norm of vector $r$ ...
-1
votes
0answers
24 views
0
votes
1answer
32 views

How to improve the efficiency of periodicity detection for long time based lined and gapped datasets

Our data set has $10^4$ data points, but has a long baseline and many gaps. As the histogram shows, the horizontal-axis is time and most of the time, there are no data. The vertical-axis is data ...
2
votes
0answers
42 views

Interesting maxmin mixed integer/real quadratic optimization problem

I have the following problem: $ \DeclareMathOperator*{\argmax}{arg\,max} \DeclareMathOperator*{\argmin}{arg\,min} \argmax_{\underset{\lambda_k\in \mathbb{R}}{\sigma_q^2(k)\in \mathbb{R}}} \left[\...
2
votes
1answer
114 views

Which statistical method should I use for comparing machine run-time of two algorithms?

I am comparing the run-time of two algorithm by solving different instance of the problems. Sample of my data: ...
11
votes
0answers
3k views

Optimized open source BLAS / LAPACK package

I was wondering what is a more optimized open source BLAS/LAPACK package with respect to modern multi-core processors (Haswell and beyond). Is there any distribution that can attain performance close ...
1
vote
0answers
26 views

Understanding MP-PIC implementation in OpenFOAM

The multiphase particle-in-cell (MP-PIC) method is characterized by mapping particle properties from the Lagrangian coordinates to the Eulerian grid. However, the implementation of this method in ...
3
votes
2answers
72 views

ode45 with matrix initial conditions

EDIT: We have a coupled system of 10 ode each. The coupling presents in the last equation. I thought about using a matrix 10 by 2 as initial conditions. I also followed a similar question with the ...
1
vote
1answer
37 views

Algorithm for evaluation of spin-weighted spherical harmonics

Is there an algorithm to evaluate spin-weighted spherical harmonics (swSH) at arbitrary points on the sphere? In particular I am looking for, e.g. a recursion relation to evaluate the "spin weighted ...
3
votes
1answer
240 views

A fast and efficient algorithm for eigenvalues computation of a symmetric positive definite matrix

I am looking for a very fast and efficient algorithm for the computation of the eigenvalues of a 3x3 symmetric positive definite matrix. the algorithm will be part of a massive computational kernel, ...
0
votes
0answers
24 views

Finite difference/element method : time step and spatial resolution close to a finite singularity

I'm using the finite element method (FEM), but my question is quite a global question. It's related to this question but it is not the same. Let's assume we have this equation : $$\partial_t c - u\...
2
votes
0answers
63 views

numerical instabilities in Fluid Dynamics, Finite Element Method

I'm looking for references to understand where the numerical instabilities come from in hydrodynamics in general, and notably when the Péclet number: $Pe>1$. I'm using the finite element method. ...
4
votes
1answer
58 views

Diagonalize a unitary matrix with orthogonal matrices using numpy

An important component of the Cartan KAK decomposition for 2 qubit operations is to diagonalize a 4x4 unitary matrix using orthogonal (not unitary, purely real orthogonal) matrices. That is to say, ...
7
votes
1answer
114 views

Eigenvalue-like problem with coupled ODEs

I am looking at the following system of ODEs: \begin{array}{r}{\left[c_{2}(k)-\partial_{\tau}^{2}\right] \varphi_{2}\left(\tau \right)=f_{21}(\tau) \varphi_{1}\left(\tau \right)} \\ {\left[c_{1}(k)-...
0
votes
0answers
43 views

Derivatives over a Finite Element mesh

I have a data extracted from Comsol on some node points and I know the coordinates of each node. Does anyone know how Comsol calculate the partial derivative from the values at each node and also ...
-1
votes
0answers
30 views

FEniCS implementation of Maxwell equations for a dipole antenna

someone knows where I can find a FEniCS implementation of Maxwell equations for a dipole or other type of antenna? I mean a dipole antenna with an arbitrary geometry of every 'leg' in the dipole.
1
vote
0answers
35 views

Predictor-Corrector vs. Deferred Difference Corrections

I want to use the Numerov method but keep higher-order terms from the Taylor expansions. In the literature, I found the term "Deferred Difference Corrections" for the procedure of first solving the ...
1
vote
3answers
115 views

Clustering with points lying along different 3D planes

I have a bunch of data points in 3D that lie along a few planes. What would be the best approaches to estimate the normals of these planes? Edit: There are roughly equal number of points lying along ...
2
votes
0answers
47 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
47 views

ADMM: why does method of multipliers lose decomposability

I am trying to understand intuition of ADMM (alternating direction methods of multipliers). It combines dual ascent and method of multipliers. Downside of method of multiplier is the loss of ...
1
vote
1answer
27 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 ...
1
vote
1answer
68 views

Average value divergence in spectral method for Poisson equation

I'd like to know how to deal with a divergence when trying to solve the Poisson equation for electrostatics with a simple spectral method. I'm not sure how to best state my problem, so I'll explain ...

15 30 50 per page