title: How to make a function that calculates newtons quotient for f(x) = exp(x) in R?
body: <p>I'm working on an assignment for class and I'm a little lost with trying to write a function out which will calculate Newton's quotient.
  This is what the questions is asking</p>
  
  <p>The derivative of a function <code>f(x)</code> can be approximated by the Newton's quotient <code>(f(x+h) - f(x))/h</code></p>
  
  <p>where <code>h</code> is a small number.  Write a function to calculate the Newton's quotient
  for <code>f(x) = exp(x)</code>.  The function should take two scalar arguments, <code>x</code> and <code>h</code>.
  Use a default value of <code>h=1e-6</code>.
  Test your function at the point <code>x=1</code> using the default value of <code>h</code>, and compare
  to the true value of the derivative <code>f'(1) = e^1</code>.</p>
  
  <p>So far I have written the code as so</p>
  
  <pre><code>x=1
  newton = function(x, h = 1e-06){
     quotiant = ((x+h) - x)/h
  
     return(x = exp(x))
  }
  
  y = newton(1,h)
  print(y)
  </code></pre>
  
  <p>I can see this is wrong, but I don't really understand how I can fix this, and what exactly I'm trying to calculate. </p>
  
  <p>I have also tried this code</p>
  
  <pre><code>x=1
  newton = function(x, h = 1e-06){
     quotiant = ((x+h) - x)/h
  
  
  }
  
  y = newton(1,h)
  print(y)
  </code></pre>
  
  <p>which I think gives me the right answer, but again I don't really understand what I'm calculating.</p>