function phi(x)
common B1, B2, B3, C1, C2, c, r21
common ieq

!x2 =x*x

if(ieq ==1) then

phi =log(4*x*x +3)

elseif(ieq ==2) then

phi =-1.2*x*x +1.9*log(4*x*x +3)

else

phi = (45*x**4 -109.5*x*x +117.125*log(4*x*x+3))/35.
endif

end


! ---------------
real function dphi(x)
common B1, B2, B3, C1, C2, c, r21
common ieq


if(ieq ==1) then
dphi =8*x/(4*x*x +3)

elseif(ieq ==2) then

dphi =-2.4*x +15.2*x/(4*x*x +3)

else	! ieq =3

dphi =(720*x**5 -336*x**3 +280*x)/(4*x*x+3)/35.
endif

end
