Re: NonLinearRegress Problem

*To*: mathgroup at smc.vnet.net*Subject*: [mg68392] Re: NonLinearRegress Problem*From*: Bill Rowe <readnewsciv at earthlink.net>*Date*: Thu, 3 Aug 2006 06:07:24 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

On 8/2/06 at 5:23 AM, jour at ccr.jussieu.fr (jour) wrote: >I have the following problem with NonLinearRegress >I have defined the following function >deb[teta_,n_,t]:= 9 n (t/teta)^3 Nintegrate[(x^4 >Exp[x])/(1+Exp[x])^2,{x,0,t/teta}] I assume this function should be deb[teta_,n_,t_]:+... and NIntegrate rather than what you have written above. Note it would also be a good idea to write this as deb[teta_,n_,t]:= Block[{x, s=t/teta}, 9 n (s)^3 Nintegrate[(x^4 Exp[x])/(1+Exp[x])^2,{x,0,s}]] Using Block[{x, s=t/teta} ... prevents any global assignment to x from impacting the function. And defining s = t/teta offers perhaps a small performance gain since the division operation is only done once. >I can Table this function without problem >Table[{t, deb2[100, 3, t]}, {t, 1, 200, 5}] I assume you really meant deb here as defined above not deb2 >but when I try to use this function in NonlinearRegress >fut = NonlinearRegress[dat, deb2[teta, n, t], {t}, {{teta, {10., >50.}, 0., 1000.}, {n, {1, 3}, 1, 70}}] >I get an error message >NIntegrate::"nlim" t/teta is not a valid limit of integration Right. NIntegrate is a numerical proceedure and as such needs numerical limits a condition not met when you supply deb with arguments that are symbols with no assigned values. Of course, NonlinearRegress needs to know the functional form of the curve and requires an expression with symbols that have no assigned values. That is the manner in which you are using NIntegrate is fundamentally incompatible with NonlinearRegress >any suggestions ? Replace deb[teta, n, t] with a symbolic expression, i.e., In[13]:= Integrate[(x^4*Exp[x])/(1 + Exp[x])^2, x] Out[13]= -(x^4/(1 + E^x)) + x^4 - 4*Log[1 + E^x]*x^3 - 12*PolyLog[2, -E^x]*x^2 + 24*PolyLog[3, -E^x]*x - 24*PolyLog[4, -E^x] using replacement rules x->0 and x->t/teta will give you a symbolic expression you can now use with NonlinearRegress -- To reply via email subtract one hundred and four