Re: FindRoot with Logarithmic terms
- To: mathgroup at smc.vnet.net
- Subject: [mg116022] Re: FindRoot with Logarithmic terms
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Sat, 29 Jan 2011 05:28:08 -0500 (EST)
Since you can plot the function, it's not hard to avoid points where the function is undefined and/or the derivative is infinite: expr /@ {0, 1/2, 1} {Indeterminate, 2.08166, Indeterminate} expr'[#] & /@ {0, 1/2, 1} {-\[Infinity], 0., \[Infinity]} You also need to avoid 1/2, where the derivative is zero, but it's OK for .5 to be an endpoint of the solution interval, since Newton's method and most others won't head to an endpoint for no reason. So this works: FindRoot[expr@x, {x, .3, 0.2, .5}] {x -> 0.468458} FindRoot[expr@x, {x, .6, .5, .8}] {x -> 0.531542} But this does not: FindRoot[expr@x, {x, .5, 0.2, .8}] {x -> 0.5} FindRoot::jsing: Encountered a singular Jacobian at the point {x} = {0.5}. Try perturbing the initial point(s). >> Bobby On Fri, 28 Jan 2011 05:16:29 -0600, skunkwerk <skunkwerk at gmail.com> wrote: > Hi, > 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? > > thanks > -- DrMajorBob at yahoo.com