Source: https://www.hec.ca/en/cams/help/topics/Plotting_the_graph_of_a_function.pdf