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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
4 views

"Leadscrew" block in Simscape: is it possibile to convert this block to rotating nut and translating screw? How the physics is modeled by the block?

I have to model a physical system that uses a ballscrew to convert the motion of the rotating nut in the traslation motion of the screw. I'm using the block Leadscrew, but the results are not good and ...
Edoardo Levantino's user avatar
-1 votes
0 answers
23 views

Plot the solution of a non linear fredhholm integral equation of second kind [closed]

I have this trascendental function/integral equation that i´ve been trying to plot but i'm still not able to have a complete solution, the integrals must be Principal Value Sigma meson mass shift I ...
Rodolfo Chapa's user avatar
0 votes
0 answers
27 views

Unable to install Pybinding package

I am trying to install the pybinding package on my computer but when I try to pip install pybinding the following error pops up: File "C:\Users\angel\anaconda3\Lib\subprocess.py", ...
Matildes's user avatar
0 votes
0 answers
42 views

Calculating the length of a cord line based on forces

In 3D, I need to find the cord length based on forces that describe the cord. I tried to do this, based on the following code with the following inputs: H the constant horizontal force q_verti the ...
Tim Moore's user avatar
0 votes
0 answers
11 views

Interpolation for web swinging

I haven't made an implementation but I wondered if I could spherically interpolate the player's position with a point in front of the player and move the player towards the next point in the sleep? I ...
Nato's user avatar
  • 1
0 votes
1 answer
15 views

Roblox anchoring for a part instance not working

I have a long stretch of code here for a bomb script inside a tool that makes acid, but the acid does not anchor, the acid anchoring code piece is on line 41. Its supposed to make acid for an early ...
Genius G's user avatar
0 votes
0 answers
17 views

Block-spin transformation of 1D Ising model

In deriving the block-spin representation for the 1D Ising model (coarse graining the system to half the original size), we need to integrate out half of the degrees of freedom. I am wondering how the ...
EJD's user avatar
  • 1
-1 votes
0 answers
36 views

Matlab double sum

