Message Boards Message Boards

4 Replies
3 Total Likes
View groups...
Share this post:

Solving a Log equation with NSolve

Posted 11 years ago
x1 =  Sqrt[2 \[Pi] n] (n/Exp[1])^n;
x2 = (n/Exp[1])^n;
x3 = n^n;
x4 = 2;
NSolve[(Log[n!] - Log[ x4])/Log[n!] <= 0.01, n]

I would solve the equation on the top. But NSolve gives no output. I need the solution for x1,..,x3. x3 is simple and works.

Thanks for your help!
POSTED BY: Niklas Casper
4 Replies
That third eqn cannot have a positive root. Log[n!] (or LogGamma[n+1]) is always smaller than n*Log, so the lhs will be negative for n>0.
POSTED BY: Daniel Lichtblau
The third value is the first two values times Sqrt[10.].
Is there an extra factor of ten in the formulas?
POSTED BY: Bruce Miller
Posted 11 years ago
x =  {Sqrt[2 \[Pi] n] (n/Exp[1])^n, (n/Exp[1])^n, n^n};
test = {4, 90, 10^10};
lsg = Flatten[
  Table[FindRoot[(Log[n!] - Log[ x[[i]]])/Log[n!] == 10^-2, {n,
     test[[i]]}], {i, 3}]]
Table[Abs[N[(Log[n!] - Log[ x[[i]]])/Log[n!] /. lsg[[i]]]], {i, 3}]
Now I'm using FindRoot, this maybe works. But the third and last value is for different third elements of test differently. Because of the Precision?

Niklas Casper
POSTED BY: Niklas Casper
If you change the .01 to 10^-2, you get a message that the system cannot be solved with the methods available to NSolve.
POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract