Python Forum

Full Version: data science
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a dataframe with billions of stars, and i would like to narrow it down using equations. I need to find which stars are moving at escape velocity from their galactic coordinates in order to find which objects will have a significant enough gravitational pull on the star to alter its course so it has to be moving at the proper 3 dimensional velocity. My friend is working on the galactic coordinates equation and i am new to python and need to plug the formula into the dataframe could somebody show how to put an equation in to python with multiple steps.

The equation would be a basic 3d velocity equation which i would explain but the equation looks like this apparently but we do not have the end position. x y and z are different vectors like tangential velocity, radial velocity etc
dx = endPosition.x - startPosition.x
dy = endPosition.y - startPosition.y
dz = endPosition.z - startPosition.z


d = sqrt(dx*dx + dy*dy + dz*dz)

vx = dx/d * missileSpeed
vy = dy/d * missileSpeed
vz = dz/d * missileSpeed