! Ecuatia sagetii 1, 2 ,3 - MAIN

Program SAG

use DFLIB
real l, l2, K
character(80) dummy
character(260) nume1, char1*1

common B, C, ieq

logical alta_incarcare

EXTERNAL SUB


print '(a,\)', 'Fisier intrare: '
read(*,'(a)') nume1

open (1, file =nume1, status='old', form='formatted')
90 read(1, '(a80)') dummy
if(dummy(1:1) =='/' .and. dummy(2:2) =='/') then
goto 90
else
backspace 1
endif

read(1,*) l, E, A, f0, q0
read(1,*) eps, lnit, kod_print
read(1,*) q_start, q_end, q_step		! cazuri

read(1,*) ieq

if(ieq >3) ieq =3


lnit0=lnit
kod0 =kod_print

! Constante:
EA =E*A
l2 =l*l

x0 =f0/l
B0 =q0*l/EA

C =B0/x0 -phi(x0)


write(1, '(//, a, I1)') 'Ecuatia sagetii - ', ieq

write(1, '(/, a, /)') ' Incarcare		 f_Ecuatie         Df'


100 DO q= q_start, q_end, q_step

! Ec. sagetii:
lnit =lnit0; kod =0;
!kod =kod0
B  =q*l/EA			! pt. Ec-3

!lnit =lnit0
!kod = 0
call Newton(SUB, x0, eps, lnit, x, kod)

f =x*l
df =f -f0

write(1,*) q, f, df

if(kod_print /=0) then
write(1,'(t59, a,I2,a,i5)')	'kod =',kod, ';  iter =',lnit
endif

ENDDO


print '(/, a, \)', ' Alta incarcare ? (Y, y / char): '
read(*, '(a1)', err =500) char1

alta_incarcare =char1 =='Y' .or. char1 =='y'

if(alta_incarcare) then
! Read*,q
print'(a)',' Introdu: q_min, q_max, q_pas (q, 0, 0 = pt. o singura incarcare):'
read*, q_start, q_end, q_step
	if(q_end ==0 .and. q_step ==0) then
	q_end =q_start
	q_step =1
	endif
goto 100
endif


500 close(1)

END
