subroutine jfcn(t, y, jf)
use work
! Calculeaza jacobianul lui f_BDF
implicit real(8) (a-h,o-z)
real(8) y(n), jf(n,n)

! Ecuatia de test Dormand:
!
!ff(1) =1.0d0/y(1) - t**2 - 2.0d0/t**3
!ff(2) =y(1)/y(2)**2 - 1.0d0/t - 0.5d0/SQRT(t**3)

! fcn = c(0)*y(:) -h*ff(:)   +c(1)*xa(0,:) +c(2)*xa(-1,:) +c(3)*xa(-2,:) +c(4)*xa(-3,:) +c(5)*xa(-4,:)

! fcn(1) = c(0)*y(1) -h*1.0d0/y(1) +...

! fcn(2) = c(0)*y(2)  -h*(y(1)/y(2)**2) + ...

!     Jac(1,1) = -1.0d0/y(1)**2
!     Jac(1,2) =  0.0d0
!     Jac(2,1) =  1.0d0/y(2)**2
!     Jac(2,2) = -2.0d0*y(1)/y(2)**3

jf(1,1) =c(k,0) -h*(-1.0d0/y(1)**2);	jf(1,2) =0.D0;
jf(2,1) =-h*1.0d0/y(2)**2;				jf(2,2) =c(k,0) -h*(-2.0d0*y(1)/y(2)**3)

END subroutine jfcn

