	SUBROUTINE TITAN(DAY,I,R)

C	SOUS PROGRAMME DE CALCUL DES COORDONNEES DIFFERENTIELLES 
C	RECTILIGNES EQUATORIALES B1950.0 DE MIMAS PAR RAPPORT A
C	LA PLANETE SATURNE
C	EN ENTREE :
C	*    DAY= DATE JULIENNE OBSERVATION EN JOUR FRACTIONNAIRE
C	*      I= INDICE DE LA THEORIE DU MOUVEMENT DU SATELLITE
C	ADOPTEE POUR CHAQUE ELEMENT ORBITAL ET PETITE VARIATION
C	        =1 G.STRUVE(1930)
C	        =2 Y.KOZAI (1957)
C	        =3 M.RAPAPORT(1977)PLANS DATE
C	        =4 I.G.CHUGUNOV (1984)
C	        =5 H.A.GARCIA (1972)
C	        =6 A.T.SINCLAIR (1977)
C	        =7 G.DOURNEAU (1987)
C	EN SORTIE :
C	*   R (K) = COORDONNEES RECTILIGNES EQUATORIALES B1950.0 
C	R(K=1,3)=DX,XY,DZ PAR RAPPORT A LA PLANETE SATURNE EN U.A. 

C	TRANSMISSIONS PAR COMMON A ETIQUETTE

C	*  COMMON/BLKTIVAL : ELEMENTS DE TITAN

	IMPLICIT REAL*8(A-H,O-Z)
	CHARACTER*8 NOMSAT(8),NOM(8,24)
	REAL*8 N0SN
	DIMENSION EL(8,24),E0(8),AN(8),TETA0(8),GPI0(8),
	1 EX(8),AI(8),AA(8),TETAV(8),GPIV(8),TKOM(8),TKI(8),
	1 R(3),OMEG50C(8),ANGI50C(8),OMEG50V(8),ANGI50V(8),
	1 AMAJAPET(8),COEFOMJA(8),COEFIMJA(8),COEFGPIV(8)

	COMMON/BLKPI/PI,DPI,DEGRAD,RADEG
	COMMON/BLKDAT/DATE50,DATE2000,ANJBES
	COMMON/BLKTIVAL/E0,AN,TETA0,GPI0,EX,AI,AA,TETAV,GPIV,
	1 OMEG50C,ANGI50C,OMEG50V,ANGI50V,
	2 AMAJAPET,TKI	!	AMAJAPET: MASSE DE JAPET(EN UNITE DE MASSE DE SATURNE)

	EQUIVALENCE (EL(1,1),E0(1))

	DATA SAN/0.03346D0/	
	DATA DS/9.538937D0/
	DATA EPS/1.D-06/
	DATA B/0.374D0/

C	FIN DES DATA

	DT50=(DAY-DATE50)/36525.
	DJ1=DAY-2411368.
	DT1=DJ1/365.25
	T=DT50*100.+1950.
	TS=(DAY-2415020.)/36525.
	TS2=TS*TS
	
C	CALCUL DES ELEMENTS DU SOLEIL VU DE SATURNE 
C	A PARTIR DE LA CONNAISSANCE DES TEMPS
C	CALCULES DANS L'EQUATEUR ET L'EQUINOXE 1950.0(SINCLAIR,1977)

	SEX=0.05589232-0.00034550*TS
	SANOM=175.4762+1221.5515*TS
	SANOM=(DMOD(SANOM,360.D0))*DEGRAD
	SI=(2.4925-0.0039*TS)*DEGRAD
	SOM=(112.79039+0.8732*TS)*DEGRAD
	CALL DANNO(DAY,DATE50,SOM,SI,SOM,SI,AR1,AR2,AR3,AR4)
	SLONG=(267.2635+1222.1136*TS)
	SLONG=(DMOD(SLONG,360.D0))*DEGRAD

