function ShowFmins(A1,P1,phi1,A2,P2,phi2,trace,steptol,ftol)
%
%  Pre:  (A1,P1,phi1) and (A2,P2,phi2) are orbits.
%        trace, steptol, and ftol effect the fmins call
%
%  Post: Applies Fmins to the Sep function. If trace is nonzero,
%        then intermediate results are displayed. Termination
%        if the iterates are close w.r.t. steptol and
%        the difference between function evaluations is small
%        w.r.t. ftol.
%        
%
% Usage: ShowFmins(10,2,pi/8,4,1,-pi/7,1,.000001,.000001)

  
  plist   = [A1 P1 phi1 A2 P2 phi2]; 
  options = [trace steptol ftol];
  
  % Plot Orbits
  
  Orbit(linspace(0,2*pi),A1,P1,phi1,'-');
  hold on
  Orbit(linspace(0,2*pi),A2,P2,phi2,'--');
  
  % Enter Starting Points
  
  z0 = zeros(2,1);
  t0 = zeros(2,1);
  title('Enter starting point on solid orbit')
  [z0(1),z0(2)] = ginput(1);
  [t0(1),Orb1] = PtOnOrb(z0,P1,A1,phi1);
  plot(Orb1(1),Orb1(2),'*')  
  title('Enter starting point on dashed orbit')
  [z0(1),z0(2)] = ginput(1);
  [t0(2),Orb2] = PtOnOrb(z0,P2,A2,phi2);
  plot(Orb2(1),Orb2(2),'*')
  title(' ')
  pause(.01)
  

  % Iterate
  
  [t,options] = Fmins('Sep',t0,options,[],plist);
  
  % Show Solution
  
  Orb1 = Orbit(t(1),A1,P1,phi1,'o');
  Orb2 = Orbit(t(2),A2,P2,phi2,'o');
  plot([Orb1(1) Orb2(1)],[Orb1(2) Orb2(2)])
  hold off
  its = options(10);
  gval = norm(gSep(t,plist));
  title(sprintf('t = ( %8.6f , %8.6f ),  Iterations = %3.0f,  norm(gradient) = %5.3e',t,its,gval))
  
