% fil1.m
% fd, 07 novembre 2006, 03 mars 2025. 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  numerisation de la solution analytique. 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear ; format long 
   
hold off 
toto = [0:.01:6] ; theta = .8231  %% .53
y=cosh(theta*toto) - cosh((1-theta)*toto) ; 
% plot ( toto , y , 'b;;' , toto , toto , 'b;;') ; pause 
x = 8  ;

niterNewton = 7 
for j = 1 : niterNewton ; 
f = cosh(theta*x) - cosh((1-theta)*x) - x  ; 
fp = theta*sinh(theta*x) - (1-theta)*sinh((1-theta)*x) - 1 ; 
x = x - f / fp ; 
end ; beta = x 
long  = ( sinh((1-theta)*x) + sinh(theta*x) ) / x 
p = 1 -  cosh(theta*beta) / beta

n=200 ; dx=1/n ;  x = zeros(1,n+1) ;  y=x ;  
for j = 1 : n+1 ; 
xx = (j-1)*dx ; x(1,j:j) = xx ;  
y(1,j:j) =  cosh(beta*(xx-theta)) / beta  + p  ; end ;

plot ( x ,  y , '*b;;') 
title ('Chainette numerique ; solution analytique.') ;
axis ( [ -.01 , 1.01 , -.21  , 1.05 ] ) ; 
print('01-chainette-numerique', '-djpg','-S891,630'); 
 
