physics

Cannot differentiate wrt a complicated variable in Sympy

僤鯓⒐⒋嵵緔 提交于 2021-02-16 05:27:38
问题 (I understand the title makes this sound like a duplicate question to Sympy Can't differentiate wrt the variable, but I'm fairly certain it is quite different. I apologize in advance if I am mistaken) I'm trying to solve the Double Pendulum using Hamiltonian Mechanics, but Sympy is having trouble taking one of the derivatives. The code is below, but it's much easier to read the iPython Notebook over at nbviewer.ipython.org from __future__ import division from sympy import * init_session() r_1

Moving a 2D physics body on a parabolic path with initial impulse in unity

送分小仙女□ 提交于 2021-02-10 05:10:27
问题 What I have: A projectile in Unity 5 2D, affected by gravity, that I want to move from point A to point B with initial impulse on a parabolic path What I know: The 2D coordinates of a random starting position (A) The 2D coordinates of a random target position (B) The time (X) I want the body to reach the target position after What I want to know: The initial impulse (as in unity applyforce with forcemode impulse) that I have to apply to the body onetime in order for it to reach the desired

Sphere-plane collision resolve

↘锁芯ラ 提交于 2021-01-29 17:49:50
问题 I want to write a c++ program that will calculate collision between sphere and plane. The rule is that the angle of the falling object equals to angle of reflection. What do I have for sphere: //sphere coordinates and radius float x; float y; float z; float r; //sphere velocity vector projections float vx; float vy; float vz; Plane is described by plane equation coefficients: float A; float B; float C; float D; With sphere-plane collision detection I have no problem. But how to find velocity

SpriteKit physics applyImpulse in direction

孤者浪人 提交于 2021-01-29 15:01:49
问题 I am using the spriteKit-s physics engine. I have 2 objects on the screen, (say player and enemy). Now I am trying to use the applyImpulse method on enemy, which is supposed to pull it towards the player. CGFloat radians = [Utilites pointPairToBearingDegrees:self.enemy.position secondPoint:self.player.position]; CGVector vector = CGVectorMake(500*cosf(radians), 500*sinf(radians)); [self.enemy.physicsBody applyImpulse:vector]; However this applies force in wierd directions. Not consistent at

Find an angle to launch the projectile at to reach a specific point

ぐ巨炮叔叔 提交于 2021-01-29 10:32:15
问题 So, Dani in his slightly new video -> "Making a Game, But I Only Have 3 Days" (https://youtu.be/S7Dl6ATRK2M) made a enemy which has a bow and arrow (at 5:39). I tried to recreate that but had no luck... I also can't find the website that he used... Today I found this https://physics.stackexchange.com/questions/56265/how-to-get-the-angle-needed-for-a-projectile-to-pass-through-a-given-point-for-t. It worked very well but still had problems if the target was far away and also it wasn't as

How to create 'billiard ball' reflection boundary condition in python?

岁酱吖の 提交于 2021-01-29 06:51:13
问题 According to Erwin Schrodinger (in What is Life?), diffusion can be explained entirely by the random motion of particles. I want to test this myself by create a program the creates a time-step visualization of the diffusion of "gas molecules" in a closed container. The initial conditions would have two partitions, one with low and one with high concentration. After t0 the partition is removed and the gas is allowed to diffuse. The only mechanism I want to use is adding displacement random

Numerical integration: Why does my orbit simulation yield the wrong result?

我的未来我决定 提交于 2021-01-28 18:01:42
问题 I read Feynman's Lecture on Physics Chapter 9 and tried to my own simulation. I used Riemann integrals to calculate velocity and position. Although all start-entry is same, my orbit look's like a hyperbola. Here is lecture note: https://www.feynmanlectures.caltech.edu/I_09.html (Table 9.2) import time import matplotlib.pyplot as plt x=list() y=list() x_in=0.5 y_in=0.0 x.append(x_in) y.append(y_in) class Planet: def __init__(self,m,rx,ry,vx,vy,G=1): self.m=m self.rx=rx self.ry=ry self.a=0 self

Is it possible to implement Newton's Dot Notation (or Lagrange's Prime Notation) in sympy?

浪子不回头ぞ 提交于 2020-12-05 08:27:04
问题 Leibniz's notation can just be a bit cluttering, especially in physics problems where time is the only variable that functions are being differentiated with respect to. Additionally, is it possible to not display the (t) for a function like x(t) with sympy still understanding that x is a function of t and treating it as such? 回答1: You can use the mechanics module, which was designed around Newtonian physics. In particular, dynamicssymbols will give you a symbol which implicitly depends on t .

Is it possible to implement Newton's Dot Notation (or Lagrange's Prime Notation) in sympy?

烈酒焚心 提交于 2020-12-05 08:26:49
问题 Leibniz's notation can just be a bit cluttering, especially in physics problems where time is the only variable that functions are being differentiated with respect to. Additionally, is it possible to not display the (t) for a function like x(t) with sympy still understanding that x is a function of t and treating it as such? 回答1: You can use the mechanics module, which was designed around Newtonian physics. In particular, dynamicssymbols will give you a symbol which implicitly depends on t .