qwanta Posted June 9, 2009 Share Posted June 9, 2009 I was looking for a php library to do a polynomial fit to a set of data. I ended up finding a great package at phpmath.com and thought I would post a link here as I had a hard time finding it (and this forum doesn't have any references to it AFAIK). The link to the polyfit function: http://www.phpmath.com/home?op=perm&nid=47 It requires the php implementation of the JAMA matrix library ("Java Matrix Package") which can be downloaded here: http://www.phpmath.com/build03/JAMA/docs/ http://www.phpmath.com/build03/JAMA/docs/download.php There is some other good stuff on the site. For example, I discovered the PHPExcelProject: http://www.phpmath.com/home?op=perm&nid=112 http://www.codeplex.com/PHPExcel This is a php implementation of many excel functions. A polynomial fit could be done with the LINEST function. Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted June 9, 2009 Share Posted June 9, 2009 There is some other good stuff on the site. For example, I discovered the PHPExcelProject: http://www.phpmath.com/home?op=perm&nid=112 http://www.codeplex.com/PHPExcel This is a php implementation of many excel functions. A polynomial fit could be done with the LINEST function. PHPExcel actually uses a modified version of the PHP JAMA port (currently being updated to PHP5 as part of an overall reworking of the formula parser and function library), and some code routines from within the polyfit library at phpmath.com (used with permission, of course) A set of best fit routines is defined in the trendClass (/Classes/PHPExcel/Shared/trend) within PHPExcel, giving Linear, Logarithmic, Exponential, Power, and 2nd to 6th order polynomials. This is the underlying code used by the LINEST and LOGEST PHPExcel functions, though it doesn't yet work with negative values in data ranges for the Logarithmic, Exponential and Power regressions. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.