Questions tagged [physics]

Refers to real-world physics. For simulation of physics in games use the [game-physics] tag instead, for questions using an existing physics engine use [physics-engine]. Physics is a science that studies the interactions of energy and matter. Questions with this tag concern the simulation or implementation of real-world physics concepts in programming.

The physics tag should be used for questions about how physics can be simulated or implemented in programming. Please ask questions about physics in a non-programming context on the Physics site. Also consider that questions specific to a simplified or approximate physics engine for use in games might receive better answers if asked on Game Development.

3476 questions
1
vote
0 answers

Numpy: how do I loop a computation over looped arrays?

I am really new to python and numpy as it is the first real programming language I use. Before I started using it I only worked with Mathematica to do my assignments, but since we have to do numerical computations now Mathematica isn't really the…
1
vote
1 answer

Smoothed Particle Hydrodynamics - Particle Density Estimation Issue

I'm currently writing an SPH Solver using CUDA on https://github.com/Mathiasb17/sph_opengl. I have pretty good results and performances but in my mind they still seem pretty weird for some reason…
Mathias B.
  • 343
  • 2
  • 12
1
vote
1 answer

Using time stamps as input to Neural Networks to reconstruct particle tracks

So here's the thing: consider a detector, made of several vertical strings, each hosting 60 sensors distributed equidistantly, as shown in the following picture (dark dots are sensors): Particles will then flow through and produce pulses on each…
1
vote
2 answers

suitable formula/algorithm for detecting temperature fluctuations

I'm creating an app to monitor water quality. The temperature data is updated every 2 min to firebase real-time database. App has two requirements 1) It should alert the user when temperature exceed 33 degree or drop below 23 degree - This part is…
Alex Johnson
  • 69
  • 1
  • 7
1
vote
1 answer

How can I automatically get both the signal and error from edges in EELS spectra?

Is there some DM-script function, or any other way, to obtain both the signal integral and the error of the signal integral from a Spectrum-Image or series of background-subtracted EELS Spectra? I am analysing a series of EELS spectra in…
1
vote
1 answer

Balloon string inverse kinematics

I have a simulation where I have balloons bouncing around the screen with a string attached to each one. it functions like a constraint. The string should obey gravity, such that if the balloon isn't max length, there should be slack hanging down.…
Luple
  • 481
  • 3
  • 21
1
vote
1 answer

Physics Simulations in Java

Are there any good books that teach how to make simple physics simulations in Java?
kachilous
  • 2,499
  • 11
  • 42
  • 56
1
vote
1 answer

SKShapeNode update physics body on touch

I'm currently developing a IOS game using SpriteKit. I have a background which is SKShapeNode. Basically the path of this shape is a bezierPath with some curves. This path can be updated by the player using the touchBegan or touchMove trigger. -…
John smith
  • 355
  • 4
  • 17
1
vote
1 answer

How do I make my ActionScript 3 Pool Game more realistic with Box2dFlash?

Here is my pool game engine done in Box2dFlash. I would like to make this simulation more realistic as I received mixed opinion from pool experts. Here is my standard wall setting: var leftWall = _sim.addBox({x:0.9, y:8.15, width: 0.6, height:…
mirzahat
  • 1,025
  • 2
  • 10
  • 19
1
vote
1 answer

Why won't these collisions sense? (Swift SpriteKit)

In my project I am trying to detect a collision between two SKSpriteNodes, but it will not work. Here is my code for the physics category : struct PhysicsCategory { static let enemy : UInt32 = 0x1 << 1 static let player : UInt32 = 0x1 << 3 static…
Jason
  • 93
  • 9
1
vote
0 answers

Numpy: different values when calculating a sum of a sequence

I'm using scipy.integrate's odeint function to evaluate the time evolution of to find solutions to the equation $$ \dot x = -\frac{f(x)}{g(x)}, $$ where $f$ and $g$ are both functions of $x$. $f,g$ are given by series of the form $$ f(x) = x(1 +…
Waldinian
  • 11
  • 1
1
vote
0 answers

MPI coupling application

I am working in a parallel program for simulating a couple physics problem where I have to create different communicators and inter-communicators. Let's say I have a program A and program B. I can have many processors executing A and B. The…
gagiuntoli
  • 475
  • 5
  • 13
1
vote
0 answers

Overlap Integral of the electric field distributions in Matlab

Let E1 is electric field distributions of the desired mode. E2 is the polarized transverse electric field, where E1 and E2 both are represented by MxM matrices of complex numbers. How to calculate the Overlap Integral (OI) of E1 and E2 in…
shdotcom
  • 125
  • 1
  • 1
  • 11
1
vote
0 answers

Unity3D: Collider expands when the game starts

In the past days, I learned how to animate and good ways to create them and after a while, a little gap between the player attracted my attention. (No gap when the game hasn't started) (A little gap when the game has started) First, I searched…
1
vote
0 answers

Variational Monte Carlo for 1-d harmonic oscillator

Here's a code that I wrote to find the ground state energy of an harmonic oscillator. To avoid round-off error and so I wrote the schrodinger equation in Atomic system unit: H= -d2/dx2 + 1/2x^2 Here's the code: import numpy as np from random import…
user5910827