All Questions

Filter by
Sorted by
Tagged with
1
vote
0answers
32 views

Setting up optimization problem in GEKKO

I have the following dynamical system, $\frac{d \phi}{dt} = -M^TDM\phi \tag{1}\label{1}$ $\frac{d \hat\phi}{dt} = -M^T\tilde{D}M\hat \phi \tag{2} \label{2}$ $\eqref{1}$ represents the exact ...
0
votes
0answers
7 views

Python import Data from .txt. file with pandas down from a specific line

I am really new in Python and I hope this is the right community for my question. Sorry if it is not. I am trying to import data from a .txt file with pandas. The file looks like this: ...
0
votes
1answer
41 views

Specifying mesh spacing for DFT in numpy

I was testing the .fft package of numpy 1.16.1 in Python 3.7.2. In particular I was trying to verify that the transform resembles the analytical one for: $$f(x) = \mathrm{exp}\left[-\left(\frac{x-5}{2}...
1
vote
2answers
31 views

Convolution in Python

I have an integral of a convolution between two functions. How can I calculate this in Python? It is a continuum convolution.
0
votes
1answer
43 views

Is this behaviour normal for a Lennard-Jones monte carlo simulation?

I am simulating a Lennard-Jones fluid using MC simulation. The code always uses a reduced unit. I want to find the potential energy of the system. Periodic boundary condition implemented. I have ...
2
votes
0answers
24 views

Sparse Matrix Matrix multiplication using Intel MKL

Let $D$ be a sparse matrix. I want to compute $D\times D^T$. As $D$ is fairly large, so I am row-slicing $D$. That means for a range $(i,j)$, I am computing $C = D(i:j,:) \times D^T$ and performing ...
1
vote
0answers
68 views
+50

What is the state-of-the-art in parallel sparse matrix and dense vector multiplication?

For sure, there has been many highly optimized library on this. But I am working on a matrix-free context since the problem size does not allow explicit storage of sparse matrix elements. I'd love ...
0
votes
0answers
24 views

Discretizing a Non-Linear Continuous Adjoint Equation

I am trying to follow the derivation of the tangent linear / adjoint matrix for the following equation: $$ \frac{\partial u}{\partial t} = \frac{\partial u}{\partial x} \frac{\partial u}{\partial y} $...
-1
votes
0answers
21 views

Is there any simple model for 1D- EM PIC?

Recently i am studying about the 1D EM-PIC simulation (EM-PIC = electromagnetics plus particle-in-cell, simultaneous time-integration of the electric/magnetic fields plus the motion of free charges ...
0
votes
3answers
34 views

What space-time points should a known coefficient function be evaluated at when using the Lax-Friedrichs scheme to solve the transport equation?

For a scalar quantity $u = u(x, t)$, I'm considering the transport equation \begin{align} u_t + au_x &= 0, \qquad{x\in[0, L], \ t\in[0, T]} \\ u(0, t) &= u_{\text{in}}, \\ u(x, 0) &= f(x). ...
2
votes
1answer
111 views

Numerical solution to the Landau-Zener problem

I tried to use a midpoint method and numerically solve the Schrödinger equation for the original Landau-Zener (LZ) problem: a $2\times 2$ Hamiltonian $$\left(\begin{array}{c} \alpha t\\ \delta \end{...
-3
votes
0answers
14 views

Maxwell equation in phasor form in MATLAB? [closed]

Can anyone help me to explain the phasor form of Maxwell equation in MATLAB along with the MATLAB code .I will be very thankful to you .
-1
votes
0answers
19 views

Homogeneous vs Inhomogeneous B.C. Clarification

I'm creating a FEM simulation based off of the Thermal Diffusion Equation: https://en.wikipedia.org/wiki/Heat_equation I allow users to select and set the initial temperature of elements (cells) ...
5
votes
1answer
131 views
+300

Numerical flux and source term in FVM (Burger's like equation)

I'm trying to solve the following equation with FVM $$u_t + f(u)_x = g(u)$$ where $g$ is some smooth function of $u$ and $f(u) = \frac{u^2}{2}$. This is really similar to Burger's equation, except ...
1
vote
1answer
305 views

Suitable finite difference method for a convection-diffusion system?

I am trying to solve a system of PDEs $H_{t} = \frac{0.3}{0.7} - \frac{0.005 B f(h(H))}{\theta} - \frac{0.3 f(h(H))}{0.7} + \frac{500}{0.7} (HH_x)_x + (HH_y)_y$ $N_t = \frac{N_{in} - 0.002 [N] B f(h(...
0
votes
1answer
21 views

Desmos saying there are too many variables [closed]

I wasn't sure if this is a Computational Science SE question or a Stack Overflow question but I think it's more of this one. I wanted to make a graph where I can rotate a hyperbola (not parabola or ...
1
vote
0answers
66 views

C++ book recommendation- Scientific computing and C++

I'm a master's student in Math interested in Numerical Analysis. I know there are lots of questions like that on this site, but I think this is the best place to ask. So, I'm looking for an ...
2
votes
0answers
42 views

Does BFGS preserve the bandedness of the inverse hessian?

In the BFGS method we perform iterations by calculating an approximation $\boldsymbol{H}_k$ to the inverse Hessian $\boldsymbol{H}$ of the objective function. This method belongs to a family of ...
-1
votes
0answers
11 views

Developing a microwave imaging inverse scattering model with COMSOL [closed]

I am working on an Inverse Scattering problem in microwave imaging. I went through the book -'Introduction to Imaging from Scattered fields' by Michael Fiddy et. al. They have used COMSOL for the data ...
-1
votes
0answers
18 views

One to Many Assignment Problem where agents can't be assigned the same task if they share a trait

In the one to many assignment problem, many agents can be assigned to a task. In my problem, I want to assign many agents to a task, but for all of the agents assigned to that task, they must share a ...
1
vote
1answer
61 views

Draw contour line to represent multiple contours

I have 5 data sets, each includes multiple scatter points. If I use the geom_path function in R, I could obtain 5 contours like the following graph shows. Those five contours are annotated outlines ...
0
votes
0answers
30 views

Spectral Clustering by Andrew Ng paper: theorem proof question

I recently read the paper "On Spectral Clustering: Analysis and an Algorithm" by Ng et al. Much of the paper centers on Theorem 2 and equation 8. To me, it appears there is no given or referenced ...
0
votes
1answer
35 views

How do I find the portion of a cell/voxel lying within a defined surface?

We have a 3-dimensional grid of voxels (or cells), with individual voxels being of volume $dx\,dy\,dz$ where $dx=dy=dz=1$. A cone-like surface is defined by some function, $z = f(x, y)$, which in ...
2
votes
1answer
5k views

Calculate Jacobian of triangular element given coordinates of vertices and displacements?

I am trying to determine quality of my mesh elements using the Jacobian determinant as the measure. My algorithm takes vertices of nodes in triangular mesh and moves them around so as to form ...
0
votes
0answers
51 views

Normalized legendre and quadrature basis for discontinous Galerkin method

I've successfully implemented a 1D DG code with non-normalized Legendre basis and I've now moved onto developing a 2D code using tensor products. For my 2D code I've chosen to have normalized ...
5
votes
5answers
13k views

How can I plot piece-wise defined function in some easily-accessed open-source tool?

I want to plot $$f_{n}(x) = \begin{cases} x-n & \text{for } n \leq x \leq n+1 \\ 2-x+n & \text{for } n+1\leq x \leq n+2 \\ 0 &...
-2
votes
0answers
61 views

Which code to learn for the “next level” in computation [closed]

I doing very intensive calculation with GNU octave. I plan to write other codes more laborious, so I need a language optimized for numerical computation. Because of performance, I think that a ...
-1
votes
0answers
48 views

What is going wrong in the way I set up constraints for optimization solver?

I have the following dynamical system, Equation 1: $\frac{d \phi}{dt} = -M^TDM\phi$ Equation 2: $\frac{d \hat\phi}{dt} = -M^T\tilde{D}M\hat \phi$ Equation 1 represents the exact dynamics of a ...
0
votes
0answers
41 views

Why this LJ molecular dynamics result doesn't converge?

I am doing a molecular dynamics simulation of Leonard Jones 6-12 potential. But instead of converging to a particular value. It always stays between -5.58 to -5.62. The standard value is -5.517. The ...
2
votes
1answer
29 views

Adaptive Runge-Kutta for Stochastic (Projected) Gross-Pitaevskii Equation

I am using the XMDS library for solving the stochastic (projected) Gross-Pitaevskii equation $$i \hbar \partial \Phi\left(\mathbf{r},t\right)_t=\hat{\mathcal{P}}\left\{(1-i \gamma)\left(\hat{H}_{\...
0
votes
1answer
39 views

Why addCylinder function not respecting the given coordinates?

I tried to generate 3 very simple cylinders, each other connected to it end, however the cylinder get connected to an unexistent point in space as the image shows: It was supposed to each segment be ...
0
votes
0answers
36 views

Petsc matrix with DM objects takes too much memory

I have been learning petsc recently and made a simple solver for stokes equation on 3D staggered grid. My code is running on server with 200GB ram, but if I run a solver on 256^3 grid, memory used by ...
1
vote
1answer
50 views

How long should the hyperelastic equations be solved before updating the mesh?

How long should the hyperelastic equations be solved before updating the mesh? To be specific, I'm interested in the hyperelastic model with a neo-Hookean solid: $$ \nabla\cdot\sigma + f = \rho\ddot{...
0
votes
0answers
15 views

Reinch's modification to the Clenshaw recurrence gives no improvement

The classical Clenshaw recurrence (see Algorithm 3.1 here) is less accurate as $x\to \pm 1$. So Reich proposed a modification to it, which is discussed as Algorithm 3.2 as well as by Oliver. While ...
0
votes
1answer
29 views

integrate.solve_ivp bugged

I am trying to solve an ODE with solve_ivp, but I am getting strange errors. Documentation: https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_ivp.html ...
-2
votes
0answers
25 views

Difficulties on Mathematica code to solve Christoffel Symbols of a particular metric [migrated]

DISCLAIMER: PLEASE DO NOT PUNISH ME FOR THE .JPGs I) The Problem There's a particular metric $[1],[2]$ in general relativity which is written as: $$ds^{2} = -[c^2-v_{s}^2f(r_{s})^2]dt^2+v_{s}f(r_{s}...
2
votes
1answer
42 views

How to extract connected components from persistence diagram?

From the given point cloud (Fig. 1), I use Scipy-TDA to extract persistence diagram (Fig. 2). What I'm interested in is to extract 3 circles. For example, I'd like to know 3 center points and labels ...
-1
votes
0answers
9 views

How to extract text from several .json files and put all of them in a single file? [closed]

I have a bunch of .json files, say 1000. To read each files I run the following code in MATLAB fname = 'C:\Users...\d90f3c62681e.json'; val = jsondecode(fileread(fname)); the output is as follows. <...
-1
votes
1answer
37 views

Detecting degenerate triangles with very thin structures

Between the two ears in the following bunny images, there are some degenerate triangles I want to detect. It looks like a volume-less thin slits. If the question is not clear, please let me know.
1
vote
1answer
129 views

Efficient CRS vectors evaluation using elements connectivities

What is an efficient way of evaluating the column (col_ind) and the row (row_ptr) vectors for the CRS (Compressed Row Storage) storage format using the Connectivity Array? The Connectivity Array is a ...
4
votes
1answer
124 views

An optimization method for bounding the eigenvalues of a unknown non symmetric matrix

Given a positive objective function $f$ that acts on a real-valued matrix $A$, I am interested in the following problem $$\underset{A \in \mathbb{R}^{n \times n}}{\text{minimize}} \quad f(A) \quad \...
56
votes
4answers
9k views

How mature is the “Julia” scientific computing language project?

I'm considering learning a new language to use for numerical/simulation modelling projects, as a (partial) replacement for the C++ and Python that I currently use. I came across Julia, which sounds ...
6
votes
2answers
210 views

Is this system of diffusion equations well-posed?

I’m using a standard Crank-Nicholson algorithm to solve this system of two coupled diffusion equations: $$\dot{u} - \dot{v} = \frac{\partial}{\partial x} \left( \alpha(x) \frac{\partial u}{\partial x}...
5
votes
0answers
141 views

Solve ill-posed linear system without transposing matrices?

I am attempting to use an iterative solver to solve $p$ in $$ Jp = -r $$ where $J$ is an $m\times m$ matrix ($m$ is in the order of $10^5$ and never explicitly stored). $J$ is a dense matrix ...
6
votes
1answer
494 views

Jacobi preconditioner not reducing condition number?

Let's say you have a general matrix $A$, with diagonal entries $a_{ii} = d>0$. (No assumptions are made about the off-diagonal elements.) Then Jacobi preconditioning doesn't improve condition ...
7
votes
2answers
4k views

How to get all intersections between two simple polygons in O(n+k)

Basically the formulation of the problem I'd like to solve is very simple. Given 2 simple polygons (without self-intersections) report all intersecting edge pairs in O(n+k) time, where n - is a total ...
4
votes
2answers
54 views

MInimizing cost function using iterative search for a minimum method

I want to estimated the parameters $\ \hat{\theta} $ of a model using an iterative search for the minimum of a cost function. The cost function is defined as follows: $$ V_N(\hat{\theta}) = \frac{1}{...
5
votes
2answers
122 views

Fast algorithm for computing the similarity between two arrays

Suppose there are two arrays (They have the same length), I want to give a quantitative description about the similarity between them. I define a formula like this, which means we can shuffle them ...
2
votes
1answer
82 views

Generating Random Orthogonal Matrices in C++

I'm looking for an open-source library for the generation of random n-dimensional orthogonal matrices in C++. In python, it looks like such a function is available in the NumPy package. But I was not ...
-1
votes
1answer
32 views

Numpys `tensordot` and what is happening mathematically

I've encountered a program where np.tensordot was used, so I tried looking it up but I can't really understand what this function is doing... I feel rather ...

15 30 50 per page
1
2 3 4 5
172