uphill shooting

Back to General discussions forum

Suman Dutta     2020-05-31 05:32:39

ans given- 60 68 64 104 76 80 124 76 133 my ans- 60 68 64 104 76 80 124 76 132 last case is not matching? v=45, A=58 data given - 0,0,0,0,0,0,0,1,2,2,3,3,4,4,4,4,4,5,6,7,7,8,9,9,9,9,9,10,11,12,13,14,14,15,16,16,16,16,16,17 can anyone help?

sontran     2020-05-31 06:09:22

My code returns 133 (for 133.37988392860854). Height of slope = 60. Height of projectile = 59.99948474497313.

Suman Dutta     2020-05-31 06:15:08

can u tell me what changes needed for this?

Suman Dutta     2020-05-31 06:19:57
y=x*math.tan(A*math.pi/180)-(9.81*x*x)/(2*v*v*math.cos(A*math.pi/180)**2)

this is my equation..if I put x=133 i get y=60.26..why?

sontran     2020-05-31 06:21:39

I have no idea what's wrong with your code. I can help you debug. What are your parameters (x, y, slope height, t) that outputs x=132?

sontran     2020-05-31 06:28:34

It seems your code is working there. At x = 133, y = 60.26 is > slope. At my answer x = 133.37988392860854, your formula also returns correct y. The motion is a parabola.

Suman Dutta     2020-05-31 06:32:04

x is basically my x cordinate which I am increementing by 1 each time y is height of projectile I am checking if 4times the above list is less than equal to y; untill then count is increemented so ans is 4 times the count I am getting this is my algo

sontran     2020-05-31 06:38:25

For x=133, 134 the height of the slope = 60. From your formula, x=133 is > 60 (no hit) and x=134 < 60 (hit). So it should output the correct x=133. It seems some control structure is the issue with your code.

Please login and solve 5 problems to be able to post at forum