All Questions
16 questions
6
votes
2
answers
503
views
Means square displacement (MSD)
I have written a code to calculate the MSD of some molecules. The code averages over multiple time origins (sliding time window) and over all the molecules. I have also made it do one extra thing: do ...
2
votes
2
answers
2k
views
Solving the TDoA multilateration problem in 3-dimensions
Background.
I've written an algorithm to solve the Time Difference of Arrival (TDoA) multilateration problem in 3-dimensions. That is, given the known coordinates of ...
1
vote
1
answer
503
views
Solving a 3D heat diffusion PDE
I am trying to solve a heat diffusion type PDE using a finite difference method.
I would like to preface that I have seriously simplified the code. Just so that anyone who tries to help me, doesn't ...
4
votes
1
answer
424
views
Path of a particle in a non-uniform B field
I have completed my project which simulates the path of a particle trapped in a device known as a magnetic mirror. I would like your thoughts and improvements on my implementation.
Here is the code:
<...
1
vote
2
answers
201
views
Better way to calculate double-scattering diffraction using cartesian product of arrays?
This script calculates points in reciprocal space for hexagonal 2D lattices, then uses the cartesian product from itertools to add each vector from one lattice to all of the vectors of the other in ...
3
votes
1
answer
1k
views
N-Body Gravitational Simulation of Point-Masses in Python
I made an n-body gravitational simulation in python. The algorithm does produce an approximate solution, which is shown at the bottom of the post. Additional methods to produce animations (among other ...
3
votes
1
answer
288
views
Optical dispersion calculation from spectrograms with Python
First, I'd like to provide a little explanation on what my code is supposed to do.
It is part of a middle-sized project. I restructured the code to work on its own, and also added little comments to ...
4
votes
2
answers
2k
views
Trapezoidal rule for set of data
Here is the question from the book of Mark Newman-Computational Physics Exc 5.1
a) Read in the data and, using the trapezoidal rule, calculate from them the approximate distance traveled by the ...
4
votes
1
answer
810
views
Gravity simulation using Numpy and Pygame
This is a simple gravity simulator coded in Python 3.7 using Numpy and Pygame. I was wondering if it can be optimized further. Initially I had coded it using pure Python lists, using nested loops to ...
1
vote
1
answer
260
views
Modeling a capacitor with DC Bias
I am modeling a capacitor which has its capacitance varying according to the DC Bias. The DC Bias is computed by taking the mean of the voltage across the capacitance.
...
5
votes
1
answer
205
views
Calculating a table of deBroglie wavelengths for various electron energies
Here is the formula for the deBroglie wavelength of an electron versus its kinetic energy:
$$ \lambda(E_k) = h\left/\sqrt{\frac{(E_k+m_eC^2)^2-m_e^2C^4}{C^2}}\right.$$
and here is simple script that ...
4
votes
1
answer
1k
views
Snell's law using Zoeppritz equation by matrices
I have created the following code to calculate Snell's law angles, based on Zoeppritz equations on complex plane. The code works, seems it is returning valid values, but after all the code just looks ...
2
votes
2
answers
5k
views
Simulation of 2D elastic balls
Following this SO post and this Wikipedia article, I wrote a Python script to simulate physics of 2D elastic balls.
I define the physical behaviour of each ball in the ...
3
votes
3
answers
603
views
Creating and manipulating FITS files
I wrote a program that manipulated data from VLA observations and created FITS files to be used in creating spectral energy distributions of high redshift radio galaxies. I really tried to be as ...
15
votes
3
answers
5k
views
Orbital Trajectory simulator
I have written a simple program to do trajectory simulation in the Earth-Moon system, it still has a long way to go I am working on making it more class oriented and am looking into implementing a ...