Calculus

http://d2l.ai/chapter_preliminaries/calculus.html

Exercise 1

The derivative of:

\ x^3-\frac{1}{x}
is:

\ 3x^2-(-\frac{1}{x^2}

At x = 1 we get y = 0 and a slope for the tangent of 4
The tangent will have an intercept of -4 and an equation of 4x-4

To plot:

def f(x):
    return(x**3-1/x)

#div by 0 error at x=0, so we use x=0.1 
x = np.arange(0.1, 3, 0.1)
fig = plot(x, [f(x), 4 * x-4], 'x', 'f(x)', legend=['f(x)', 'Tangent line (x=1)'])

The image will be:
2_Prelim 4_Calc 1_Ex

To save this image add this line to the beginning of the plot function:

    fig = d2l.plt.figure()

and a return to the end:

    return fig

and this after making the plot:

fig.savefig("2_Prelim 4_Calc 1_Ex.jpg")

Exercise 2

I appreciate any corrections!

Exercise 3

Explaination:

use the chain rule:

Exercise 4