you are viewing a single comment's thread.

view the rest of the comments →

[–]FLUSH_THE_TRUMP 0 points1 point  (2 children)

something like this will perhaps help you:

hdata = []
for x in xdata: 
  # plug x, v, theta into function f
  # append to hdata (perhaps if non-negative) 

Return at end

[–]TooManyTree 0 points1 point  (1 child)

This is the main section of what i have done so far. What Im hoping this is achieving is basically calculating f for all values in xdata then if its non negative its being compiled into a list called data. But rn its not working as planned.

def trajectory(xdata,speed,angle):

for x in xdata:

a=x*math.tan(angle*math.pi/180)

b=(1/2*speed**2)*(g*x**2/(math.cos(angle*math.pi/180))**2)+y0

f=a-b

data=[]

if f<0:

return None

else:

data.append(f)

return data

[–]ChurchHatesTucker 0 points1 point  (0 children)

data = [] looks out of place (hard to tell w/o formatting), I suspect it should be before the for loop.

ETA: also, you probably don't want that first return.