how to calculate x and y co-ordinates when the body is moving downwards, while following elliptical equation

Viewed 53

Assuming that an object is moving vertically downwards as well along Y-axis at a velocity of lets say 0.5 m/s while following the elliptical equation,

major axis radius = 100 minor axis radius = 25

Body's initial position can be assumed to be at (x,y) = (175, 150). Ellipse Image

I know how to fetch co-ordinates o ellipse when it is not moving downwards.

a = 25

b = 100

h = 150

k = 150

$ x = \sqrt{a^2 -  {(y-k)^2 * a^2 \over b^2} } + h $

$ x = \sqrt{25^2 -  {(y-150)^2 * 25^2 \over 100^2} } + 150 $

  
# Python code:


t = np.linspace(0,360,360)
x = 150 + 25*np.cos(np.radians(t)) # 150 is major axis of ellipse
y = 150 + 100*np.sin(np.radians(t)) # 150 is minor axis of ellipse

# plt.plot(x,y)
# plt.show()

df = pd.DataFrame(list(zip(x, y)), columns = ['x', 'y'])

# remove duplicate rows
df = df.drop_duplicates(keep = 'first')

ax = sns.scatterplot(data = df, x = 'x', y = 'y')
ax.set_xlim(0, 400)
ax.set_ylim(0, 300)
plt.grid()
def solve_for_x(y):
    a = 25
    b = 100
    h = 150
    k = 150
    x1 = math.sqrt(a**2 - ( ( (y-k)**2 * a**2 )/b**2 )) + h
    x2 = - math.sqrt(a**2 - ( ( (y-k)**2 * a**2 )/b**2 )) + h
    # print(f'x = {x}')
    return x1, x2

This code will return both sides of ellipse.

But my question is how to calculate x and y co-ordinates when the body is moving downwards. I imagine the path traced will be a weird 2d spring like structure.

1 Answers

You have to define the angular speed of a point on your ellipse, and from that you can determine a new np.linspace array that will represent time. Then you can simply substract 1/2*g*time**2 from your y array to get the y-coordinates of points on the falling ellipse.

I added a colormap to represent the time too.

enter image description here

# Imports.
import matplotlib.pyplot as plt
import numpy as np

# Constants.
G = 9.81
ANGULAR_SPEED = 60 # °/s
SPINS = 2.5
POINTS = 10000

# "Physics!"
angle = np.linspace(0, 360*SPINS, POINTS)
x  = 150 + 25*np.cos(np.radians(angle)) 
ys = 150 + 100*np.sin(np.radians(angle)) # Static.
time = angle/ANGULAR_SPEED
yf = ys - 1/2*G*time**2

# Show the result.
fig, ax = plt.subplots()
# ax.set_aspect(1) # Optional: so that autoscaling doesn't squish our ellipse into a circle.
ax.scatter(x, ys, label="static ellipse")
ax.scatter(x, yf, label="falling ellipse", c=time, cmap="autumn")
ax.legend()
fig.show()

If you want to stick to a constant downward velocity, it's possible too:

enter image description here

# Constants.
...
VY = -200
...

# "Physics!"
...
yf = ys + VY*time
...
Related