From: Mather on
Hi, all

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

From: Daniel Lichtblau on
Mather wrote:
> Hi, all
>
> 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

One approach ise to use interpolating functions, and check for jumps in
the second derivative. In the example below I imported your data (using
"Table" format), and worked from there as below.

In[138]:= ff = Interpolation[data];
gg[t_] = ff''[t];
d2vals = Table[{t, gg[t]}, Evaluate[{t, Sequence @@ dom, .1}]];
pairs = Partition[d2vals, 2];
bigdiffs = Select[pairs, Abs[#[[2, 2]] - #[[1, 2]]] > 1 &];
Map[Mean[{#[[1, 1]], #[[2, 1]]}] &, bigdiffs]

Out[143]= {1.46, 3.26}

There are probably also some reasonable ways to do this sort of thing
using Fourier or convolution.

Daniel Lichtblau
Wolfram Research

From: Bill Rowe on
On 10/28/09 at 4:08 AM, sdzbbjhd(a)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(a)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(a)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(a)data}, data[[{1, -1}, 1]]]

Out[6]= {3.31,1.51}

And finally, the plot

ListPlot[data,
GridLines -> {Rescale[kinks, {1, Length(a)data}, data[[{1, -1}, 1]]],
None}]

verifies the solution


From: DrMajorBob on
It took ten wasted minutes to put that in Mathematica format, which you
should have done already.

The next question is: "What's a kink?" I can see them in a plot:


data = {{0.01, 1.544163223920461*10^-6},
{0.11, 2.7525893580512636 10^-7},
{0.21, 6.8152995392824515 10^-6},
{0.31, 4.972729284187191 10^-6},
{0.41000000000000003, 6.886896332247575 10^-6},
{0.51, 5.028506319197025 10^-7},
{0.61, 1.765869426703084 10^-6},
{0.71, 4.084953122120491 10^-7},
{0.81, 8.908881820563147 10^-6},
{0.91, 3.0059189773700746 10^-7},
{1.01, 1.3790439392802757 10^-6},
{1.11, 8.354283708355008 10^-6},
{1.21, 7.190698243278427 10^-7},
{1.31, 3.792514692609191 10^-7},
{1.41, 2.5758219258643325 10^-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}};
ListPlot(a)data

But what's the mathematical definition you'd like to apply?

I can compute interpolated derivatives:


Clear[f, x]
f[x_] = Interpolation[data][x];
derivatives = f' /@ data[[All, 1]]

{-0.000105706, 0.0000533416, 0.0000504733, -0.0000198743, \
-2.25781*10^-6, -0.0000521806, 0.0000166407, 0.0000149181, \
0.0000444045, -0.0000823082, 0.000046585, 0.0000308789, \
-0.0000763849, 0.0000172154, 0.0191227, 0.330944, 0.955759, 0.743701, \
0.706272, 0.674401, 0.646861, 0.622038, 0.599188, 0.577704, 0.557219, \
0.537501, 0.518455, 0.499807, 0.481592, 0.463485, 0.446009, 0.428442, \
0.386178, 0.204258, -0.0522747, -0.000456524, 0.000114252, \
-0.0000348425, -0.0000864441, -0.000507196}


But that's arbitrary. The default InterpolationOrder is 3, but another
order could have been used instead... and how big a change in derivative
implies a "kink"?

Maybe 0.1?

Round[derivatives, 0.1]

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.3, 1., 0.7, 0.7, 0.7, \
0.6, 0.6, 0.6, 0.6, 0.6, 0.5, 0.5, 0.5, 0.5, 0.5, 0.4, 0.4, 0.4, 0.2, \
-0.1, 0, 0, 0, 0, 0}

Round[Rest@# - Most@# &[derivatives], 0.1]

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.3, 0.6, -0.2, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.2, -0.3, 0.1, 0, 0, 0, 0}

Maybe that will get you started, but you need a firm definition of "kink".

Bobby

On Wed, 28 Oct 2009 04:08:18 -0500, Mather <sdzbbjhd(a)hotmail.com> wrote:

> Hi, all
>
> 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
>


--
DrMajorBob(a)yahoo.com

From: ADL on
This might work:

data = ImportString["... your data ...", "Table"];
{x, y} = Transpose[data];

(*finds the x corresponding to maximum y*)
maxPos[xli_?VectorQ, yli_?VectorQ] := xli[[Flatten[Position[yli, Max
[yli]]]]];

(*finds the x corresponding to minimum y*)
minPos[xli_?VectorQ, yli_?VectorQ] := xli[[Flatten[Position[yli, Min
[yli]]]]];

(*computes a balanced derivative*)
dd[x_] := ListCorrelate[Join[{-1}, Table[0, {1}], {1}]/2, x];

(*computes a 3-moving average*)
mm[x_] := MovingAverage[x, 3];

(*computes the second derivative*)
ddx = mm(a)mm@x;
ddy = dd(a)dd@y;

maxPos[ddx, ddy]
==> {1.51}

minPos[ddx, ddy]
==> {3.31}

ADL


On Oct 28, 10:09 am, Mather <sdzbb...(a)hotmail.com> wrote:
> Hi, all
>
> 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!
> ...