I want to calculate double sum of f(k,k') over k and k', in which k and k' are vectors with x and y components. Both k and k' lie in the 1st Brillouin zone: -pi<kx<pi, -pi<ky<pi, -pi<kx'...
karren lim's user avatar
0 votes
0 answers
19 views

Error ploting N index vs thickness for TM and TE modes using maxwells full equation

So my Python code for this is here, it only displays the graph at m = 4 and I need it to display for m = 0, 1, 2, 3, 4. import numpy as np import matplotlib.pyplot as plt from scipy.optimize import ...
Abel Stewart's user avatar
0 votes
0 answers
38 views

How to measure how much damage i do in a punch

Which unit do you think it would be best measured in? I dont know anything about physics... but im using an accelerometer and gyro on the wrist to figure out how hard your punch is. Should i use ...
Michael's user avatar
-1 votes
0 answers
53 views

Computing LJ force from LJ potential, or not?

Lennard-Jones force can be computed in two different ways: Version #1: Here, the force computation is a self-contained routine. Vec3 lj_force(const Vec3& r) { double r_mag = std::sqrt(r.x * r....
user366312's user avatar
0 votes
0 answers
65 views

Simulating a vibrating string: is divergence avoidable?

I am trying to simulate a Gaussian wave traveling down a 1-D string, with some wave velocity 1.0, until it hits x=0, where the string changes to have a wave velocity 0.5. My code currently is as ...
acdr's user avatar
  • 4,578
0 votes
0 answers
27 views

Dynamic & Kinematic Interaction Problem In Unity

ın uploaded "screenshot.png"image , the white box is dynamic rigid body and has mass and gravity , and the hinge under of it has kinematic body and makes a rotation -90 degrees as it shown ...
gngrmez34's user avatar
0 votes
0 answers
39 views

How do I make a fluid stay in its container using a simulation based on Jos Stam's paper?

I am making a 3D fluid simulation in JS/WebGL based on Jos Stam's papers. I believe everything is working except for either the boundary conditions, advection, or something above my expertise. My ...
giveearholdtongue's user avatar
0 votes
0 answers
10 views

How to resolve a collision between a rotating rectangle and an edge

I'm trying to work out the proper way to resolve collisions between a rectangle and an edge, At the moment I'm interested in resolving a collision of one of the rectangle's points with an edge, and ...
Dedsi's user avatar
  • 1
0 votes
1 answer
40 views

How do I more properly utilize useEffect and useFrame to calculate this n-body simulation?

I have been working on a brute force approach for a n-body simulation based on this exercise I stumbled upon: https://www.cs.princeton.edu/courses/archive/fall03/cs126/assignments/nbody.html The code ...
jerome's user avatar
  • 1
0 votes
0 answers
29 views

Re-binning counts in a histogram (Python)

I am working with two data sets (tof_n22 and tof_n30) in Python and I need to re-bin the data and plot it as another histogram. The two datasets are neutron time-of-flight data and I am trying to re-...
cr_007's user avatar
  • 41
0 votes
0 answers
41 views

Simulating Gaussian Bessel Beam Propagation in Matlab

I should preface this by saying I am not much of a programmer or physicist, so please bear with me. I am attempting to simulate the propagation of gaussian Bessel beam (as produced by an axicon) using ...
Bishop's user avatar
  • 1
2 votes
1 answer
40 views

Electric circuit with redundancies (power distribution) simulation

I need to simulate at basic level an electric circuit with redundancies, for example like this: We have two generators, a couple of power distributors and the devices. I am trying to simulate the ...
G123's user avatar
  • 23
-1 votes
0 answers
10 views

How do I use Newton's law of inertia to explain why tug of war would continue in one direction when theres an equal opposite force acting on it?

In a virtual lab, it was seen that if one person is on a team in tug of war with no opponent they continue in the direction they are pulling. However, without stopping another person is added on the ...
confused's user avatar
1 vote
1 answer
54 views

Overflow error in np.exp function for a curve_fit

I'm trying to fit a combined gaussian using the following code: def curve_f(x,a,b,c,d,e,f):   return (a*np.exp(((x-b)**2)/(2*-c**2)))+(d*np.exp(((x-e)**2)/(2*f**2))) The problem is that when I put ...
LuSanchzrh7's user avatar
0 votes
0 answers
10 views

How do spinning spheres elastically collide with rough planes in 3D?

I want to calculate the final angular (w) and linear velocity (v) of a sphere that collides with a plane. I assume no energy loss and no slipping occurs during the collision. (each vector has x y z ...
Andres's user avatar
  • 1
0 votes
0 answers
21 views

Reproject Black hole star perspective from hiDef microlensing image

I want to reproject HiDef black hole (BH) light whirpool back to perspective of stars from point of that BH itself. (Maybe to see our Galaxy from the point of that hole hundred years ago). How to ...
MiKor's user avatar
  • 11
1 vote
1 answer
107 views

Numerically finding a curve that satisfies an underdetermined set of equations

[partial cross-post from Mathematica Stack Exchange. Opening this here so I can in principal solicit non-mathematica solutions ideally in the numpy/scipy ecoystem here.] I am trying to determine a ...
jcp's user avatar
  • 241
0 votes
0 answers
47 views

1-D Heat difusion in python

I am attempting to compare the analytical and numerical solutions for heat diffusion in a rod using or infinity wall Python. The equation I'm working with is as follows: T_i^(i+1) = T_i^(i) * (1 - 2 * ...
Felipe da Costa Kraus's user avatar
0 votes
0 answers
23 views

How to use Matplotlib PLOT.in file to include legend in plot (produced by VASPKIT) / Plotting a .dat file using MPL?

I'm currently using VASPKIT to plot a .dat file. Example below: | #Energy XX(cm^-1) YY(cm^-1) ZZ(cm^-1) XY(cm^-1) YZ(cm^-1) XZ(cm^-1) 0.0000 0.00000000E+00 0....
Chloe Chan's user avatar
0 votes
0 answers
26 views

Three.js Cannon.js Cylinder rotates weirdly

I'm trying to use CANNON.js with three.js. All is working well with cube, sphere, and plane, but now when I try with Cylinder, it is rotating weirdly. I do NOT want to rotate the three.js object to ...
Halo's user avatar
  • 1,730
0 votes
0 answers
38 views

Can I calculate sun, moon and planet's azimuth and elevation using Pyephem?

I have been trying to find the azimuth and elevation angles of sun, moon, and planets upon entering time, lat long and date using PyEphem. However I am not getting the correct values. The time needs ...
MJay's user avatar
  • 25
1 vote
1 answer
46 views

Struggling to convert cartesian elements into orbital elements in Unity2D + keplerian solution to the two-body problem

Im building a game where i simulate planetary orbits in Unity 2D C#. I previously used newtons laws of gravitation but quickly discovered that rounding errors in floats can lead to massive orbital ...
Ethan's user avatar
  • 23
0 votes
0 answers
47 views

Why computing inverse trigonometric functions is cheaper than computing the functions themselves?

Long story short I ran the following code on my browser: function test(f) { const start = performance.now(); for (let i = 0; i < 1000000; i++) { f(i); } const end = performance.now()...
Matheus C's user avatar
0 votes
0 answers
29 views

How to simplify large tensor expressions with SymPy?

I'm trying to compute the Ricci tensor for the Kerr metric in Boyer-Lindquist coordinates. The calculation involves constructing several intermediate tensors including the Christoffel symbols of both ...
brayn's user avatar
  • 1
0 votes
0 answers
17 views

Compensate acceleration changes in a load cell's readings using an accelerometer

I'm reading weight with a load cell that's fixed on a moving body. Said body drives arround many uneven trails. I've tried using an accelerometer to compensate the vertical acceleration, making it so ...
user22360489's user avatar
0 votes
2 answers
66 views

E1/3 function in python?

I am analyzing some lab results with python and I need to fit the data to a distribution that includes the generalized exponential integral E1/3. The closest thing I could find besides calculating the ...
bloop's user avatar
  • 421
0 votes
0 answers
17 views

Collisionn response not working in JS with html canvas

I tried writing some physics with vanilla js to simulate collision of a particle inside a circular container on the HTML canvas the collision detection seems to be working fine but the collision ...
Rishiraj Mukherjee's user avatar
0 votes
0 answers
23 views

What should be in the Makefile for CosmoMC and ISiGTR?

I've been trying to install cosmomc with ISiGTR but I can't seem to make it work. Python GUI doesn't work, when I run cosmomc it throws an error saying Error :Ini_Open, file not found: MpiStop: ...
VADeR's user avatar
  • 27
0 votes
0 answers
39 views

Logic Errors in Isotropic Oceanic Turbulence

Logic error in creating turbulence phase screen N =1024; % sample number Lside=1; %length of the screen z=1; %propagation distance dx = Lside/N; % length of one pixel w=-2.5; %parameter of ...
Pooja's user avatar
  • 1
0 votes
1 answer
49 views

Exception from Chrono

I am new to Project Chrono and try to run the tutorials but got stuck in the first one. Here is the code: #include "chrono/physics/ChLinkMotorRotationSpeed.h" #include "chrono/physics/...
Frank ly's user avatar
0 votes
1 answer
30 views

How do I install and run CosmoMC?

I need to run a few scripts for GR using CosmoMC. I haven't used it before and I am not able to do anything in the instructions as I am getting errors at every step which I can't solve. I use vagrant ...
VADeR's user avatar
  • 27
1 vote
0 answers
48 views

Using `awkward` array to keep track of two different combinations of particles

I'm building on a previous question about the best way to use awkward efficiently with combinations of particles. Suppose I have a final state of 4 muons and my hypothesis is that these come from some ...
Matt Bellis's user avatar
2 votes
1 answer
35 views

Unity 2D Kinematic rigid body goes through dynamic rigid body

I am facing a weird 2D physics with Unity issue as demonstrated by the GIF below. The red objects are kinematic The green objects are dynamic The pink wall is static The red objects have a script that ...
Vishal Shah's user avatar
  • 1,069
1 vote
1 answer
110 views

Ball flick movement along a drawn path in Unity 3D space is not far enough

I'm creating a 3D soccer game in Unity, where the player can draw a path on the screen, and a soccer ball is supposed to follow this path in a 3D space. The path is supposed to consider the depth, ...
AND4011002849's user avatar
0 votes
1 answer
43 views

How to use Raycast in an additive scene with local physics?

Can Raycast really only be used on the main scene? If I load an additive scene with an indication of the local physics for the scene, then the methods of the Physics on the loaded scene are not ...
Максим Закревский's user avatar
0 votes
0 answers
20 views

Pytorch autograd for linear elasticity

I'm trying to solve the linear elastic problem, with the equilibrium governing equations given as follows: enter image description here Suppose I have the displacement matrix containing n point-wise ...
Daniel Chou's user avatar
0 votes
1 answer
78 views

Iterate over a n-dimensional numpy array which contains unknown number of numpy array as its values

I have a numpy array of the following form [[array([ 1. , 3.25, 5.5 , 7.75, 10. ]) 0 0] [0 array([ 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.]) 0] [0 0 0]] The array will be N dimensional,...
petika654's user avatar
-1 votes
2 answers
58 views

weird physics bug when a ball hits the left wall

for some reason when a ball hits the left wall it gains momentum i tried using "* -1" instead of "-" heres the code y = y + vel_y x = x + vel_x vel_y = vel_y + 1 if y >= 900: ...
jamham0's user avatar
  • 19
0 votes
0 answers
36 views

Combining two or more Unity colliders using Boolean algebra for the physics system

I have an object representing an old-fashioned cubic dice. These are approximately cuboidal, but with rounded corners and circular facets. I may need to roll a lot of these, and I don't want any ...
Ash's user avatar
  • 9,074
0 votes
1 answer
41 views

Problems with Vector.Reflect in Unity2D

I am working on a 2D top down project in Unity2D. Hoping to familiarize myself with the Unity physics engine I decided to give the player object physics based movement by applying force to the ...
Thirstymidget28's user avatar
0 votes
0 answers
23 views

object clipping in Javascript physics simulation

Following a few tutorials to create a physics sim with javascript and html. The goal is to spawn a number of different sized balls and when they spawn to have them fall to the bottom of the canvas and ...
Christian Woodard's user avatar
0 votes
0 answers
22 views

MatterJS + Mattter Attractor Plugin: Attract only certain bodies

I have built a very basic interactive sketch based on MatterJS and its plugin written by liabru. The idea is to choose the parent red bubble and three blue children by clicking on any on canvas. The ...
toowren's user avatar
  • 85
0 votes
1 answer
38 views

Sampling frequency for any Continous Signal on a Time Interval

While learning about Sampling Frequency I came across two definition First : The sampling frequency in a given time interval represents the number of samples taken per unit of time during that ...
karan ganeshwala's user avatar

1
2 3 4 5
70