Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15775 > unrolled thread

FindRoot with Logarithmic terms

Started byskunkwerk <skunkwerk@gmail.com>
First post2011-01-28 11:16 +0000
Last post2011-01-29 10:44 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  FindRoot with Logarithmic terms skunkwerk <skunkwerk@gmail.com> - 2011-01-28 11:16 +0000
    Re: FindRoot with Logarithmic terms psycho_dad <s.nesseris@gmail.com> - 2011-01-29 10:43 +0000
    Re: FindRoot with Logarithmic terms Peter Breitfeld <phbrf@t-online.de> - 2011-01-29 10:44 +0000

#15775 — FindRoot with Logarithmic terms

Fromskunkwerk <skunkwerk@gmail.com>
Date2011-01-28 11:16 +0000
SubjectFindRoot with Logarithmic terms
Message-ID<ihu8is$1pj$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#15779

Frompsycho_dad <s.nesseris@gmail.com>
Date2011-01-29 10:43 +0000
Message-ID<ii0r0s$jhr$1@smc.vnet.net>
In reply to#15775
On Jan 28, 12:16 pm, skunkwerk <skunkw...@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

I forgot to mention in my previous message that doing a series
expansion of your expression around x=1/2, keeping only the terms up
to 4th order and then solving the resulting polynomial equation is
enough to get (semi)analytic approximations to the roots:

In[68]:= ss = Series[expr, {x, 1/2, 4}];
Solve[(ss // Normal) == 0, x] // Flatten;
Select[%[[All, 2]], Im[#] == 0 && 1 > # > 0 &]
(* In the last step we keep only the real roots in the range (0,1) *)

Out[70]= {0.468458, 0.531542}

My guess is that perhaps you could generalize this method and get the
exact roots but I don't have the time to check this.

Cheers

[toc] | [prev] | [next] | [standalone]


#15857

FromPeter Breitfeld <phbrf@t-online.de>
Date2011-01-29 10:44 +0000
Message-ID<ii0r1h$ji2$1@smc.vnet.net>
In reply to#15775
skunkwerk 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
>

Your expr is indeterminate at x=0 and x=1 due to the Log. So you have
the following possibilities:

1. Adjust the search interval of FindRoot:

FindRoot[expr == 0, {x, 0.2, 0.5}] ----> {x->0.468458}
FindRoot[expr == 0, {x, 0.5, 0.9}] ----> {x->0.531542}

2. Use Reduce:

Reduce[expr==0,x,Reals] ----> x=0.468458 || x=0.513542

you will get a message about inexact coefficients though. If you use
Reduce[Rationalize[expr]==0,x,Reals] you will get two solutions in the
form of Root[]-objects.

//Peter

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web