physics

Something goes wrong calculating the slope of the simulation

Something goes wrong calculating the slope of the simulation Question: In this python code we are trying to simulate the path of a frisbee that is being shot from a shooter with a certain angle (alpha0). The angle of attack should be the angle at which its being shot, minus the slope of its path. …

Total answers: 1

Why does the moon spiral towards Earth in simulation?

Why does the moon spiral towards Earth in simulation? Question: I am trying to simulate a somewhat realistic program where Earth and the moon can interact gravitationally with each other. Now the problem is that the moon keeps on spiraling towards Earth and I don’t understand why. This is my code: from math import sin,cos,sqrt,atan2,pi …

Total answers: 1

How can I add many datasets to a single plot in python?

How can I add many datasets to a single plot in python? Question: I am wanting to plot many datasets on one plot in python. Currently, I have hardcoded 20 of the datasets for the sake of testing my plot. Here is the shortened code below: import numpy as np import matplotlib as plt N_steps …

Total answers: 1

How can I use 'prange' in Cython?

How can I use 'prange' in Cython? Question: I’m trying to solve a two-dimensional Ising model with a Monte Carlo approach. As it is slow, I used Cython to accelerate the code execution. I would like to push it even further and parallelize the Cython code. My idea is to split the two-dimensional lattice in …

Total answers: 2