All Questions

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

Time complexity of a numerical finite differences

if I have a function $f:\mathbb R^N\to \mathbb R$ and i would like to compute all the partial derivatives of $f$ w.r.t. the $N$ input, which is the computational complexity using the (ones sided) ...
-1
votes
0answers
20 views

Plot of a function involving an integral and value changing parameters

I'm trying to plot the cross section with respect to the photon energy $h\nu$ but for $\gamma = 1.0, 1.2, 2.0 $ in the same axes $\sigma = \left[\left(\frac{\xi_{eff}}{\xi_{0}}\right)^2 \frac{n_r}{\...
-1
votes
0answers
10 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: ...
2
votes
0answers
32 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
votes
0answers
28 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 ...
-3
votes
0answers
19 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
20 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) ...
1
vote
0answers
42 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
1answer
22 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
2answers
37 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
2answers
41 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
0answers
43 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
vote
1answer
109 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 ...
-1
votes
0answers
19 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
0answers
77 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
1answer
37 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 ...
0
votes
0answers
31 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 ...
-2
votes
0answers
65 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 ...
0
votes
0answers
55 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 ...
0
votes
0answers
37 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
votes
1answer
24 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 ...
-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 ...
-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}...
-1
votes
0answers
10 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. <...
0
votes
1answer
30 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 ...
5
votes
2answers
179 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 ...
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
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 ...
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{...
-1
votes
1answer
38 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.
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 ...
2
votes
1answer
83 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 ...
1
vote
1answer
62 views

Is C++ and Object-Oriented Numeric Computing for Scientists and Engineers by Daoqi Yang still relevant?

I'm looking to learn C++ primarily from a scientific computation perspective. The approach of the textbook seems ideal to me as it covers C++ from first principles with an emphasis on numerical ...
2
votes
1answer
99 views

Sparse matrix-matrix multiplication using AVX2

I have two sparse general matrices stored in CSR format I need to multiply. Is there any chance to gain performance using AVX2? In general the matrices are big (hundreds of millions of non-zeros and ...
1
vote
0answers
19 views

Optimality conditions for optimal control: BVP - DAE

I am solving an optimal control problem of the form $$ \min_u \qquad\int_0^T \langle u(t), u(t) \rangle \, \mathrm{d}t \\ s.t. \quad \dot{x} = \tilde{f}(x) + u, \quad x(0)=x_0 \\ \qquad \tilde{\Phi}(...
1
vote
0answers
29 views

First-principles benchmark of CFD solver

A decade ago I saw a ~20 coupled state + random number problem that was used as a benchmark for meteorological CFD tools. It had a fractal dimension (of the chaotic attractor) around 2.3, I think. I ...
-1
votes
0answers
45 views

Solve the 1D Poisson equation by integrate twice the charge density

Let's say I have a set of data (1-D array) called charge density along the $z$ direction (obtained from DFT calculation), and I want to integrate it twice with respect to $z$ coordinates points (i.e., ...
-1
votes
0answers
33 views

Linear advection equation: 1D wave with reflection at boundaries (solid walls)

I recently asked a question about this topic, but too much was unclear to me at the time which yielded poor response. (You can find the previous question here). Anyway, I am now trying to solve the ...
1
vote
0answers
35 views

Inverse Newton Method for optimization: is this the correct algorithm?

I am trying to implement the algorithm in this article. I have already asked a question before about it here, and I am trying to figure out what I am doing wrong. This time, it's this section of the ...
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 ...
5
votes
1answer
43 views

Is there an efficient algorithm for calculation of continued fraction expansion from decimal digits?

Suppose to calculate the continued fraction expansion of $\pi$, the common-sense algorithm would be to take the decimal part, perform inversion, which will give the next term as integer part, and the ...
3
votes
0answers
40 views

Spectral solver on em-pic

I'm recently studying for the spectral solver to implement EM-PIC code. I read an article and have some questions. Many PIC codes uses spectral solver to overcome numerical artifacts on FDTD. In the ...
7
votes
1answer
109 views

Numerically stable and fast sum of last K elements in sequence

Suppose I have a long, possibly infinite, sequence $x := [x_1, x_2, ...]$, and I want to use it to compute another sequence $y:=[y_1, y_2, ...]$ where each element is the sum of the last K elements of ...
1
vote
1answer
68 views

What is the maximum attainable accuracy with a given set of $\alpha,\beta$?

I am using LeVeque's book: https://faculty.washington.edu/rjl/fdmbook/ Suppose I want to compute $u''$ using FDM with $\alpha=\beta=2$ (centered) so the FDM is $$ u''=\sum_{m = - \alpha}^\beta a_mu(...
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}{...
-1
votes
0answers
35 views

Computing node, cell and face incidence in 3D structured meshes

I'm developing a PDE discretization algorithm that works on 3D uniform structured meshes. For this algorithm, I often have to traverse the mesh nodes and get the ids of all the faces and all the cells ...
0
votes
1answer
47 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 ...
-1
votes
0answers
47 views

Solving ODE for Mosquito Densities

I am trying to calculate the densities of mosquitoes at different life cycle stages. I want to use historical weather data (such as air and water temperature) and compare the results of the model to ...

15 30 50 per page
1
2 3 4 5
172