Skip to main content

Questions tagged [physics]

Physics is a science that studies the interactions of energy and matter. The physics tag should be used for questions about how physics can be simulated or implemented in programming.

3 votes
0 answers
345 views

Suvat Calculator - Kinematics

Suvat stands for kinematics or (s)displacement (u)initial velocity (v)final velocity (a)acceleration (t)time This calculator can find the remaining 2 variables given 3 other variables! Enter x on the ...
Eren Yaegar's user avatar
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
2 votes
1 answer
882 views

JS + CANVAS Projectile Motion [closed]

Basically you've got a canvas, and you can click it to launch a ball in a certain angle and speed, everything is working fine, except for the arrow tip of the vector thing. I can't get it to draw ...
J.Albert's user avatar
6 votes
2 answers
339 views

Simulating the orbits of the Earth, Moon and Sun together in Fortran

This has been racking my brain for hours now. I will try to explain as much as I can. I'm aware this code is horrendously ungraceful, but I'm new to Fortran and making things more efficient is not ...
sangstar's user avatar
  • 203
3 votes
1 answer
78 views

Dynamical system animation framework

Introduction I am developing a dynamical system simulation/animation framework, which provides three abstract base classes, DynamicalSystem, ...
Richard Mace's user avatar
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
3 votes
2 answers
2k views

Diffusion Limited Aggregation Simulator

Based on my answer to another code review question I wrote my own python script for DLA (Diffusion Limited Aggregation). The DLA algorithm task: Place seed at the center of the canvas. Release a ...
natter1's user avatar
  • 288
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 ...
user avatar
4 votes
2 answers
493 views

Modelling solar system, Runge-kutta 4 (n-Body problem)

I have a program that simulations all planets, where the forces due to each planet is considered during each time step.I'm looking to see where I could make some improvements. main.cpp ...
Methodicle's user avatar
6 votes
2 answers
858 views

Simulating a Solar System Using Command-Line Graphics

After a relative hiatus of around two years, I've decided to start delving back into the programming world; to start, I've appropriated one of my older projects, CLIGL, and have made a solar system ...
Ethan Bierlein's user avatar
33 votes
9 answers
8k views

Simple n-body class in C++

As part of my training, I implemented a n-body class in C++ to simulate gravitational interaction of bodies and to get more familiar with features that C++ offers such as object oriented programming. ...
Gilfoyle's user avatar
  • 1,125
3 votes
1 answer
287 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 ...
Péter Leéh's user avatar
2 votes
1 answer
1k views

d3.js canvas performance

I've just rewritten this code (a simple gravitational restricted n-body simulation) to display using canvas, rather than SVG. The reason being that I'd like to be able to run it with many thousands of ...
zephyr's user avatar
  • 143
4 votes
1 answer
88 views

Making basic physics object class

I'm creating a 2D game in JS, and I've made the generic class that all objects in the game will be (I've decided they are all circular for now). An object has ...
Shuri2060's user avatar
  • 227
3 votes
1 answer
345 views

Simplified three-body simulation

The code below simulates a given Newtonian 3 body system. Each row per slice is supposed to represent a Cartesian component for the initial trajectory vector and for the distance vectors to the other ...
Layman's user avatar
  • 153

15 30 50 per page
1 2
3
4 5
11