Questions tagged [computational-physics]

Computational physics is the study and implementation of numerical algorithms to solve problems in physics for which a quantitative theory already exists.

Filter by
Sorted by
Tagged with
0
votes
0answers
29 views

Kaplan-Glass Determinism Test - Python

I have projected a 2-dimensional phase space onto a graph and attempted to coarse grain the embedding. I'm attempting to perform the Kaplan-Glass Determinism Test. Link: http://www.medicine.mcgill.ca/...
0
votes
1answer
75 views

Can I use periodic boundary conditions for `U` but not for `p`?

Cross-posted from Stack Overflow. (https://stackoverflow.com/questions/70686368/can-i-use-periodic-boundary-conditions-for-u-but-not-for-p) I am trying to numerically compute the drag force around a ...
0
votes
0answers
44 views

Poisson equation fast solver on large grids

Below is kind of a broad question. Was given Poisson equation with BC, on meshgrid of NxM. Rewrote as system of N*M linear equations, Converted to sparse format (CSR/CRS/Yale), solved using Conj Grad ...
0
votes
0answers
20 views

How to determine the minimum grid length | Numerical Plasma physics

I am trying to understand the attached python 3X code. The following dispersion relation is given $$\epsilon (k, \omega) = 1 - \frac 1 2 \left[ \frac{\omega_p^2}{(\omega-kv_0)^2} + \frac{\omega_p^2}{(\...
0
votes
0answers
20 views

Need help in attempting to solve an MHD eigenvalue problem

Background I am attempting to numerically solve the ideal MHD equations in normal mode form for a Harris current sheet. The linearized perturbed MHD equations can be written in a normal mode form: $$ -...
0
votes
0answers
24 views

Need help implementing constrained transport method for MHD riemann slver

I tried implementing constrained transport method to 1st order Godunov solver and when I run it on 2D rotor test case, the solver becomes unstable and crashed. The solver is able to maintain ...
-1
votes
0answers
25 views

I need help with the Trotter-Suzuki method [closed]

I am new in the field of computational science, and I have some difficulties when I tried to compute the Trotter-Suzuki method in python. I have defined / decomposed the matrices but when I plotted it,...
1
vote
1answer
144 views

Schrodinger's Equation differential

I am working on a modified version of Schrodinger's equation (time-independent) where $\frac{d^2ψ}{dx^2}=-2(E-V)ψ$, where I have to consider $V = 0$ at all times. I have been asked to use Python in ...
0
votes
1answer
44 views

Scipy Find Peaks

I am trying to find the peaks. I have list x_period and y_power. I find the peaks from the ...
3
votes
1answer
37 views

Bounds condition for IFT to obtain a $1/f$ time-series

I am coding a function to obtain a randomized time-series from a given $\frac{1}{f}$ law. The randomization is obtained by introducing a random phase in the function. I experience a problem in the ...
1
vote
1answer
118 views

Numerical Solution of the Schrödinger equation for hydrogen

I'm trying to solve the Schrödinger equation for the hydrogen atom in the following form numerically: $$\left[-\frac{\hbar^2}{2m}\frac{d^2}{dr^2}+V(r)+\frac{\hbar^2l(l+1)}{2mr^2}\right]R(r)=ER(r).$$ ...
0
votes
0answers
54 views

Numerov method for 1D potential barrier problem: numerical errors

I wanted to solve a 1D potential barrier problem. It seemed easy enough to do: set a travelling wave coming from the left, part of it gets reflected by the barrier, and part of it gets gets ...
0
votes
0answers
21 views

Using Pymc3+Theano+astropy for Bayesian inference with integral expressions

This is my first time using Pymc3 or Theano, so I apologize if this question is straightforward. I'm interested in using Bayesian inference to see how effective the (non) observation of something can ...
0
votes
1answer
123 views

Computing eigenvalues of Schrodinger equation with spin

I want to solve a 2-dimensional particle in box problem with two electrons in the quantum well.I would like to take into account spin of electrons and Coulomb interactions to compute singlet and ...
0
votes
3answers
83 views

How can I plot a rainbow?

I'm trying to write a program that can simulate a rainbow. So far I've got figured out how to determine the change in the refractive index depending on the wavelength, the angular deviation of the ...
1
vote
0answers
179 views

How to compute the Eigenvalue and Eigenstates of Quantum well with Effective mass using finite difference method in Python?

I want to compute the eigenvalues and eigenstates of a quantum well with different effective masses of electron in the barrier and in the quantum well. As can be seen [1]: https://github.com/mholtrop/...
0
votes
1answer
35 views

Convoluted exponential gaussian probability function from Igor Pro

I am trying to figure out the exact formula for a three convoluted exponential gaussian probability function from the software Igor Pro, from my research. Unfortunately all I the closest equation from ...
0
votes
1answer
113 views

How does one obtain tortoise coordinates by integrating with GNU Scientific Library (GSL)?

I’m trying to to obtain the values of the tortoise coordinates (Eddington-Finkelstein Coordinates) integrating the expression: $\frac{dr^*}{dr} = (1 - rS/r)^{-1}$ using the GNU Scientific Library (GSL)...
0
votes
1answer
89 views

Simulating the behavior of falling peas

I hope this is the right place for my question. I am a university student who designed a pea-pouring machine.Now I‘m really interested in simulating the behavior of those peas. Basically, they are ...
1
vote
0answers
36 views

Weird behavior in for solving TISE in harmonic oscillator potential using the shooting method

I was solving the time independent Schrödinger equation using the shooting method for harmonic oscillator potential. This is the code that I wrote for that with the results (code is written in julia): ...
0
votes
0answers
28 views

Astrophysics context : Introduction of a factor $\Delta\ell$ when summing equal distants $C_\ell$

I have the following formula which is the error on a $C_\ell$ : $$\sigma_(C_{\ell})=\sqrt{\frac{2}{(2 \ell+1)\Delta\ell}}\,C_{\ell}\quad(1)$$ where $\Delta\ell$ is the width of the multipoles bins ...
-1
votes
1answer
148 views

Can someone help or point me out to C++ source code for a two body orbit simulation using symplectic integration?

I've professional experience with physics simulations and C++ programming, although I don't have specific experience with astrophysics simulations. I'm trying to build a two-body evolving system ...
3
votes
0answers
87 views

Numerical Soultion to Background equations of cosmology

I am trying to solve the background equations of cosmology numerically using Runge-Kutta Dormand Prince method with simplified assumption $8\pi G=1$ and $c=1$. The equations are $$\ddot a = - \frac{1}{...
0
votes
1answer
62 views

Does the leap-frog algorithm conserve energy for n-body problems?

The leap-frog algorithm is able to conserve to a certain extent the energy of a system, which flucutates as a cosine around a stable value. Is this true if we apply the algorithm to a n-body ...
0
votes
0answers
22 views

How to solve nonlinear second order ODE in Matlab? [duplicate]

I am working on simulating a car suspension system using Matlab. Specifically, I have to derive equation of motion using the Lagrange method and then use ode 45 to solve it. However, while using ...
2
votes
1answer
91 views

Changing randomly a unit vector

For studying a spin model on a lattice, I have to generate a random unit vector starting from a pre-exstisting one. There are multiple ways to do it, but the book I use suggests generating a random ...
1
vote
0answers
52 views

Reproducing a paper's result for Topological Insulators

For the past weeks I have been trying to reproduce Agarwala's results but I've been unsuccessful. From this paper I am trying to reproduce the first and last columns of Fig.2, by implementing eq.2; ...
1
vote
2answers
224 views

Dyadic operations, fourth order tensors and Tensor algebra

I am trying to understand the dyadic operation for a while since I am interested in Elasticity problems. I believe an intuitive understanding (rather than assuming) will give me good problem solving ...
0
votes
0answers
76 views

How to distinguish primary hosts (stars) and orbiting satellites (planets) and tertiary bodies (moons) by their mass and trajectory?

I posted this question in the astronomy stackexchange. There are no responses, and it was suggested that I pose the question here. The "too long, didn't read" was taken from a comment, and ...
0
votes
1answer
56 views

Is there a unit of measure for computational complexity; through quantum computers? [closed]

I'm concerned with trying to determine whether the same computational processes on a Turing computable algorithm can be ascertained for a quantum computer in some form of actual 'metric' for how many ...
3
votes
2answers
210 views

OpenMP: parallelizing calculation of pair interaction forces

I recently started to learn OpenMP. Albeit I have developed some intuition I still have some doubts on how to proceed under certain circumstances that are very useful for computational physicists. My ...
0
votes
0answers
54 views

Can I get a symbolic solution for these coupled ODEs?

I found this IPython notebook called ‘Roller Coaster’ from", "numfys.net, where they model the movement of a ball over a path described by a third-degree polynomial $y(x)$ with slope $\...
0
votes
0answers
46 views

Comparison of computational complexities of MD versus MC simulations

In my humble understanding MD simulations of systems with short-range(like LJ interactions) and long-range(electrostatic) has a computational complexity $O(N . log(N))$. What will be the computational ...
3
votes
2answers
124 views

Efficient schemes for solving the extended Saddle point problem

I am interested in knowing some efficient techniques for solving the following extended Saddle point problem. \begin{align} \begin{bmatrix} A & B^T & C^T \\ B & 0 & 0 \\ C & ...
3
votes
1answer
162 views

Finite element method for high-frequency electromagnetics

I am writing a project about the Finite element method for use in high-frequency solutions of Maxwell's equations. This could be for use in antenna design and similar. I have some trouble ...
0
votes
1answer
275 views

N-body problem with differents solvers (RK2, RK4, Euler symplectic, Stormer-Verlet) : planets drift to infinity

I'm trying to write an integrator for the 2 and 3-body problem. I choose to start from a generalisation to N-body problem so I can just pass my bodies to the same integrator in the two cases. I'm ...
1
vote
0answers
127 views

Solving coupled PDEs with self-consistency condition

I am figuring out how to attack a problem (the Usadel equations of superconductivity) in which I need to solve a set of nonlinear PDEs for the fields $\{G_i (r)\}$ $$ U(G_i(r), \nabla G_i(r), \Delta(r)...
2
votes
2answers
147 views

Generating particles from a distribution function using Monte Carlo

I have been given a 4D ($x, y, v_x, v_y$) distribution function, $f(x,y,v_x, v_y)$, generated by an external code. I want to generate a set of particles from this distribution function, say 10k ...
-1
votes
1answer
114 views

Implementation of Source Panel Method as Described in Katz Plotkin Book

I am currently trying to implement Source Panel method as described in Katz and Plotkin in Low Speed Aerodynamics. I have successfully implemented two previous methods. However, I am fully blocked on ...
0
votes
2answers
133 views

Integrate a function from samples using computer codes

I have a function $c ( I (\vec{r}) )$. Not a constant, $c$ doesn't denote a constant. So $c$ is a function of $I$ which is a function of $\vec{r}$. $I$ is an intensity (W/cm2). This $c$ is hard to ...
1
vote
2answers
182 views

How can I learn Scientific Python?

I am an intermediate user of Matlab and Mathematica, but I would really love to start learning Python language for scientific purposes (I am interested in Maths and Physics). Could please someone ...
0
votes
1answer
2k views

Saving Data in Multiple Columns with np.savetxt

I have managed to write the following code for the following problem: Projectile's horizontal and vertical displacement are given by: $$ x = v_0 \, t \cos(\theta) $$ $$ y = v_0 \, t \sin(\theta) - \...
0
votes
2answers
190 views

Numerically solving the equation of motion for inflation in cosmology

I want to solve the equation of inflation involving a scalar field numerically using Python libraries such as odeint or scipy. ...
0
votes
1answer
111 views

Good method for correlated samples and estimating autocorrelation times

I'm working on a Monte Carlo project similar to the Ising model. I've found many examples on which I've based my code. From some papers I read on binning analysis, the errors after each binning step ...
0
votes
0answers
99 views

Numerical dispersion in FDTD

I was reading the book "Computational Electrodynamics: The FDTD method" by Taflove and Hagness, probably the most cited book when it comes to the FDTD method in Electromagnetics. In the ...
1
vote
2answers
230 views

Diagonalization using LAPACK

Say, we have a Hamiltonian which for simplicity does not mix particle hole sectors. It is just a simple Hamiltonian in real space as shown, $H=\sum_{ij,\sigma} A(i,j)(c_{i\sigma}^{\dagger}c_{j\sigma} +...
2
votes
0answers
84 views

Finding the extrema of a transition probability function for a quantum walker on a graph

The goal Implement some Python code to find the extrema points of a function that is strongly oscillating. The background Let $G$ be a connected graph with $n$ points with Laplacian matrix $L(G)$. We ...
1
vote
1answer
92 views

Electrostatic Force - Simulate Trajectory of Test Particle using Runge Kutta - Force always Repels

In the center of a 2D-Plane a positive static charge Q is placed with position r_prime. This charge creates a static electrical Field E. Now i want to place a test particle with charge Q and position ...
1
vote
2answers
143 views

Numerical minimization of the action in python

I want to find the trajectory $x(t)$ which minimizes the action $S = \int_{t_i}^{t_f} L(x(t), \dot{x}(t)) \mathrm{d}t$ numerically. I am trying to do it by discretizing the action so it is more of a ...
0
votes
1answer
179 views

How can I implement second order derivatives of shape functions of a 3D elements?

I am developing an Abaqus UEL with 3D 8 nodes brick elements and I need second order derivatives of the shape functions, I have already mapped the first order derivatives from the element coordinates ...

1
2 3 4 5
8