[SciPy-user] concave and convex function
mudit sharma
mudit_19a@yahoo....
Sun May 17 08:50:23 CDT 2009
Thanks for your response.
By M & W curve I meant M & W shape curves( subset ) and by cycle I meant wave cycle.
----- Original Message ----
From: "josef.pktd@gmail.com" <josef.pktd@gmail.com>
To: SciPy Users List <scipy-user@scipy.org>
Sent: Sunday, 17 May, 2009 8:32:17
Subject: Re: [SciPy-user] concave and convex function
On Fri, May 15, 2009 at 9:10 PM, mudit sharma <mudit_19a@yahoo.com> wrote:
>
> I have following sample (actual dataset is much bigger):
>
> [ 0.48 0.64 0.69 0.67 0.67 0.65 0.68 0.63 0.62 0.61 0.61 0.6
> 0.58 0.62 0.64 0.63 0.63 0.61 0.60 0.61 0.62 0.65 0.67 0.67
> 0.67 0.68 0.68 0.66 0.68 0.65 0.65 0.65 0.65 0.64 0.64 0.65
> 0.65 0.66 0.66 0.64 0.65 0.64 0.68 0.69 0.70 0.69 0.7 0.68
> 0.64 0.64 0.65 0.67 0.68 0.67 0.67 0.66 0.66 0.64 0.64 0.58
> 0.53 0.53 0..52]
>
>
> I am looking to scan for all M & W curve formation and cycles. For this I need to detect all concave and convex points on curve. Is there function available in scipy or mlab to fit data into concave and convex function? If there's any other straightforward way to achieve this, pleas suggest.
>
I'm not sure what you need, I don't know what M & W curve formation
and cycles are.
But for a 1d array, you can just check the second derivative with
np.diff, something like
x=np.linspace(0.,5.)
y = np.sin(x)
z=np.diff(np.diff(y))>0 # isconvex
z1=np.diff(y,2) # 2nd derivative
np.array(z1>0,int) -np.array(z1<0,int) # concave indicator
but your example array has lots of ups and downs. If it is a noisy
dataset, you might need to smooth it first?
Josef
_______________________________________________
SciPy-user mailing list
SciPy-user@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user
More information about the SciPy-user
mailing list