C	Perturbations solaires et dues a JAPET d'apres H.STRUVE(1898) p.167

	IF (I.EQ.7)THEN
	COEFGPIV(I)=0.506/GPIV(I)
	TKOM(I)=-0.1074*COEFGPIV(I)!	Perturbations seculaires solaires
	TKI(I) =-0.6200*COEFGPIV(I)!			"
	COEFOMJA(I)=-0.1045*COEFGPIV(I)!Perturbations seculaires
	COEFIMJA(I)=-0.0662*COEFGPIV(I)!dues a Japet
	ELSE IF ((I-2)*(I-3)*(I-4)*(I-5)*(I-6).EQ.0)THEN
	TKOM(I) = - 0.1418
	TKI(I)  = - 0.6204
	ELSE IF (I.EQ.1)THEN
	TKOM(I) = - 0.11345
	TKI(I)  = - 0.61562
	END IF
	IF (I.NE.7)AMAJAPET(I)=0.

	IF((I-7)*(I-3).EQ.0)TETAV(I)=-GPIV(I)

	OMEG50=(OMEG50C(I)+OMEG50V(I)*DT50)*DEGRAD
	ANGI50=(ANGI50C(I)+ANGI50V(I)*DT50)*DEGRAD
	CALL DANNO(DATE50,DATE50,OMEG50,ANGI50,
	1OMEG0,ANGI0,ANGN0,ANGJ0,POMEG0,DOM0)
	TETA=TETA0(I)+TETAV(I)*DT1
	TETA=(DMOD(TETA,360.D0))*DEGRAD
	GPIM = GPI0(I)+GPIV(I)*DT1
	AI0=AI(I)*DEGRAD
	TOM=OMEG0+(TKOM(I)+AMAJAPET(I)*COEFOMJA(I))*DEGRAD
	1 +(SIN(AI0)*SIN(TETA))/SIN(ANGI0)
	TI=ANGI0+(TKI(I)+AMAJAPET(I)*COEFIMJA(I))*DEGRAD
	1 +SIN(AI0)*COS(TETA)
	TJ=TOM-SOM
	CALL FORTRI(TI,TJ,SI,GGAM,GTETA,GPSI,SOM)
	GPSI=DMOD(GPSI,DPI)
	N0SN=SAN/AN(I)
	TAAC=AA(I)*DS*DEGRAD/3600.

C	DERIVATION DES DIFFERENTES THEORIES

	IF(I.NE.6)THEN    !   TOUTES LES THEORIES SAUF SINCLAIR

C	CALCUL DES PERTURBATIONS DE TITAN PAR METHODE CLASSIQUE
C	G CALCULE PAR ITERATIONS SUCCESSIVES A PARTIR DE G0 
C	A L'EPOQUE T = 1890.0 = JD 2411368.0

	TOM0=OMEG0+(TKOM(I)+AMAJAPET(I)*COEFOMJA(I))*DEGRAD
	1 +(SIN(AI0)*SIN(TETA0(I)))/SIN(ANGI0)
	TI0 =ANGI0+(TKI(I)+AMAJAPET(I)*COEFIMJA(I))*DEGRAD
	1 +SIN(AI0)*COS(TETA0(I))
	TS0 =(2411368.0-2415020.0)/36525.
	SOM0=(113.35-0.2597*TS0)*DEGRAD
	TJ0 =TOM0-SOM0
	SI0 =(2.4891+0.002435*TS0)*DEGRAD
	CALL FORTRI(TI0,TJ0,SI0,GGAM0,GTETA0,GPSI0,SOM0)
	IF((I-5)*(I-7).EQ.0)THEN
	G0=GPI0(I)*DEGRAD-TOM0-GPSI0
	G0=DMOD(G0,DPI)
	IF(G0.LT.0)G0=G0+DPI
	ELSE	!	I # 5,7
	G0 = 103.199D0 * DEGRAD
	END IF	!	(I-5)(I-7)
	G0D=G0*RADEG

C	EN PREMIERE APPROXIMATION G = G0

	G = G0   
	IF((I-1)*(I-5)*(I-7).EQ.0)THEN	!	ITERATION SUR G0
	IT1=0

C	A LA DATE T ON A :

20	IT1=IT1+1
	IF((I-7)*(I-5).EQ.0)THEN
	GPI = GPIM + (B/(2.*GPIV(I)))*(SIN(G+G)-SIN(G0+G0))
	ELSE IF(I.EQ.1)THEN
	GPI = GPIM + 0.36666 * ( SIN(G+G)-SIN(G0+G0) )
	END IF
	
	GPI = (DMOD(GPI,360.D0))*DEGRAD
	IF(GPI.LT.0)GPI=GPI+DPI
	G = GPI-TOM-GPSI
	G = DMOD(G,DPI)
	IF(G.LT.0)G=G+DPI
	IF(IT1.EQ.1)THEN
	G1 = G
	GO TO 20
	ELSE IF(ABS(G1-G).GT.EPS)THEN
	G1=G
	GO TO 20
	END IF
	
C	FIN ITERATION SUR G

	IF(I.EQ.1)THEN
	EX1 = EX(I) * (1 + 0.36666*DEGRAD*(COS(G0+G0)-COS(G+G)))
	ELSE	!	I = 5,7
	EX1 = EX(I) + (B/(2.*GPIV(I)))*DEGRAD *EX(I)
	1 *(COS(G0+G0)-COS(G+G))
	END IF

	ELSE IF((I-2)*(I-3)*(I-4).EQ.0)THEN
	G = GPIM*DEGRAD - TOM - 4.6 * DEGRAD
	GDPI = 0.36833 * ( SIN(G+G)-SIN(G0+G0) ) 
	G = G + GDPI * DEGRAD
	G=DMOD(G,DPI)
	IF(G.LT.0)G=G+DPI
	GDPI = 0.36833 * ( SIN(G+G)-SIN(G0+G0) ) 
	GPI = (GPIM + GDPI)*DEGRAD
	GPI=DMOD(GPI,DPI)
	IF(GPI.LT.0)GPI=GPI+DPI
	EX1 = EX(I) * (1 + 0.36833*DEGRAD*(COS(G0+G0)-COS(G+G)))	
	END IF

