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
1 answer

How to calculate (count) number of orbits from positional data?

I have the x,y position of a body that makes roughly circular orbits around a known point. Is there an algorithm that will give me the number of orbits this body makes over time if I feed it a vector of x,y positions? I don't care about variations…
Ryan Hope
  • 502
  • 2
  • 14
1
vote
2 answers

Why does this programmatically generated musical chord not sound correct?

I have the following class which generates a buffer containing sound data: package musicbox.example; import javax.sound.sampled.LineUnavailableException; import musicbox.engine.SoundPlayer; public class CChordTest { private static final int…
Deomachus
  • 179
  • 1
  • 10
1
vote
0 answers

Imaging simulation slice and adding a shape

I have been making slice images of a simulation, now I need to add a shape to the image, the slice has a colour map, I add a circle to the slice, I need help with making the circle colour be adjustable by values, and share the same colormap as the…
1
vote
3 answers

How to write physics equation in HTML

I'm having a problem to represent below physics equation using just HTML tag So, How to represent above equation into HTML without using mathjax...?? Thanks in advance :) I have tried this code :
Maryadi Poipo
  • 1,418
  • 8
  • 31
  • 54
1
vote
3 answers

Solving physics problems symbolically with Maxima

I am trying to solve some basic physics problems using Maxima, but I am running into problems. I want the code below to yield 600 (as the solution to T2), but it just gives an empty list ([]). solve([ (P1*V1)/T1 = (P2*V2)/T2, V1 = V2, P1…
kuruczgyurci
  • 130
  • 8
1
vote
2 answers

Slimming Down a Calculator Program

I'm planning on creating a calculator for physics that would run off of a few equations. But, I realized that it would be a lot of code. With the equation v = x/t (just one of many I want to include) , there's already three possible equations. v =…
1
vote
1 answer

How to calculate the trajectory of bullet in Unity2D?

I'm doing the 2D game with bullets moving in parabola, but before I shoot the projectile I want to be able to calculate its trajectory. float velocity = Mathf.Min(Mathf.Max(distance, 1), 2.5f); float cos = Mathf.Cos(…
Pawelsar1
  • 83
  • 1
  • 3
  • 9
1
vote
1 answer

Bullet Motion Physics and Math to Java (Javafx)

I have a problem with my code. There are a Methods to shoot a bullet and update UI in game. The problem is that: My code doesn't work as I had imagined infact the bullet make a traiectory and Parabolic path but not always the calculated function is…
1
vote
0 answers

How to reduce memory useage when solving system of 9 coupled PDE

I have a system of coupled partial differential equations as shown in 1. system of equations If one writes the equations componentwise, one gets nine equations. For simplicity, one can set $\rho$ and $h$ constant. I put the equations into a…
Peter
  • 11
  • 3
1
vote
2 answers

2D moving object collision

I 'm creating a two 2D simulation and I need to determine if 2 moving objects A and B will cross paths . A moves with a constant speed Va and B with Vb. I'm able to determine the point where the the object's path intersect but I can't figure out if…
john do
  • 13
  • 4
1
vote
1 answer

Iteratively Smoothing Changes in Position

I have an entity which has noise in its movement. The entity is heading straight toward a target entity and I am trying to estimate how long it will take for it to reach its goal. I am trying to estimate the velocity of the entity by looking at its…
jmasterx
  • 52,639
  • 96
  • 311
  • 557
1
vote
0 answers

My boxes are not colliding

I am making a game engine in java, and am using the separate axis theorem to do collision. There is something wrong where it sometimes doesn't register the collisions. Does anyone see anything wrong with my collision program? public…
1
vote
1 answer

Odeint non-consistent over multiple periods, modeling driven pendulum

There seem to be many questions addressing pendulum modelling and odeint. I believe this question is specific enough to stand by itself. It's concerned with passing a time array to odeint. I'm modelling a driven, damped pendulum. I expect transient…
zahbaz
  • 183
  • 7
1
vote
2 answers

workaround to local functions in c++ for numerical integration

For a physics related calculation, I need to evaluate numerically a four dimensional integral that depends on several parameters that need to be varied; such that they can't be globally defined. I am using the Cuba package which provides the…
Jack
  • 247
  • 3
  • 10
1
vote
1 answer

Modelize a spring Python

I need to model a spring in Python for one of my classes at the university and it doesn't really work. I've the second order differential equation and I translated it in 2 first order ones to have a system. Can someone look my code and give me an…
Isabella P
  • 19
  • 1
1 2 3
99
100