# -*- coding: utf-8 -*-
"""
Created on Mon Aug  1 14:15:47 2022

@author: Chris

Lab 1 Question 9 
"""
import numpy as np
import matplotlib.pyplot as plt

"""
Function definitions
"""

def myfun(x):
    myfun = x**2*np.sin(1/x)
    return myfun


""" Main Script starts"""

h = 1e-7    # choose optimum stepsize

x = np.linspace(-1,1,500)

dfdx = (myfun(x+h)-myfun(x))/h #numerical derivative

plt.plot(x,dfdx)

    






