Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

My command is:

Grid[{{N, logN!, N log N - N}, {10, Log[10!], 10 Log[10] - 10}}, Frame -> All]

In the second row of the grid, the function Log[] is not being evaluated.

Please let me know what is going wrong.

share|improve this question
    
Hi Omar. How about N@Log[10]? –  cormullion Sep 11 '13 at 15:27
    
The log of 10 is Log[10] not 2.3025 just like the square root of 2 is Sqrt[2] and not 1.414. Take some time to let that think in. Mathematica likes to keep things exact as long as it can and as long as it makes sense. –  Sjoerd C. de Vries Sep 11 '13 at 17:01
add comment

closed as off-topic by Szabolcs, Artes, Sjoerd C. de Vries, rm -rf Sep 11 '13 at 17:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Szabolcs, Artes, Sjoerd C. de Vries, rm -rf
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

Mathematica never returns inexact answers when you give it exact expressions. If you append a dot to a number it is considered approximate, so Mathematica will calculate approximate answers. Otherwise it will just return a symbolic expression. N asks Mathematica to treat all numbers as approximate.

N@Grid[{
   {"N", "log N!", "Nlog N - N"},
   {10, Log[10!], 10 Log[10] - 10}},
  Frame -> All
  ]

or using dots:

Grid[
 {
  {"N", "log N!", "Nlog N - N"},
  {10, Log[10.!], 10 Log[10.] - 10}
  }, Frame -> All]

The approximated Stirling's approximation in the last column, I suppose.

share|improve this answer
    
The first sentence has an exeption(s?) unfortunatelly :) mathematica.stackexchange.com/q/16282/5478 –  Kuba Sep 11 '13 at 15:40
    
@Kuba I might add a source later. I don't think there are any intentional exceptions because I'm pretty sure it says exactly what I said in "Power Programming with Mathematica" :) –  Pickett Sep 11 '13 at 15:43
1  
I think your answer is good. It is just a deviation in non related case :) But worth to know. –  Kuba Sep 11 '13 at 15:43
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.