I am attempting to identify point at which upward and downward trends with data sets start and end, these trends can happen at any given point within the X axis. For example with the given data set, we can see that an upward trend started from point x = 1 until x = 10, subsequently after that we had a downward trend from x = 11 until x = 20 and from then on an upward trend. Surely there is a mathematical way to accomplish this?
x = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
y = [2,5,7,9,10,13,16,18,21,22,21,20,19,18,17,14,10,9,7,5,7,9,10,12,13,15,16,17,22,27]
thanks in advance