physics

In sympy, simplify an expression using a canonical commutation relation

╄→尐↘猪︶ㄣ 提交于 2020-01-06 04:31:27
问题 I have a ladder operator â, which satisfies this commutator relation with its own adjoint: [â, â⁺] = 1 In sympy I have written this code: import sympy from sympy import * from sympy.physics.quantum import * a = Operator('a') ad = Dagger(a) ccr = Eq( Commutator(a, ad), 1 ) Now I need to expand and simplify an expression like this: (â⁺ + â)⁴ If I just use ((ad + a)**4).expand() , sympy doesn't use the commutator relation. How do I simplify the expression while using the canonical commutator

Change a SKPhysicsBody's body shape

為{幸葍}努か 提交于 2020-01-03 21:08:45
问题 I don't want to change ANYTHING other than the body that defines the shape of a SKPhysicsBody. How do I do this? I can't seem to find where I can change this. Or even commentary on how to change it. Yes, I know this has to be done carefully, so that it avoids all possible new collisions, overlaps, etc. But putting that aside, how do I change the body of an SKPhysicsBody? 回答1: You can manually create a custom shape for a physics body using CGMutablePath , then pass it into the SKPhysicsBody

Angle that a moving ball will bounce off of an inert ball

眉间皱痕 提交于 2020-01-03 15:49:27
问题 Let there be two balls, one of which is moving about in the Cartesian coordinate plane, while the other is stationary and immobile. At some point, the moving ball collides with the inert ball. Assuming the moving ball is traveling in a straight line, how can one derive the new angle that the moving ball will be propelled given the following information: The moving ball's center coordinates (X0, Y0), radius (R0), and angle of travel before impact (A0) The stationary ball's center coordinates

Joints break when zooming

こ雲淡風輕ζ 提交于 2020-01-02 16:20:44
问题 I've been rehearsing Sprite Kit lately and I've come across a very strange problem. When zooming (changing the scale of) the parent node, bodies that are joined together by SKPhysicsJointPin separate from each other gradually and then joints break. Let me show you the images. This is for the normal state: Here's when zoomed in: And here's when zoomed out: If you ask how I join bodies: I join the brown sticks to the blue nodes on the center of the blue nodes. Any ideas what my problem is? EDIT

Joints break when zooming

落爺英雄遲暮 提交于 2020-01-02 16:18:47
问题 I've been rehearsing Sprite Kit lately and I've come across a very strange problem. When zooming (changing the scale of) the parent node, bodies that are joined together by SKPhysicsJointPin separate from each other gradually and then joints break. Let me show you the images. This is for the normal state: Here's when zoomed in: And here's when zoomed out: If you ask how I join bodies: I join the brown sticks to the blue nodes on the center of the blue nodes. Any ideas what my problem is? EDIT

how to prevent [circle] body from sliding into 0px gaps between static bodies

点点圈 提交于 2020-01-02 13:18:30
问题 So I have this body that is a circle collider and it has sometimes a big velocity the problem is that the tiled map of the boundaries is made of small tiles and at high velocity the body goes through it here is my config of all bodies: const config = { inertia: Infinity, // do not spin friction: 0, // X*100% stop on hit frictionAir: 0, // X*100% slow on move restitution: 0.5, // bounce X*100% on hit collisionFilter: this.level.getCollisionFilter(), // default collision filter isStatic } ...

Physics bra-ket symbols in IPython

倖福魔咒の 提交于 2020-01-01 17:23:11
问题 I am trying to have the ket symbol which is usually written in latex as \ket{\psi} . However, this doesn't work when written within the $$ ... $$ . This also doesn't work when written using IPython.display . 回答1: $ latex ** \documentclass{article}\usepackage{amsmath}\begin{document} ... chatter chatter ... * \show\ket > \ket=undefined. So your \ket macro is coming from some package or other which I don't know what it is. This doesn't explain why it doesn't work in $$ ... $$ -- you have to

Physics bra-ket symbols in IPython

谁说胖子不能爱 提交于 2020-01-01 17:21:08
问题 I am trying to have the ket symbol which is usually written in latex as \ket{\psi} . However, this doesn't work when written within the $$ ... $$ . This also doesn't work when written using IPython.display . 回答1: $ latex ** \documentclass{article}\usepackage{amsmath}\begin{document} ... chatter chatter ... * \show\ket > \ket=undefined. So your \ket macro is coming from some package or other which I don't know what it is. This doesn't explain why it doesn't work in $$ ... $$ -- you have to

Physics bra-ket symbols in IPython

那年仲夏 提交于 2020-01-01 17:21:08
问题 I am trying to have the ket symbol which is usually written in latex as \ket{\psi} . However, this doesn't work when written within the $$ ... $$ . This also doesn't work when written using IPython.display . 回答1: $ latex ** \documentclass{article}\usepackage{amsmath}\begin{document} ... chatter chatter ... * \show\ket > \ket=undefined. So your \ket macro is coming from some package or other which I don't know what it is. This doesn't explain why it doesn't work in $$ ... $$ -- you have to

Solar System Simulation Project (velocity verlet help)

▼魔方 西西 提交于 2020-01-01 17:14:14
问题 For my modelling and simulation class project, I want to simulate a solar system. I'm starting with just a star (sun) and a planet (earth), but I'm running into a few problems already. I've spent some time now just reviewing and learning about different formulas and way to simulate how the planet's orbits will be affected by the star and surrounding objects. I want to use velocity verlet and eventually look into the n-body problem. I'm having numerous issues with my velocity verlet function.