Skip to main content

All Questions

Tagged with
3 votes
1 answer
131 views

Improving execution time of physics, data acquisition triggering system simulation

Background I'm attempting to write a physics simulation code, one portion of which involves simulating the triggering system of some equipment. The equipment works as follows: environmental noise (...
MomentumEigenstate's user avatar
6 votes
2 answers
482 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 ...
mjksho's user avatar
  • 61
5 votes
1 answer
231 views

Calculating the energy of the harmonic oscillator using a Monte Carlo method

The problem The partition function for the quantum harmonic oscillator can be written in the path integral formulation as $$Z\propto\int Dx(\tau)\exp\left(-\frac{S_E}{\hbar}\right)=\int Dx(\tau)\exp\...
My Code is a Flying Circus's user avatar
0 votes
1 answer
229 views

Monte Carlo simulation for the harmonic oscillator

Is there any improvement that can be made to the following code, written to simulate the harmonic oscillator in the path integral formulation with Monte Carlo methods? ...
My Code is a Flying Circus's user avatar
3 votes
2 answers
525 views

VBA functions to calculate sun and moon positions

I have the following VBA code (across three modules) to make UDFs to calculate sun & moon position data. The issue I'm facing is that they are very slow to run as I have over 6000 rows (over 10 ...
hidp123's user avatar
  • 31
6 votes
2 answers
765 views

C program that finds local acceleration due to gravity (g)

I have written a program in C that calculates local g, by using height from the sea level and latitude. NOTE: I have to add an image of the equation because that ...
Darth-CodeX's user avatar
5 votes
1 answer
67 views

Exploring the space of 8 parameters of a physics problem to then be evaluated in ODE integrator as LSODA millions of times, efficently

there's a function in one of the scripts I've been working on that I really want to improve. Disclaimer: Being honest, I'm not really very good at programming but I've been learning day to day and it'...
nuwe's user avatar
  • 163
1 vote
1 answer
47 views

Optimize narrow phase contact detection for phyiscs simulation code

I'm trying to optimize the narrow phase of the contact detection in my code. I'm using OpenMP for multithreading. That is the starting code: ...
David's user avatar
  • 111
1 vote
2 answers
188 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 ...
uhoh's user avatar
  • 473
3 votes
1 answer
216 views

Molecular dynamics simulation

I'm looking for some fresh ideas on how to optimize a couple of functions in my C++ code. I run the code through a profiler and it shows that they take 20% and 40% of the time respectively. The ...
ad1v7's user avatar
  • 133
4 votes
2 answers
380 views

Simple spatial grid for particle system

I am going to simulate a particle system, the particles are infinitesimal points which apply forces on the neighbors and I need a fast way of making proximity checks, they are going to have a maximum ...
StackOverflowToxicityVictim's user avatar
4 votes
1 answer
791 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 ...
user186567's user avatar
5 votes
0 answers
85 views

Butter side up?

I've written a piece of code that determines if a piece toast with butter lands on the butter-side or not, depending on its initial velocity and the table height. The code is written in Mathematica ...
Sito's user avatar
  • 394
5 votes
2 answers
864 views

Simulation of spring-loaded inverted pendulum

I've finally committed to moving to Python 3 from MATLAB. I'm currently porting my MATLAB code, and I'm sure I'm missing a lot of common best-practices. For reference, I'm simulating a spring-loaded ...
Steve Heim's user avatar
2 votes
2 answers
127 views

Perturbed phase oscillator integration

I am integrating a system of perturbed phase oscillators. I define the system of equation and also the Jacobian matrix. I have to reshape the one dimensional vector of system state to a 2 dimensional ...
Abolfazl's user avatar
  • 235

15 30 50 per page