Javascript Button Onclick Function With Horizontal Derivative And Inflection