using Plots function compute_f_and_df(f,a,b,h) x = a:h:b y = f.(x) dy = (f.(x.+h) .- y)./h dy[end] = (y[end] - f(x[end]-h))/h return x, y, dy end function plot_f_and_df() f(x) = exp(2*x) x,y,dy = compute_f_and_df(f(x),a,b,h) #or a = 0 b = 2pi h = 1e-2 p = compute_f_and_df(g(x),0,2pi,1e-2) x,y,dy = plot(x,y,label="f(x)") plot!(p,x,dy,label="f'(x)") p return p end plot_f_and_df() """ This is how your submission for the exam should look like, you create a function that computes everything you want, and another one that bundles everything. If your scripts aren't written like that but they are correct it is fine but I am stressing this point so you don't end up fighting more errors. This is the cleaner and preferred way! """