p2.c:
#include <math.h>
 
typedef struct
{
  double x, y;
}
XY;
/*
Valentine Heart, from MAA Monthly, Feb. 2008, page 113,
r = |tan(t)|**(1/|tan(t)|), 0 <= t <= pi
*/ 
XY f1( double t)
{
  XY r; double a;
 
  a = fabs( tan(t));
 
  if( a != 0)
    a = pow( a, 1/a);
 
  r.x = a*cos(t);
  r.y = a*sin(t);
 
  return r;
}
 
 
XY (*f[])(double) = { f1, 0};