C	CALCUL DES PERTURBATIONS SOLAIRES.METHODE A.E.SUPL.P.375

	DGE = -3.*N0SN*(SEX*SIN(SANOM)+3.*SEX*SEX*SIN(SANOM+SANOM)/4.+
	1 15.*EX1*EX1*SIN(2.*(SLONG-GPI))/16.+
	2 3.*SIN(GGAM)*SIN(GGAM)*SIN(2.*(SLONG-GTETA))/16.)
	DTOM = 3. * N0SN * SIN(GGAM) * SIN(2.*SLONG-2.*GTETA+GPSI)/
	1 (8.*SIN(TI))
	DTI = 3. * N0SN * SIN(GGAM) * COS(2.*SLONG-2.*GTETA+GPSI)/8.
	DGPI = 15.* N0SN * SIN(2.*(SLONG-GPI))/8.
	DE = 15. * N0SN *EX1 * COS(2.*(SLONG-GPI))/8.

	AL1 = (E0(I) + AN(I)*DJ1)*DEGRAD
	IF(I.EQ.7)THEN
	AL1=AL1 + AI0 * TAN((ANGI0
	1 +(TKI(I)+AMAJAPET(I)*COEFIMJA(I))*DEGRAD)/2.)*SIN(TETA)
	ELSE IF(I.EQ.1.OR.I.EQ.3)THEN
	AL1=AL1 + 0.073166667*DEGRAD*SIN(TETA)
	END IF

	AL1 = DMOD(AL1,DPI)
	IF(AL1.LT.0)AL1=AL1+DPI
	ANOM1=AL1-GPI
	IF(ANOM1.LT.0)ANOM1=ANOM1+DPI

C	CALCUL DES ELEMENTS CORRIGES

	TEXC = EX1 +DE
	TALC= AL1+DGE
	TGPIC= GPI+DGPI
	TANOMC=TALC-TGPIC
	TANOMC=DMOD(TANOMC,DPI)
	IF(TANOMC.LT.0)TANOMC=TANOMC+DPI
	TOMC = TOM+DTOM
	TIC  = TI +DTI

	ELSE      !    (I.NE.6)  THEORIE DE SINCLAIR

	GPI = DMOD(GPIM,360.D0) * DEGRAD
	IF(GPI.LT.0) GPI=GPI+DPI
	GLS = SLONG - (GTETA-SOM)-SOM
	G = GPI-TOM-GPSI
	G=DMOD(G,DPI)
	IF(G.LT.0)G=G+DPI
	DGLSMG=GLS+GLS-G-G
	DATA C1E/0.000184D0/
	DATA C2E/0.000073D0/
	DE = -C1E*COS(G+G)+C2E*COS(DGLSMG)
	TEXC=EX(I) + DE
	DATA C1PI/0.00630D0/
	DATA C2PI/0.00250D0/
	DGPI = +C1PI*SIN(G+G)+C2PI*SIN(DGLSMG)
	TGPIC=GPI + DGPI
	DATA C1L/0.000176D0/
	DATA C2L/0.000215D0/
	DATA C3L/0.000057D0/
	DGE = - C1L*SIN(SANOM)-C2L*SIN(GLS+GLS)
	1 + C3L*SIN(GLS+GLS+GPSI)
	TALC=(E0(I)+AN(I)*DJ1)*DEGRAD 
	1 + SIN(AI0)*TAN(ANGI0/2.) *SIN(TETA) + DGE
	TALC=DMOD(TALC,DPI)
	IF(TALC.LT.0)TALC=TALC+DPI
	TANOMC=TALC-TGPIC
	IF(TANOMC.LT.0)TANOMC=TANOMC+DPI
	DATA CI/0.000232D0/
	DTI = + CI* COS(GLS+GLS+GPSI)
	TIC = TI  + DTI
	DATA COM/0.000503D0/
	DTOM = + COM * SIN(GLS + GLS + GPSI)
	TOMC = TOM + DTOM

	END IF    !  (I.NE.6)  FIN DES DERIVATIONS DES THEORIES
	
C	CALCUL DE TETA ET GAMA CORRIGES A PARTIR DE TOMC,TIC,TGPIC

	CALL ECOREQAN ( TOMC,TIC,TGPIC,OMEG0,ANGI0,POMEG0,TTETAC,
	1 TGAMAC,TPIC)
	CALL EECR (TAAC,TEXC,TGAMAC,TTETAC,TPIC,TANOMC,R)
	CALL ROTA(R,0.D0,-ANGJ0,-ANGN0)
	RETURN
	END
