[SciPy-User] Newbie Question :: Natural Cubic Spline

hello world helloworld777@hotmail....
Sun Oct 25 16:58:51 CDT 2009


Thanks for the example.  It is greatly appreciated.   Would you have an example of a monotonic cubic spline?  


From: helloworld777@hotmail.com
To: scipy-user@scipy.org
Subject: Newbie Question :: Natural Cubic Spline
Date: Wed, 21 Oct 2009 15:48:19 -0500


I am new to Python and the SciPy libraries and I was wondering if someone could help me with the following.

Given the following x and y : values

x_list = [33,              56,     56.00000000002,       147,    238,    329,    420,    511,    602,    693,    791]

y_list = [0.99974,    0.99949,            0.99949,   0.99816,0.99631,0.99383,0.99043,0.98610,0.98078,0.97460,0.96704]

I want to use a Natural Cubic Spline in order to determine the points at the following values:

interp_x_points    = [31,62,92,123,153,184,215,243,274,304,335,365,396,427,457,488,518,549,580,608,639,669,700] 

I have looked through the documentation and have had a tough time determining the correct syntax or which function to use.

I was wondering what would be the SciPy syntax for the following:
Also, does scipy have the ability to extrapolate if a give X value is outside a specified range?
In this example, please notice interp_x_poiints has a value (31) which is outside of the x_list range.

my_spline_object = NaturalCubicSpline(x_list, y_list)
for interp_x_value in interp_x_points:
    interp_y_value = my_spline_object(interp_x_value)  # return a floating value
    print interp_y_value

Many Thanks

Hotmail: Free, trusted and rich email service. Get it now. 		 	   		  
Windows 7: It works the way you want. Learn more.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20091025/fbd5b501/attachment.html 

More information about the SciPy-User mailing list