function x = newton(f,x0,tol)
% Newton's method for a scalar equation f(x)=0
% 
%   Syntax: 
%           x = newton(f,x0,tol)
%   Arguments: 
%           f - function handle pointing to a function
%               which returns a real number y=f(x).  
%           x0 - a real number, the initial approximation
%           tol - a positive number, the tolerance 
%   Returns: 
%           x - a real number an approximate solution 
%   Description:
%           The program newton uses Newton's method to compute an 
%           approximate solution of the scalar equation f(x)=0.  
%           The file f.m must return a number y=f(x).  
%           The derivative  f'(x) is computed by the subfunction
%           derivative.m below.  
%           If the initial approximation x0 is sufficiently close 
%           to a root x_exact, then the program
%           computes an approximate solution x with the error
%           |x-x_exact| < tol.  
%   Examples: 
%          x = newton(@sin, 3, 1e-7) computes pi to 7 decimals
%
%          If the m-file funk1.m contains 
%          function y = funk1(x)
%          y=x.^2-2;
%
%          then the command 
%          x = newton(@funk1, 3, 1e-7) 
%          computes the square root of 2. 

%----------------------------------------------------------------------
%   Date created: 
%
%   Author:  
%------------------------------+---------------------------------------+

Write your program here! 


%--subfunction--------------------------------------------------------

Insert the program derivative.m here! 

function y=derivative(f,x)  und so weiter...
