anchor.diff:  end program pendulum
   
   !*********************************************************************!
  -! Callbaclk function for approximation of jacobian using finite-diff
  +! Callback function for approximation of jacobian using finite-diff
   !*********************************************************************!
   subroutine residual2(q, qdot, f)
   
  
positive.code:         !-------------------------------------------------------------!
  
          !jac = get_jacobian(body1)  ! actual jacobian
          
          jac = finite_difference2(q, q_dot, aa, 1.0d-6) !finite diff
          
          !-------------------------------------------------------------!
          !--------------------SOLUTION TO LINEAR SYSTEM ---------------!
          ! (a) Direct solution
  
negative.code:   call disp(" >> Setting initial state of the body...")
  
    call random_seed(); call random_number(q); call random_number(q_dot);
    q_dot = q_dot**2
  
    ! mass of the body
    mass = 2.0_dp
  
    ! used to calculate the inertial properties J and C
    re   = (/ 0.1_dp, 0.2_dp, 0.3_dp /) 
  
  