#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 10 23:40:41 2018

@author: brandoncohn
"""
import matplotlib as plt
import math as ma
import numpy as np
#input values 
g=float(9.81) 
int_vel= int(input("Enter starting velocity in m/s:"))
angle= int(input("Enter angle in degrees:"))
int_h= int(input("Enter starting height in m:"))
if int_h <0:
    print("input must be zero or greater, Try Again")
if int_h<0:
    int_h= int(input("Enter starting height in m:"))    
    
print("Time step is given as 1 second")

#deg to rad
theata = angle*ma.pi/180

#breaking down velocity into x and y components;
vel_x = int_vel*ma.cos(theata)
vel_y = int_vel*ma.sin(theata)

#putting time step intervals into list then in an array
s = np.array = ([0,1,2,3,4,5,6,7,8,9,10,11,12])
t =12
#Range equation
D = int_vel*ma.cos(theata)* t

#max height equation
Hmax = int_h + (int_vel**2)*((ma.sin(theata)**2))/(2*g)

#Having items in array mutliplied by x and y equations for plot
for a in np.array:
   x = np.multiply (a, vel_x)
   print(x,"meters")
#error with y equation
d = (vel_y * 1 - .5*-g*(1**2))
for a in np.array:
    y = np.multiply(a,d)
print(y,"meters above ground")


print("Max height is:",Hmax, "meters")
print("Range is:",D,"meters")
print("total time:",t, "s")

plt.figure()
plt.scatter(x,y)
plt.show()

