# Centripetal acceleration with vector components

I'm working on solar system simulation and I need to implement centripetal acceleration. The problem is I don't know how it looks like in vector form. I mean I have these formulas:

1. Velocity $$velocity.x = initialVelocity.x + (acceleration.x * motionTime.x)\\ velocity.y = initialVelocity.y + (acceleration.y * motionTime.y)\\ velocity.z = initialVelocity.z + (acceleration.z * motionTime.z)$$

2. Position $$position.x = initialPosition.x + ((initialVelocity.x * motionTime.x) + (acceleration.x * (motionTime.x * motionTime.x) * 0.5f))\\(...)$$

I'm looking for similiar form for centripetal acceleration. Now I have: $$acceleration.x = ((velocity.x * velocity.x) / distance) * direction.x\\(...)$$ But it doesn't work. Could you help me?

• I think you have everything you need in your first two sets of equations. There is no force called "centripetal force" in the sense that there is a gravitational force, an electrostatic force, a normal force, a tension force, etc. The centripetal force is the resultant of all the real forces, not a separate thing. You are good to go, as long has you have the gravitational acceleration correct. – garyp Oct 19 '16 at 19:12
• Time is a scalar and does not have 3 components. All $motionTime$ values should be the same. – ja72 Oct 19 '16 at 23:02

## 1 Answer

In your situation, the only force acting on your planets will be the gravitational attraction from the sun. (This is not perfectly true, because all the other planes will cause acceleration too, but usually we can ignore this.

Anyway, you will be able to calculate the force of gravity by Newton's law of universal gravitation.

$$F_{gravity} = \frac{G M_{sun}M_{planet}}{r^2}$$

where r is the separation of the planet and the sun. Once you have the force acting on the planet, divide by $M_{planet}$ to get its acceleration.

It seems like your method is of simulation is numerical, so from my experience you will probably want a time step on the order of a few seconds.