Re: How to find the kinks in a list
- To: mathgroup at smc.vnet.net
- Subject: [mg104363] Re: How to find the kinks in a list
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 29 Oct 2009 02:56:48 -0500 (EST)
On 10/28/09 at 4:08 AM, sdzbbjhd at hotmail.com (Mather) wrote: >I want to get the two kinks in the following list, say, x=1.5 and >3.3 by Mathematica. However I have no idea which command to employ. >Can anyone help? Thanks in advance! >0.01 1.544163223920461e-6 0.11 2.7525893580512636e-7 >0.21 6.8152995392824515e-6 0.31 4.972729284187191e-6 >0.41000000000000003 6.886896332247575e-6 >0.51 5.028506319197025e-7 0.61 1.765869426703084e-6 >0.71 4.084953122120491e-7 0.81 8.908881820563147e-6 >0.91 3.0059189773700746e-7 1.01 1.3790439392802757e-6 >1.11 8.354283708355008e-6 1.21 7.190698243278427e-7 >1.31 3.792514692609191e-7 1.41 2.5758219258643325e-6 >1.51 0.00573372886943746 1.61 0.09069025128158258 >1.71 0.1678921607552329 1.81 0.24047592904187015 >1.9100000000000001 0.3094989860449043 >2.0100000000000002 0.37555342886640686 >2.11 0.43898726713721536 2.21 0.500041232643779 >2.31 0.5588795919592797 2.41 0.6156217903422918 >2.5100000000000002 0.6703511870298868 2.61 0.7231492006404858 >2.71 0.7740553083481225 2.81 0.8231311485576547 >2.91 0.8703722465175462 3.0100000000000002 0.9158530005108363 >3.11 0.9595743351972397 3.21 1.0015438350017574 >3.31 1.034334208101605 3.41 1.0346205212139916 >3.5100000000000002 1.0346175133605735 3.61 1.0346312322976905 >3.71 1.0346297067475791 3.81 1.0346299273452295 >3.91 1.0346026798402437 Here is one method. After putting your list of numbers into a variable, data, I can plot the differences in the y position. That is ListPlot[Diiferences@data[[All, 2]]] Given the uniform sampling on the x-axis, this plot is an approximate plot of the derivative of your data. Looking at this plot it is clear there is a big jump at each of the kinks. So, the position of the kinks in the data list can be obtained from In[5]:= kinks = Ordering[Abs@Differences@Differences[data[[All, 2]]], -2] + 1 Out[5]= {34,16} The reason for adding 1, is each application of Differences decreases the length of the original list by 1. These positions can be converted to x coordinates by In[6]:= Rescale[kinks, {1, Length@data}, data[[{1, -1}, 1]]] Out[6]= {3.31,1.51} And finally, the plot ListPlot[data, GridLines -> {Rescale[kinks, {1, Length@data}, data[[{1, -1}, 1]]], None}] verifies the solution