 function y = f(theta)  % Case 1. Round Pool Problem
% 
%  angle                theta
%  radius               r
%  location of point p  xp
%  location of point q  xq
%
 r=12; xp=[5 8]; xq=[-5 8];
 st = sin(theta);
 ct = cos(theta);
 distp = sqrt((r*ct - xp(1)).*(r*ct - xp(1)) + ...
             (r*st - xp(2)).*(r*st - xp(2)));
 distq = sqrt((r*ct - xq(1)).*(r*ct - xq(1)) + ...
             (r*st - xq(2)).*(r*st - xq(2)));
 nump = xp(1)*st - xp(2)*ct;
 numq = xq(1)*st - xq(2)*ct;
 y= nump./distp + numq./distq;

% Case 2
% function y = f(x)

% y = 1/(x-3)-6;

% Test
%function [y] = f(x)
%y = x;