% [INTRO_OCTAVE_02.tex] <[FORM_INTRO_OCTAVE.tex] 2014.06.29
% This  IS the modified form from <ma famille>
% The sections heading are those of  52 [sect-01.tex] 



%%%%%%%%%%%%%%%%%%%% INPUT OF *.MAC FILES   %%%%%%%%%%%%%%%%%%%
% CONTENTS OF THE THREE *.MAC FILES
% [format.mac]  shortcuts for horizontal and vertical spacings (\th,\mni), special symbols (\club)
% [fonts.mac]   fonts%
% [macros.mac]  boxes, time stamp, fractions

\input fonts.mac   
\input format.mac
\input macros.mac

\input pstricks  % need for centring
\input epsf      % need for importing eps5.94 in 
    
    \topglue  0pt       % p. 156
    \topskip  -10truept % p. 141  % this works for my famille

\nopagenumbers
 \pageno = 5   %
\headline = {\centerline
                 {\running \ifnum \pageno > 5 Section 02: Common functions
		        \fi} 
	    } % end headline 
% the foot line appears on the first page of the section	
 \footline = {\centerline
                   {\ssi \folio } 
              } % end footer
%
\vsize =  8.50 in      
{\hsize = 5.94 in    
		%  FOR 8.5 X 11
		%\vsize =   21.6 truecm        = 8.50 in   
		%{\hsize =   15.1 truecm      = 5.94 in \pni
\voffset = 1.0truecm  % linux
\hoffset = 0.70truecm  % linux

\topskip = 20 pt   
\baselineskip = 14pt    % default = 12pt		

%%%%%%%%%%%%%%%%%%%%%%%% SOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\rm
%
%%Type . 
%\phantom{header}

\centerline{\bfsixteen Section 02: Common functions}   %  title of section
%
\vskip 12pt
%
\centerline{\bf Trigonometric functions}
\mni
{\bf sin({\tt a})},   {\bf cos({\tt a})},   {\bf tan({\tt a})}.\q [{\tt a} is 
measured in radians, multiply by ${180}\over{\pi}$ for degrees]
%
\bni
%
\centerline{\bf Logarithmic functions}
\mni
%\pni
The ``natural logarithm'', usually written ln({\tt a}): {\bf log({\tt 
a})}
\pni
The logarithm to the base 10: {\bf log10({\tt a})}
%
\bni
%
 \centerline{\bf pi,   e,  complex numbers}
%
 \sni
%
 {\bf pi}
%
 \sni
%
{\bf e}:  the base of the ``natural logarithm''
%
\sni
%
{\bf i}:  $\sqrt{-1}$
%
%    FORM FOR OUTPUT	
\mni
%
{\tt  %  for programs
\obeylines
\parindent = 0pt
\parskip =  -1.0 pt  %was-2.5pt THIS LEAVES MORE SPACE
octave:1> {\bf pi}
\qq\q ans =  3.1416
\%
\%\qq e, the base of the ``natural logarithm''
octave:1>{\bf  e}  
\qq\q ans =  2.7183
\%
\%\qq   always use {\bf (\en )}, even when not strictly necessary
octave:2> (e){\bf \^{}}(2)
\qq\q ans =  7.3891
\%
\%\qq square root of a negative number
octave:3> {\bf sqrt(}-5{\bf)}
\qq\q ans =  0.00000 + 2.23607i
\%
\%\qq  cube of a complex number
octave:5> (2 -5i){\bf\^{}}(3)
\qq\q ans = -142 +  65i
} % end \tt  %  for programs
%
\bni
\centerline{\bf Displaying the answer}
\mni
Octave stores values to a very high degree of accuracy. If you 
want to see the answer to
15 places, use {\bf format long}.
%
\mni
%
{\tt  %  for programs
\obeylines
\parindent = 0pt
\parskip =  -1.0 pt  %was-2.5pt THIS LEAVES MORE usually writtenSPACE
octave:3> format long
octave:4> pi
\qq\q ans =  3.14159265358979
%
} % end \tt  %  for programs
\mni
To show your answer in ``scientific'' (``floating point'') notation use:\pni
{\bf format short e}\pni
\qq or\pni
{\bf format long e}
\sni
To show the answer to 2 decimal places,  use:\pni
{\bf format bank} [money in dollars and cents is shown to 2 decimal places]
%
\mni
%
{\tt  %  for programs
\obeylines
\parindent = 0pt
\parskip =  -1.0 pt  %was-2.5pt THIS LEAVES MORE SPACE
octave:6> format short e
octave:7> 1/7
\qq\q ans =  1.4286e-01
\%
octave:8> format long e
octave:9> 1/7
\qq\q ans =  1.42857142857143e-01
\%
octave:10> format bank
octave:11> 1/7
\qq\q ans = 0.14
%
} % end \tt  %  for programs
\bni
\centerline{\bf Absolute value,  rounding the answer etc.}
\mni
 absolute value: {\bf abs}\gl({\tt a})\pni
 round to the nearest integer: {\bf round}\gl({\tt a})\pni
 round downwards:         {\bf floor}\gl({\tt a})\q [=\th ``greatest integer function'']\pni
 round upwards:           {\bf ceil}\gl({\tt a})\pni
 round towards 0 :              {\bf fix}({\tt a})\pni
% sign function:  {\bf sign}({\tt a}). This takes on the values 
% 1,0,-1 %depending on whether {\tt a}> 0,
% {\tt a}=0,  {\tt a} < 0\th.\pni       
\sni
The following function is not built-in;
we will create  it in the next section.
\pni
 \bibl decimal part: {\bf decimal}( ) 
%
\bni
Octave has  many more built-in functions, and we will see some of these when we talk about vectors 
and matrices.
\bni
%
\centerline{\bf Try these}
%    	
\sni
\item{1.} Find $\log_{10}\Bigl({10\,}^{271.6}\Bigr)$.
\sni
\item{2.} Compute ${10\,}^{0.5}$. Compare the answer with the Octave square root 
command:
{\bf sqrt}(10).
\sni
\item{3.} Evaluate the numbers  2.71 and -2.71, first  using the
definitions of {\bf abs}, {\bf round}, {\bf floor},
 {\bf ceil}, {\bf fix} and {\bf sign} and then by using Octave.
%
% %%%%%%%%%%%%%%%%%%%%% KEEP THIS ENDING!!!  % %%%%%%%%%%%%%%%%%%%%% 
\vfill\eject 
%%
            }     %  ends \rm
	    \par} % ends \hsize
	    \bye