# The Horizontal Position of the Cherry Pit Is

In a cherry-pit spitting competition, Ben stands at the edge of a hill that slopes downward at a 45 degree angle. He launches the pit with a velocity of 20 ft/sec, and his mouth is 6 feet above the ground.

What angle Θ would maximize the distance that the pit is launched? What distance is reached? How long is the cherry pit in the air?

The equation for the height of the cherry pit under the influence of gravity (g= 32 ft/sec2 ) as a function of time t (seconds) is

(1)

where v is the initial velocity (ft/s), h is the initial height (ft), and A (rads) is the launch angle.

The horizontal position of the cherry pit is

(2)

The distance down the slope will be

(2a)

The equation for the sloping ground is

(3)

The two curves intersect when

(4)

From the quadratic formula, the pit hits the ground after t0 seconds, given by

(5)

Using (5) in (2), the horizontal position of the pit when it hits the ground is

(6)

With the use of

(7)

Equation (6) can be manipulated into the following form:

(8)

Equation (8) gives the horizontal position of the cherry pit as a function of the launch angle A. To find the maximum value of x(A), take the derivative of (8), equate the derivative to zero, and solve for A.

The derivative of (8) is:

(9)

Setting equation (9) equal to zero, it can be written in the following form:

(10)

To solve (10), we can use a numerical method, Newton’s method (see http://en.wikipedia.org/wiki/Newton's_method for details). This iterative technique uses

(11)

In this case, f(x) is given by (10). But we also need the derivative of (10), which we find to be

(12)

The following matlab program implements Newton’s method, and solves for that angle A that maximizes the horizontal distance x. It starts with an initial guess for A= p/4, and uses k= 64*6/400= 1.96.

% computes x_new = x - f(x)/f'(x)

function [xx,yy,yp] = my_ff(x,k)

yy=(cos(2*x)-sin(2*x))*sqrt(sin(2*x)+k)+cos(3*x)-k*sin(x);

yp= -2*(sin(2*x)+cos(2*x))*sqrt(sin(2*x)+k)+...

(cos(2*x)-sin(2*x))*cos(2*x)/sqrt(sin(2*x)+k) - 3*sin(3*x)-k*cos(x);

xx= x-yy/yp;

% Use Newton's method to solve the cherry-pit problem

h= 6; % launch height ft

v= 20; % launch velocity ft/sec

k= 1+64*h/v^2

A= pi/4; % initial estimate for best angle = 45 deg

for ii=1:10

[x1,b,c]= my_ff(A,k);

disp(sprintf('%d %f rads %f deg',ii,x1,x1*180/pi));

if abs(x1-A)<1e-20 break; end;

A=x1;

end;

A= x1;

disp(sprintf('\n%d %20.18f rads %20.18f deg',ii,A,A*180/pi));

sca= v*(sin(A)+cos(A));

t= (sca + sqrt( sca^2+64*h))/32;

x= v*cos(A)*t;

d= sqrt(2)*x;

disp(sprintf('\n %20.18f seconds\n %20.18f ft\n %20.18f ft', t,x,d));

k = 1.960000000000000

1 0.236549 rads 13.553272 deg

2 0.361584 rads 20.717240 deg

3 0.352287 rads 20.184550 deg

4 0.352253 rads 20.182631 deg

5 0.352253 rads 20.182631 deg

6 0.352253 rads 20.182631 deg

6 0.352253358964785435 rads 20.182630787988987464 deg

1.811522377166622455 seconds

34.005813167606568470 ft

48.091482181154795228 ft

Published with MATLAB® 7.5

The program finds the optimum angle, the time in flight, and the distance down the slope= sqrt(2)*horizontal distance.