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.

1 vote
1 answer
475 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 ...
Ruan's user avatar
  • 101
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
10 votes
1 answer
922 views

High performance physics simulation - core class design

Below is some stripped down code from a physics simulation. The classes Vector2, Line and ...
Oliver Schönrock's user avatar
1 vote
0 answers
85 views

Advice on Update function in my Game Loop [closed]

I have this update fx for my Player object in game loop, game is top-down in-space thing with boom-booms and such. Me being weak at maths is huge understatement so my implementation is concoction of ...
Jan Šebek's user avatar
3 votes
1 answer
503 views

Barnes-Hut \$n\$-body simulation (3D) in C++

I have implemented the Barnes-Hut algorithm for \$n\$-body-simulations (in this case "sort-of" 3D-gravity - see below). I'd appreciate any comments for improving my code (especially ...
Paul Aner's user avatar
  • 131
4 votes
2 answers
432 views

Clebsch-Gordan Coefficients Implementation

In scientific programming I often come into the position of needing to implement a rather obscure and complicated formula. Clebsch-Gordan coefficients are such a thing. I'm mainly seeking advice on ...
infinitezero's user avatar
8 votes
4 answers
1k views

Python: Class to calculate different variables of a projectile motion with angle, velocity (+ initial height) (first OOP program)

I'd like to hear your constructive criticisms about my first OOP project. I explain more what I actually do in the code's comments, and I tried to be quite explanatory with names etc. ...
Rúshi's user avatar
  • 125
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
4 votes
1 answer
411 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: <...
Dila's user avatar
  • 215
4 votes
1 answer
93 views

Phase diagrams of particles in a mirror

I have completed my project which models the paths of particles in a plasma experiencing a force. The program creates phase diagrams of a particle's perpendicular velocity against its parallel ...
Dila's user avatar
  • 215
4 votes
2 answers
117 views

Simulate transmission spectrum of extreme ultraviolet laser pulse through laser-dressed finite sample (Python Version)

I am currently participating in research on transient absorption spectroscopy and four wave mixing. In the experimental design, an extreme ultraviolet (XUV) laser pulse and infrared (IR) laser pulse ...
Matt Bowman's user avatar
3 votes
0 answers
37 views

MatLab: Plotting Output Electric Field Spectrum

Goal This code combines two matrices, diagonalizes that matrix, and finds the right and left eigenvectors, right and left eigenvectors are normalized with respect to each other, then it is multiplied ...
Mate's user avatar
  • 31
8 votes
4 answers
2k views

Simulation of a falling ball

I made a simple simulation of a falling ball. Is it possible to somehow improve or optimize this code? What tips can you give for development? ...
TuleKr1s's user avatar
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
13 votes
2 answers
5k views

A Flappy bird Game

Here is a project that I have been working on for the past few days. I have used the SFML library in C++ to make a flappy bird game of my own. I made this as a ...
user avatar

15 30 50 per page
1
2
3 4 5
11