function dzdt = polar_deriv ( t, z )

%*****************************************************************************80
%
%% polar_deriv() evaluates the right hand side of polar_ode().
%
%  Discussion:
%
%    The variable Z(t) is complex, and has the formula:
%
%    theta = t;
%    r = 1 - sin(theta) * cos(3*theta)
%    z = r * exp ( i * theta )
%    dzdt = ( drdt + i * r ) * exp ( i * theta ) 
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 March 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real T, complex Z: the time and solution value.
%
%  Output:
%
%    complex DZDT: the derivative value.
%
  theta = t;
  r = 1.0 - sin ( theta ) * cos ( 3.0 * theta );
  drdt = -       cos ( theta ) .* cos ( 3.0 * theta ) ...
         + 3.0 * sin ( theta ) .* sin ( 3.0 * theta );

  dzdt = ( drdt + i * r ) .* exp ( i * theta );

  return
end

