Re: FindRoot with Logarithmic terms

*To*: mathgroup at smc.vnet.net*Subject*: [mg116007] Re: FindRoot with Logarithmic terms*From*: Bill Rowe <readnews at sbcglobal.net>*Date*: Sat, 29 Jan 2011 05:25:02 -0500 (EST)

On 1/28/11 at 6:16 AM, skunkwerk at gmail.com (skunkwerk) wrote: >I'm trying to find the roots of a logarithmic equation that I've >plotted successfully (I can see both roots are between 0 and 1). >expr = 7500*x*(1 - x) + 325*8.314*(x*Log[x] + (1 - x)*Log[(1 - x)]) >FindRoot[expr == 0, {x, 0, 1}] >FindRoot:nlnum: the function value(indeterminate) is not a list of >numbers with dimensions {1} at {x} = {0.} >any ideas? When you supply two values as starting points, FindRoot uses those as starting points for the algorithm it uses. You are supplying values where your expression is indeterminate. The most effective way to use two starting points is to choose them so that they bound the root you are looking for and evaluate to real values. That is, In[7]:= FindRoot[expr, {x, .1, .5}] Out[7]= {x->0.468458} But for this particular expression, there is no real difficulty in taking the derivative. So, there is no need to supply two initial values. The lower root can be found with In[8]:= FindRoot[expr, {x, .2}] Out[8]= {x->0.468458} and the upper root with In[9]:= FindRoot[expr, {x, .8}] Out[9]= {x->0.531542}