function taylorTest( zadatak, n, xx )
	% taylorTest( zadatak, n, x )
	% zadatak = 'log' | 'exp' | 'sh' | 'arctg' | 'sin'
	% n = broj clanova Taylorovog reda oko 0 [uoci: log = log(x+1)]
	% x = tocka u kojoj se racuna vrijednost
	%
	% primjer: taylorTest( 'log', 5, 0.5 ) racuna 5 clanova T.reda za log(1+x) i vrijednost u tocki x=0.5
	clc
	syms x;
	
	fprintf( 'Taylorov red za %s, n = %d: ', zadatak, n );
	
	if( strcmp( zadatak, 'log' ) )
		p = taylor( log( 1+x ), n, 0 )
	elseif( strcmp( zadatak, 'exp' ) )
		p = taylor( exp( x ), n, 0 )
	elseif( strcmp( zadatak, 'sh' ) )
		p = taylor( sinh( x ), n, 0 )
	elseif( strcmp( zadatak, 'arctg' ) )
		p = taylor( atan( x ), n, 0 )
	elseif( strcmp( zadatak, 'sin' ) )
		p = taylor( sin( x ), n, 0 )
	end
		
	fprintf( 'Vrijednost funkcije u tocki %f pomocu Taylorovog reda: ', xx );
	x = xx;
	subs( p )
	
	fprintf( 'MATLAB vrijednost funkcije u tocki %f: ', xx );
	if( strcmp( zadatak, 'log' ) )
		log( 1+xx )
	elseif( strcmp( zadatak, 'exp' ) )
		exp( xx )
	elseif( strcmp( zadatak, 'sh' ) )
		sinh( xx )
	elseif( strcmp( zadatak, 'arctg' ) )
		atan( xx )
	elseif( strcmp( zadatak, 'sin' ) )
		sin( xx )
	end
	
	fprintf( 'ocjena za R_(n+1)(x) = ' );

	if( strcmp( zadatak, 'log' ) )
		err = @(x)( x^(n+1) / (n+1) );
	elseif( strcmp( zadatak, 'exp' ) )
		err = @(x)( x^(n+1) / factorial(n+1) );
	elseif( strcmp( zadatak, 'sh' ) )
		err = @(x)( cosh( x ) * x^(n+1) / factorial(n+1) );
	elseif( strcmp( zadatak, 'arctg' ) )
		err = @(x)( x^(n+1) / (n+1) );
	elseif( strcmp( zadatak, 'sin' ) )
		err = @(x)( x^(n+1) / factorial(n+1) );
	end
		
	abs(err( xx ))
end
