function dydt = unstable_deriv ( t, y )

%*****************************************************************************80
%
%% unstable_deriv() evaluates the derivative of unstable_ode().
%
%  Discussion:
%
%    This function defines the ODE
%      [ y1 ]' = [    mu  1/mu ] * [ y1 ]
%      [ y2 ]    [ -1/mu    mu ]   [ y2 ]
%
%    with the initial condition 
%
%      [ y1 ] = [ 1 ]
%      [ y2 ]   [ 0 ]
%
%    The eigenvalues of the matrix are lambda = mu+i/mu, mu-i/mu
%
%    The first component of the exact solution is:
%
%      y1(t) = e^(mu*t) ( cos(t/mu) - mu^2 sin(t/mu))
%
%    Although the solution blows up in time, the backward Euler method
%    drives it to zero almost instantaneously.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 October 2021
%
%  Author:
%
%    Catalin Trenchea
%
%  Input:
%
%    real T, Y(2): the arguments.
%
%  Output:
%
%    real DYDT(2): the value.
%
  u = y(1);
  v = y(2);

  [ mu, t0, y0, tstop ] = unstable_parameters ( );
  
  dudt =         mu * u + 1.0 / mu * v;
  dvdt = - 1.0 / mu * u +       mu * v;

  dydt = [ dudt; dvdt ];

  return
end

