Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

EDIT: Just realized I had misspelled "inconsistent."

I'm using version 7.0.

I'm trying to fit a (noisy) data set to a large-order polynomial. (Just for context: there isn't a model for the data, and I need to find the minimum of the derivative, which is much easier with a polynomial that bypasses some of the noise.) The derivative of the data should always be positive, but noise in the data can cause it to appear to have a local minimum. This consistently happens at low x-values of the data (not a problem) and at higher x-values (the part I'm interested in).

It's actually pretty difficult to find the best fit with a constraint like that on the derivative; I was lucky enough to find this previous question and started from there.

Since I've had trouble reproducing this with a simpler set of data, I'm including the data that's causing the problem as well as my attempt. Sorry about that :\

data={{-7.60206, -5.90028}, {-7.20412, -6.32711}, {-7.05799, -6.24573}, \
{-6.90309, -8.23214}, {-6.727, -6.25497}, {-6.67264, -6.0359}, \
{-6.62434, -7.09815}, {-6.60206, -6.74033}, {-6.58087, -6.9319}, \
{-6.50515, -6.00988}, {-6.47173, -5.89132}, {-6.42597, -6.61755}, \
{-6.41173, -6.8024}, {-6.39794, -7.15367}, {-6.38458, -6.50378}, \
{-6.35902, -6.08738}, {-6.33489, -6.03554}, {-6.30103, -6.94662}, \
{-6.27984, -7.61019}, {-6.26962, -6.91566}, {-6.24988, -6.00816}, \
{-6.23099, -6.14881}, {-6.20412, -7.65494}, {-6.18709, -6.84911}, \
{-6.17881, -7.91219}, {-6.16273, -6.09495}, {-6.14722, -6.48424}, \
{-6.12494, -6.66752}, {-6.11776, -6.91584}, {-6.10375, -6.39662}, \
{-6.07058, -7.19377}, {-6.05799, -6.65843}, {-6, -6.80801}, \
{-5.98928, -7.18128}, {-5.95861, -6.81322}, {-5.9393, -7.01644}, \
{-5.89449, -6.82349}, {-5.87778, -6.55417}, {-5.86967, -6.74259}, \
{-5.83863, -6.76216}, {-5.82391, -7.12595}, {-5.81673, -7.83024}, \
{-5.80272, -6.71336}, {-5.75696, -6.77054}, {-5.73283, -7.41132}, \
{-5.72125, -6.87451}, {-5.69897, -6.64371}, {-5.66756, -6.78701}, \
{-5.65758, -6.83261}, {-5.64782, -7.04809}, {-5.62893, -8.12271}, \
{-5.61083, -6.81729}, {-5.59346, -7.58534}, {-5.58503, -7.65891}, \
{-5.56864, -6.98094}, {-5.5157, -6.928}, {-5.50169, -6.98523}, \
{-5.4437, -6.9454}, {-5.4318, -7.17851}, {-5.38722, -7.31544}, \
{-5.27572, -7.36563}, {-5.25964, -7.53078}, {-5.22185, -7.11725}, \
{-5.18046, -7.66833}, {-5.16749, -7.64004}, {-5.14267, -7.4718}, \
{-5.11919, -7.46749}, {-5.07572, -9.05899}, {-5.0655, -7.38326}, \
{-5.04576, -7.79535}, {-5.02687, -7.01003}, {-5, -7.47527}, \
{-4.95078, -7.14359}, {-4.9431, -7.44334}, {-4.90658, -7.12264}, \
{-4.85387, -7.25088}, {-4.80688, -7.77359}, {-4.78516, -8.05067}, \
{-4.76447, -8.07252}, {-4.72584, -7.33981}, {-4.70774, -6.99741}, \
{-4.69037, -7.45587}, {-4.63451, -7.42141}, {-4.62709, -7.89697}, \
{-4.61979, -7.52025}, {-4.61261, -8.00335}, {-4.5784, -7.78812}, \
{-4.56543, -7.40386}, {-4.49485, -7.813}, {-4.47366, -7.16346}, \
{-4.46344, -7.41719}, {-4.45346, -7.40907}, {-4.40671, -7.47877}, \
{-4.38934, -8.33093}, {-4.38091, -7.22819}, {-4.35655, -7.74591}, \
{-4.32606, -7.95015}, {-4.31876, -7.74146}, {-4.27737, -7.78947}, \
{-4.22768, -8.35667}, {-4.2161, -7.79398}, {-4.19382, -8.42667}, \
{-4.17263, -7.2905}, {-4.16241, -8.96208}, {-4.15243, -7.80177}, \
{-4.14267, -7.95211}, {-4.11464, -7.71493}, {-4.07988, -7.54309}, \
{-4.0716, -7.63749}, {-4.06349, -7.86216}, {-4.04769, -7.92244}, \
{-4.02503, -7.52806}, {-4.01773, -7.8399}, {-3.99568, -7.93923}, \
{-3.97469, -8.35667}, {-3.96257, -8.13847}, {-3.9393, -8.43652}, \
{-3.90309, -8.75796}, {-3.89279, -8.1729}, {-3.88273, -7.92428}, \
{-3.8729, -8.31709}, {-3.86012, -8.59314}, {-3.85078, -7.85531}, \
{-3.83268, -7.93671}, {-3.81248, -7.82018}, {-3.8041, -8.00778}, \
{-3.79588, -8.06567}, {-3.78781, -8.06229}, {-3.76955, -8.69581}, \
{-3.76195, -7.8496}, {-3.75449, -7.86858}, {-3.74715, -8.20325}, \
{-3.73993, -7.70706}, {-3.73049, -7.62317}, {-3.72354, -7.72065}, \
{-3.7167, -8.27666}, {-3.69465, -7.76037}, {-3.68825, -7.76928}, \
{-3.67572, -7.67484}, {-3.66154, -8.02366}, {-3.64975, -8.23589}, \
{-3.63827, -7.93107}, {-3.62525, -7.50342}, {-3.61439, -7.75411}, \
{-3.60206, -7.77489}, {-3.59176, -7.76971}, {-3.5817, -7.81586}, \
{-3.57025, -7.46451}, {-3.56067, -8.15378}, {-3.54975, -7.59961}, \
{-3.54061, -7.53351}, {-3.53165, -7.61588}, {-3.52143, -8.01452}, \
{-3.51286, -7.76544}, {-3.50307, -7.50226}, {-3.49485, -7.92735}, \
{-3.48678, -7.53301}, {-3.47756, -7.6037}, {-3.4698, -7.59014}, \
{-3.46092, -7.61198}, {-3.45346, -7.50342}, {-3.44612, -7.35343}, \
{-3.43771, -7.75246}, {-3.43063, -7.72065}, {-3.42251, -7.95802}, \
{-3.41567, -7.56719}, {-3.40894, -7.47331}, {-3.40121, -7.57152}, \
{-3.39469, -7.48833}, {-3.38722, -7.46707}, {-3.37469, -7.4033}, \
{-3.36151, -7.65035}, {-3.34872, -7.43076}, {-3.3363, -7.48253}, \
{-3.32422, -7.35195}, {-3.31336, -7.36444}, {-3.3019, -7.41038}, \
{-3.29073, -7.36041}, {-3.27984, -7.41529}, {-3.26922, -7.29265}, \
{-3.25964, -7.24932}, {-3.24949, -7.35146}, {-3.23958, -7.35113}, \
{-3.22988, -7.16049}, {-3.2204, -7.3206}, {-3.21183, -7.23806}, \
{-3.20273, -7.20416}, {-3.19382, -7.24997}, {-3.18509, -7.24803}, \
{-3.17653, -7.14634}, {-3.16877, -7.10937}, {-3.16052, -7.17391}, \
{-3.15243, -7.13803}, {-3.14448, -7.11725}, {-3.13668, -7.19217}, \
{-3.1296, -7.13175}, {-3.12205, -7.12332}, {-3.11464, -7.07218}, \
{-3.10735, -7.09241}, {-3.10018, -7.04678}, {-3.09366, -7.07227}, \
{-3.08672, -7.07253}, {-3.07314, -7.07348}, {-3.06048, -7.00128}, \
{-3.04769, -7.01659}, {-3.03527, -6.96567}, {-3.02365, -6.935}, \
{-3.01189, -6.95611}, {-3.00087, -6.95308}, {-2.9897, -6.93702}, \
{-2.97881, -6.91176}, {-2.96859, -6.90015}, {-2.95821, -6.9111}, \
{-2.94846, -6.89271}, {-2.93855, -6.8787}, {-2.92885, -6.86577}, \
{-2.91973, -6.864}, {-2.91045, -6.83028}, {-2.9017, -6.80614}, \
{-2.89279, -6.8052}, {-2.88406, -6.8232}, {-2.87582, -6.79925}, \
{-2.86742, -6.76766}, {-2.85949, -6.77332}, {-2.8514, -6.75764}, \
{-2.84345, -6.74061}, {-2.83594, -6.7553}, {-2.82827, -6.73816}, \
{-2.82102, -6.7275}, {-2.81361, -6.75098}, {-2.80632, -6.73848}, \
{-2.79942, -6.7172}, {-2.79237, -6.70536}, {-2.78569, -6.71977}, \
{-2.77211, -6.69684}, {-2.7592, -6.69571}, {-2.74666, -6.68624}, \
{-2.73447, -6.66456}, {-2.72262, -6.67177}, {-2.71086, -6.65361}, \
{-2.69962, -6.64591}, {-2.68867, -6.65048}, {-2.67799, -6.64835}, \
{-2.66756, -6.64439}, {-2.65718, -6.64516}, {-2.64724, -6.63901}, \
{-2.63752, -6.64361}, {-2.62801, -6.64287}, {-2.6187, -6.63583}, \
{-2.60942, -6.63402}, {-2.6005, -6.62981}, {-2.59176, -6.64484}, \
{-2.58319, -6.64474}, {-2.57479, -6.65147}, {-2.56639, -6.65002}, \
{-2.5583, -6.64274}, {-2.55037, -6.64187}, {-2.54257, -6.64871}, \
{-2.53491, -6.63834}, {-2.52724, -6.65454}, {-2.51985, -6.66038}, \
{-2.51258, -6.65696}, {-2.50543, -6.65914}, {-2.49839, -6.64055}, \
{-2.49134, -6.65408}, {-2.48452, -6.65424}, {-2.47121, -6.6424}, \
{-2.45817, -6.63535}, {-2.44563, -6.63281}, {-2.43344, -6.62368}, \
{-2.42148, -6.61031}, {-2.40994, -6.59431}, {-2.39859, -6.57061}, \
{-2.38764, -6.55078}, {-2.37696, -6.538}, {-2.36643, -6.51422}, \
{-2.35625, -6.49867}, {-2.34621, -6.47369}, {-2.33649, -6.46208}, \
{-2.32698, -6.43439}, {-2.31758, -6.41997}, {-2.30848, -6.40473}, \
{-2.29947, -6.393}, {-2.29073, -6.37805}, {-2.28216, -6.37162}, \
{-2.27368, -6.36121}, {-2.26544, -6.34662}, {-2.25727, -6.34753}, \
{-2.24934, -6.34287}, {-2.24154, -6.34032}, {-2.23381, -6.33989}, \
{-2.22629, -6.34378}, {-2.21882, -6.34209}, {-2.21155, -6.34217}, \
{-2.2044, -6.34847}, {-2.19729, -6.35258}, {-2.19037, -6.35258}, \
{-2.18349, -6.35968}, {-2.17018, -6.36461}, {-2.1572, -6.36892}, \
{-2.1446, -6.36796}, {-2.13236, -6.36432}, {-2.12045, -6.35925}, \
{-2.10891, -6.34518}, {-2.09762, -6.33549}, {-2.08661, -6.31951}, \
{-2.07588, -6.3087}, {-2.0654, -6.29828}, {-2.05522, -6.29348}, \
{-2.04523, -6.29345}, {-2.03546, -6.30076}, {-2.0259, -6.31038}, \
{-2.01655, -6.32847}, {-2.00745, -6.34783}, {-1.99848, -6.37117}, \
{-1.9897, -6.39458}, {-1.98109, -6.41923}, {-1.97265, -6.43722}, \
{-1.96441, -6.44987}, {-1.95628, -6.45579}, {-1.94831, -6.45369}, \
{-1.94047, -6.44678}, {-1.93278, -6.43521}, {-1.92526, -6.42661}, \
{-1.91783, -6.41699}, {-1.91052, -6.41109}, {-1.90333, -6.40588}, \
{-1.89626, -6.41371}, {-1.88934, -6.42107}, {-1.8825, -6.43708}, \
{-1.86912, -6.47919}, {-1.85617, -6.52883}, {-1.84357, -6.55976}, \
{-1.83133, -6.5558}, {-1.81944, -6.51556}, {-1.80785, -6.4633}, \
{-1.79659, -6.42203}, {-1.78558, -6.39845}, {-1.77485, -6.39715}, \
{-1.7644, -6.4092}, {-1.75417, -6.41564}, {-1.7442, -6.40869}, \
{-1.73443, -6.3793}, {-1.72487, -6.33557}, {-1.71555, -6.29011}, \
{-1.70639, -6.25807}, {-1.69745, -6.24437}, {-1.68867, -6.2509}, \
{-1.68006, -6.26612}, {-1.67164, -6.27975}, {-1.66336, -6.28322}, \
{-1.65525, -6.26844}, {-1.64728, -6.24355}, {-1.63944, -6.22114}, \
{-1.63177, -6.20663}, {-1.62421, -6.2108}, {-1.6168, -6.23096}, \
{-1.60949, -6.26405}, {-1.6023, -6.29625}, {-1.59525, -6.31671}, \
{-1.5883, -6.31662}, {-1.58147, -6.3016}, {-1.56809, -6.27854}, \
{-1.55513, -6.30344}, {-1.54254, -6.33983}, {-1.53031, -6.32322}, \
{-1.51841, -6.26627}, {-1.50682, -6.24411}, {-1.49554, -6.25615}, \
{-1.48455, -6.23942}, {-1.47383, -6.17853}, {-1.46337, -6.13769}, \
{-1.45314, -6.14292}, {-1.44315, -6.15919}, {-1.4334, -6.14313}, \
{-1.42385, -6.11713}, {-1.41452, -6.12631}, {-1.40536, -6.16569}, \
{-1.39641, -6.18248}, {-1.38764, -6.16451}, {-1.37904, -6.15518}, \
{-1.37061, -6.17622}, {-1.36233, -6.18461}, {-1.35421, -6.14501}, \
{-1.34625, -6.10036}, {-1.33842, -6.08757}, {-1.33074, -6.08959}, \
{-1.32318, -6.06436}, {-1.31576, -6.02264}, {-1.30846, -6.00601}, \
{-1.30128, -6.0189}, {-1.29422, -6.02749}, {-1.28727, -6.01383}, \
{-1.28043, -6.00676}, {-1.26707, -6.05246}, {-1.2541, -6.04137}, \
{-1.24151, -6.04864}, {-1.22928, -6.00765}, {-1.21738, -5.96689}, \
{-1.2058, -5.93204}, {-1.19451, -5.90199}, {-1.18352, -5.90146}, \
{-1.1728, -5.89875}, {-1.16233, -5.92488}, {-1.15211, -5.91532}, \
{-1.14212, -5.9226}, {-1.13237, -5.88736}, {-1.12282, -5.86103}, \
{-1.11348, -5.82132}, {-1.10434, -5.80047}, {-1.09538, -5.79469}, \
{-1.08661, -5.79257}, {-1.07801, -5.80953}, {-1.06958, -5.80259}, \
{-1.06131, -5.80503}, {-1.05318, -5.77427}, {-1.04522, -5.7585}, \
{-1.03739, -5.72601}, {-1.0297, -5.71595}, {-1.02215, -5.70825}, \
{-1.01473, -5.70799}, {-1.00743, -5.71207}, {-1.00025, -5.70483}, \
{-0.993188, -5.70018}, {-0.98624, -5.67431}, {-0.979398, -5.66444}, \
{-0.966038, -5.63829}, {-0.953072, -5.63347}, {-0.940482, -5.62353}, \
{-0.928247, -5.59392}, {-0.916347, -5.56682}, {-0.904768, -5.56074}, \
{-0.893486, -5.55977}, {-0.88249, -5.5387}, {-0.871766, -5.50732}, \
{-0.8613, -5.49268}, {-0.851083, -5.49433}, {-0.841098, -5.48539}, \
{-0.831338, -5.45912}, {-0.821792, -5.43721}, {-0.812451, -5.43104}, \
{-0.80331, -5.42785}, {-0.794355, -5.41191}, {-0.78558, -5.39096}, \
{-0.776979, -5.37989}, {-0.768546, -5.37566}, {-0.760275, -5.36394}, \
{-0.752157, -5.34505}, {-0.744187, -5.33322}, {-0.736362, -5.32963}, \
{-0.728674, -5.32043}, {-0.721123, -5.30286}, {-0.713699, -5.28876}, \
{-0.706399, -5.28529}, {-0.69922, -5.28199}, {-0.692158, -5.26763}, \
{-0.68521, -5.24964}, {-0.678371, -5.24109}, {-0.665006, -5.2306}, \
{-0.652042, -5.20638}, {-0.639452, -5.19457}, {-0.627217, -5.17444}, \
{-0.615319, -5.1607}, {-0.603736, -5.14226}, {-0.592456, -5.13065}, \
{-0.58146, -5.11305}, {-0.570736, -5.10147}, {-0.560271, -5.08776}, \
{-0.550051, -5.07206}, {-0.540068, -5.06321}, {-0.530308, -5.04697}, \
{-0.520762, -5.03815}, {-0.511422, -5.02446}, {-0.502279, -5.01468}, \
{-0.493325, -5.00185}, {-0.48455, -4.99366}, {-0.475949, -4.98007}, \
{-0.467517, -4.97234}, {-0.459244, -4.96171}, {-0.451127, -4.95081}, \
{-0.443157, -4.94383}, {-0.435332, -4.93212}, {-0.427645, -4.92523}, \
{-0.420092, -4.91513}, {-0.412669, -4.90733}, {-0.405369, -4.89753}, \
{-0.39819, -4.89191}, {-0.391129, -4.88128}, {-0.384179, -4.87593}, \
{-0.377341, -4.86739}, {-0.363976, -4.85303}, {-0.351011, -4.83878}, \
{-0.338422, -4.82565}, {-0.326188, -4.81316}, {-0.314289, -4.80114}, \
{-0.302706, -4.78971}, {-0.291425, -4.77868}, {-0.28043, -4.76819}, \
{-0.269706, -4.75792}, {-0.259241, -4.74798}, {-0.249021, -4.7385}, \
{-0.239037, -4.72924}, {-0.229278, -4.7201}, {-0.219732, -4.71146}, \
{-0.210392, -4.7033}, {-0.201249, -4.69572}, {-0.192294, -4.68787}, \
{-0.18352, -4.68039}, {-0.17492, -4.67327}, {-0.166487, -4.66616}, \
{-0.158214, -4.65948}, {-0.150096, -4.65317}, {-0.142127, -4.64682}, \
{-0.134302, -4.64059}, {-0.126615, -4.63473}, {-0.119062, -4.6292}, \
{-0.111638, -4.62373}, {-0.104339, -4.61836}, {-0.0971603, -4.61337}, \
{-0.0900986, -4.60855}, {-0.0831493, -4.60343}, {-0.07631, -4.59873}, \
{-0.0629462, -4.58964}, {-0.049981, -4.58088}, {-0.037392, -4.57269}, \
{-0.0251578, -4.56487}, {-0.0132583, -4.55743}, {-0.00167657, \
-4.55083}, {0.0096047, -4.54454}, {0.0205999, -4.53893}, {0.0313236, \
-4.53337}, {0.0417893, -4.52825}, {0.0520083, -4.52332}, {0.0619927, \
-4.51822}, {0.0717524, -4.51344}, {0.0812976, -4.50889}, {0.0906379, \
-4.50455}, {0.0997811, -4.50059}, {0.108736, -4.49674}, {0.11751, \
-4.49265}, {0.12611, -4.48908}, {0.134543, -4.48549}, {0.142816, \
-4.48249}, {0.150934, -4.47944}, {0.158903, -4.47637}, {0.166728, \
-4.47342}, {0.174415, -4.4706}, {0.181968, -4.46742}, {0.189392, \
-4.46434}, {0.196691, -4.46137}, {0.20387, -4.45885}, {0.210932, \
-4.45637}, {0.21788, -4.45369}, {0.22472, -4.45128}, {0.238084, \
-4.4462}, {0.251049, -4.44101}, {0.263638, -4.43577}, {0.275872, \
-4.43012}, {0.287772, -4.42478}, {0.299353, -4.41977}, {0.310634, \
-4.41556}, {0.32163, -4.41204}, {0.332354, -4.40875}, {0.342819, \
-4.40574}, {0.353038, -4.40279}, {0.363023, -4.40021}, {0.372782, \
-4.39779}, {0.382328, -4.39527}, {0.391668, -4.39256}, {0.400811, \
-4.39048}, {0.409766, -4.38866}, {0.41854, -4.38663}, {0.42714, \
-4.38516}, {0.435573, -4.3833}, {0.443846, -4.38112}, {0.451964, \
-4.37841}, {0.459933, -4.37602}, {0.467758, -4.37398}, {0.475445, \
-4.37215}, {0.482998, -4.37002}, {0.490422, -4.36768}, {0.497721, \
-4.36579}, {0.5049, -4.3635}, {0.511962, -4.36165}, {0.518911, \
-4.36083}, {0.52575, -4.36591}, {0.539114, -4.37695}, {0.552079, \
-4.38624}, {0.564668, -4.39179}, {0.576902, -4.39043}, {0.588802, \
-4.39048}, {0.600384, -4.39417}, {0.611665, -4.39192}, {0.62266, \
-4.38866}, {0.633384, -4.37718}, {0.643849, -4.36093}, {0.654068, \
-4.33669}, {0.664053, -4.32032}, {0.673812, -4.31347}, {0.683358, \
-4.31332}, {0.692698, -4.31251}, {0.701841, -4.31158}, {0.710796, \
-4.31023}, {0.71957, -4.3079}, {0.72817, -4.31828}, {0.736603, \
-4.33206}, {0.744876, -4.34439}, {0.752994, -4.35617}, {0.760963, \
-4.35984}, {0.768788, -4.36454}, {0.776475, -4.3641}, {0.784028, \
-4.35747}, {0.791452, -4.35255}, {0.798751, -4.34871}, {0.80593, \
-4.3443}, {0.812992, -4.33782}, {0.81994, -4.33342}, {0.82678, \
-4.33645}, {0.840144, -4.3371}, {0.853109, -4.33312}, {0.865698, \
-4.33385}, {0.877932, -4.31409}, {0.889832, -4.28469}, {0.901414, \
-4.27696}, {0.912695, -4.27538}, {0.92369, -4.27261}, {0.934414, \
-4.27074}, {0.944879, -4.26815}, {0.955098, -4.27633}, {0.965083, \
-4.28695}, {0.974842, -4.3028}, {0.984388, -4.30428}, {0.993728, \
-4.28852}, {1.00287, -4.28339}, {1.01183, -4.26882}, {1.0206, \
-4.26852}, {1.0292, -4.28874}, {1.03763, -4.30999}, {1.04591, \
-4.34026}, {1.05402, -4.34564}, {1.06199, -4.33417}, {1.06982, \
-4.31732}, {1.0775, -4.3048}, {1.08506, -4.28295}, {1.09248, \
-4.26599}, {1.09978, -4.28068}, {1.10696, -4.31298}, {1.11402, \
-4.33177}, {1.12097, -4.32824}, {1.12781, -4.30647}, {1.14117, \
-4.25651}, {1.15414, -4.22247}, {1.16673, -4.22796}, {1.17896, \
-4.29991}, {1.19086, -4.30709}, {1.20244, -4.30735}, {1.21372, \
-4.31431}, {1.22472, -4.3091}, {1.23544, -4.27057}, {1.24591, \
-4.21295}, {1.25613, -4.1817}, {1.26611, -4.18344}, {1.27587, \
-4.18317}, {1.28542, -4.18257}, {1.29476, -4.1835}, {1.3039, \
-4.18194}, {1.31286, -4.18449}, {1.32163, -4.18843}, {1.33023, \
-4.19232}, {1.33866, -4.19326}, {1.34694, -4.19159}, {1.35505, \
-4.18504}, {1.36302, -4.18344}, {1.37085, -4.18041}, {1.37853, \
-4.17377}, {1.38609, -4.21639}, {1.39351, -4.26059}, {1.40081, \
-4.28928}, {1.40799, -4.27665}, {1.41505, -4.22666}, {1.422, \
-4.1761}, {1.42884, -4.17782}, {1.4422, -4.16613}, {1.45517, \
-4.17583}, {1.46776, -4.1726}, {1.47999, -4.21981}, {1.49189, \
-4.29252}, {1.50347, -4.30803}, {1.51475, -4.34688}, {1.52575, \
-4.29175}, {1.53647, -4.27055}, {1.54694, -4.21275}, {1.55716, \
-4.17283}, {1.56714, -4.21776}, {1.5769, -4.1952}, {1.58645, \
-4.16187}, {1.59579, -4.19783}, {1.60493, -4.16365}, {1.61389, \
-4.17921}, {1.62266, -4.27348}, {1.63126, -4.31112}, {1.63969, \
-4.2974}, {1.64797, -4.25625}, {1.65608, -4.20345}, {1.66405, \
-4.20957}, {1.67188, -4.19068}, {1.67956, -4.11956}, {1.68712, \
-4.13562}, {1.69454, -4.21543}, {1.70184, -4.18477}, {1.70902, \
-4.25779}, {1.71608, -4.28487}, {1.72303, -4.27459}, {1.72987, \
-4.28326}, {1.74323, -4.25068}, {1.7562, -4.27135}, {1.76879, \
-4.28912}, {1.78102, -4.32662}, {1.79292, -4.31143}, {1.8045, \
-4.35274}, {1.81578, -4.29717}, {1.82678, -4.29271}, {1.8375, \
-4.31687}, {1.84797, -4.32874}, {1.85819, -4.25051}, {1.86817, \
-4.21378}, {1.87793, -4.24568}, {1.88748, -4.17369}, {1.89682, \
-4.18327}, {1.90596, -4.29785}, {1.91492, -4.26084}, {1.92369, \
-4.22121}, {1.93229, -4.22309}, {1.94072, -4.2172}, {1.949, \
-4.22707}, {1.95711, -4.32227}, {1.96508, -4.40666}, {1.97291, \
-4.27942}, {1.98059, -4.25027}, {1.98815, -4.31823}, {1.99557, \
-4.25654}, {2.00287, -4.28529}, {2.01005, -4.28781}, {2.01711, \
-4.24779}, {2.02406, -4.23673}, {2.0309, -4.13488}, {2.04426, \
-4.08296}, {2.05723, -4.2324}, {2.06982, -4.17255}, {2.08205, \
-4.19828}, {2.09395, -4.13272}, {2.10553, -4.19443}, {2.11681, \
-4.14937}, {2.12781, -4.22916}, {2.13853, -4.10431}, {2.149, \
-4.14669}, {2.15922, -4.33392}, {2.1692, -4.22209}, {2.17896, \
-4.11348}, {2.18851, -4.23143}, {2.19785, -4.31207}, {2.20699, \
-4.18715}, {2.21595, -4.21967}, {2.22472, -4.2331}, {2.23332, \
-4.10382}, {2.24175, -4.03334}, {2.25003, -4.12132}, {2.25814, \
-4.10954}, {2.26611, -4.10093}, {2.27394, -3.98143}, {2.28162, \
-3.96581}, {2.28918, -3.93108}, {2.2966, -3.86353}, {2.3039, \
-3.90121}, {2.31108, -4.14699}, {2.31814, -4.16986}, {2.32509, \
-4.06914}, {2.33193, -4.09747}, {2.34529, -4.13102}, {2.35826, \
-4.10327}, {2.37085, -4.03584}, {2.38308, -4.11951}, {2.39498, \
-3.98065}, {2.40656, -3.86725}, {2.41784, -3.87111}, {2.42884, \
-3.90806}, {2.43956, -4.10791}, {2.45003, -4.17971}, {2.46025, \
-4.00339}, {2.47023, -4.02952}, {2.47999, -4.09248}, {2.48954, \
-4.05987}, {2.49888, -3.82593}, {2.50802, -3.76067}, {2.51698, \
-3.86685}, {2.52575, -3.84597}, {2.53435, -3.8714}, {2.54278, \
-3.91248}, {2.55106, -3.86843}, {2.55917, -3.74494}, {2.57497, \
-3.88662}, {2.58265, -3.84542}, {2.59021, -3.8864}, {2.59763, \
-3.77177}, {2.60493, -3.76896}, {2.61211, -3.69489}, {2.61917, \
-3.80791}, {2.63296, -3.76332}, {2.64632, -3.71202}, {2.65929, \
-4.13497}, {2.68411, -3.7482}, {2.69601, -3.87555}, {2.70759, \
-3.90333}, {2.74059, -4.06462}, {2.75106, -3.90174}};

Here is my attempt to fit it with an order-4 polynomial:

Clear[a,b,c,d,e]
{a,b,c,d,e}=NArgMin[{Norm[Function[{x,y},\[FormalA]+\[FormalB] x+\[FormalC] x^2+ \
\[FormalD] x^3+\[FormalE] x^4-y]@@@data],Function[{x,y},\[FormalB]+2 \[FormalC] x \
+3 \[FormalD] x^2+4 \[FormalE] x^3>0]@@@data},{\[FormalA],\[FormalB],\[FormalC], \
\[FormalD],\[FormalE]}]

The coefficients this gives are

{a,b,c,d,e}={-5.01894, 0.720639, -0.0207154, -0.0210971, -0.00153312}

and the polynomial both approximately fits the data and has an always-positive derivative. Here is an attempt with an order-5 polynomial:

Clear[a,b,c,d,e,f]
{a,b,c,d,e,f}=NArgMin[{Norm[Function[{x,y},\[FormalA]+\[FormalB] x+\[FormalC] \
 x^2+\[FormalD] x^3+\[FormalE] x^4+\[FormalF] x^5-y]@@@data],Function[{x,y},\[FormalB]+ \
2 \[FormalC] x+3 \[FormalD] x^2+4 \[FormalE] x^3+5 \[FormalF] x^4>0]@@@data},{\[FormalA], \
\[FormalB],\[FormalC],\[FormalD],\[FormalE],\[FormalF]}]

It's exactly the same as before except that there is a term f x^5. It gives the error message NArgMin::nsol : There are no points that satisfy the constraints {a number of terms equal to Length[data], each of which is the derivative constraint evaluated at the x-value for a particular point}. However there obviously is a solution that satisfies the constraints, since in the worst case setting f=0 would duplicate the order-4 fit which I've already established works.

Based on some experimenting with the fit without constraining the derivative to always be positive, I expect that in order to satisfactorily fit the data I will need to use a polynomial of order about 20. That might present problems of its own, but I'll almost surely run into this particular one again unless I figure out how to fix it.

Also, because fitting the order-4 polynomial takes about a minute, any suggestions on how to speed this up would also be appreciated.

Thanks in advance for any help!

share|improve this question
    
With Your assumption of monotonicity, minimum of derivative is equal to 0 for x equal about -2 or 1.5 because there are, clearly visible, transitions between concavity/convexity. This is only a remark reffering to this particular data set and Your need of minimum value of derivative. –  Kuba Jul 3 '13 at 22:41
    
@Kuba - I know the data itself has fluctuations that sometimes cause the derivative to be negative; the code I have above fits with the best always-monotonically-increasing polynomial of whatever order (when it works); the problem is that it works for (in the example I posted) order 4 but crashes for order 5, even though in the worst case there should be a trivial order-5 solution with the coefficient of the x^5 term equal to zero. So I think it's a problem with NArgMin, or at least the way I'm using it...which is why I need help :) –  John Hyatt Jul 4 '13 at 14:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.