All Questions
Tagged with numerical-methods python
763 questions
0
votes
0
answers
45
views
Why doesn’t the barycenter method detect subpixel displacements where correlation does?
I’m working with X-ray imaging data.
I have a reference image containing a structured pattern, and a sample image where this pattern is slightly distorted due to the presence of a physical sample.
My ...
3
votes
5
answers
233
views
Why no floating point error occurs in print(0.1* 100000) vs (Decimal(0.1)*100000) due to FP representation of 0.1?
I am studying numerical analysis and I have come across this dilemma.
Running the following script,
from decimal import Decimal
a = 0.1 ;
N = 100000 ;
# product calculation
P = N*a
# Print product ...
2
votes
2
answers
97
views
Find correct root of parametrized function given solution for one set of parameters
Let's say I have a function foo(x, a, b) and I want to find a specific one of its (potentially multiple) roots x0, i.e. a value x0 such that foo(x0, a, b) == 0. I know that for (a, b) == (0, 0) the ...
-1
votes
0
answers
18
views
PySHtools library script
I have two perfectly defined sets of SH coefficients obtained through rigorous models in two text files.
I have read that PyShtools has the necessary classes and functions to plot them in a restricted ...
0
votes
0
answers
53
views
Phase Portrait of Coupled ODEs Not Matching Expected Graph in Python (SciPy)
I’m trying to generate a phase portrait for a system of coupled ordinary differential equations (ODEs) using Python’s scipy.integrate.solve_ivp. The system models the frequency of cooperators (x) and ...
0
votes
1
answer
50
views
Producing bifurcation diagram of logistic map including unstable points
I'm trying to produce a bifurcation diagram such as this one.
Typical bifurcation diagrams only include stable fixed points, which are attractive (nearby points get pulled towards the fixed point upon ...
0
votes
1
answer
62
views
Difference in output of sympy.binomial vs scipy.special.comb
Why does the following code that calls comb produce the wrong output?
from scipy.special import comb
from sympy import binomial
def coup(n=100, m=10):
expectation = 0
for j in range(1, n + 1):
...
0
votes
0
answers
45
views
How to simulate in python the superconducting density of states of a BCS superconductor with YSR (yu-shiba-rusinov) with 1D chain tight binding model
I try to simulate the following problem:
Compute the density of states numerically of a BCS superconductor with magnetic impurities using the tight binding model of 1D chain with periodically border ...
0
votes
0
answers
80
views
Minimum image convention for a MD simulation in Python
I'm trying to implement a simple molecular dynamic simulation in Python for N atoms with periodic boundary conditions using minimum image convention.
Here is my code:
import numpy as np
import ...
0
votes
0
answers
33
views
Simple MD simulation for N atoms with PBC in Python
I'm trying to implement a simple molecular dynamic simulation in Python for N atoms with periodic boundary conditions while allowing coordinate wrapping to visualize the atoms interacting through
...
0
votes
1
answer
65
views
Molecular dynamic simulation using velocity verlet in Python
I'm trying to implement a simple MD simulation in Python (I'm new to this),I'm using LJ potential and force equations along with Verlet method.
I posted another question about the same code yesterday ...
1
vote
1
answer
50
views
MD simulation using velocity verlet in Python
I'm trying to implement a simple MD simulation in Python (I'm new to this),I'm using LJ potential and force equations along with Verlet method:
def LJ_VF(r):
#r = distance in Å
#Returns V in (...
0
votes
1
answer
35
views
Steps approximation for time series scatter with mean changing every K number of steps using BIC
First, the synthetic data used is generated the following the way:
import sympy as sp
import numpy as np
import matplotlib.pyplot as plt
import random
import math
np.random.seed(2)
n_samples = 180
...
0
votes
0
answers
35
views
Optimizing a numerical integration that involves matrices using sympy
The expression I'm integrating is
Where the latent variables are sampled from the a multivariate distribution as following:
And the random variables w_n given a latent variable is sampled from a ...
2
votes
1
answer
89
views
How to solve the derivative of the expression with respect to D?
The integral is
Where the variables follow the following distribution:
Thus, the integral becomes:
Now, my code in python is to integrate the expression with \(W_{1:3}\) being \(1,2,3\) ...