This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / New in Version 3.0 / Numerical Computation  /
N

  • N[ expr ] gives the numerical value of expr.
  • N[ expr , n ] attempts to give a result with n-digit precision.
  • Unless numbers in expr are exact, or of sufficiently high precision, N[ expr , n ] may not be able to give results with n-digit precision.
  • N[ expr , n ] may internally do computations to more than n digits of precision.
  • $MaxExtraPrecision specifies the maximum number of extra digits of precision that will ever be used internally.
  • The precision n is given in decimal digits; it need not be an integer.
  • n must lie between $MinPrecision and $MaxPrecision. $MaxPrecision can be set to Infinity.
  • N[ expr ] gives a machine-precision number, so long as its magnitude is between $MinMachineNumber and $MaxMachineNumber.
  • N[0] gives the exact integer 0, unless you explicitly set it to have a different value.
  • N converts all non-zero numbers to Real or Complex form.
  • N converts each successive argument of any function it encounters to numerical form, unless the head of the function has an attribute such as NHoldAll.
  • You can define numerical values of functions using N[ f [ args ]] := value and N[ f [ args ], n ] := value.
  • See the Mathematica book: Section 1.1.2, Section 1.1.4Section 3.1.4.
  • See also: Chop, CompiledFunction, Rationalize, $MachinePrecision, NHoldAll.

    Further Examples

    Here is a numerical approximation to the square root of 2.

    In[1]:=

    Out[1]=

    Here is a numerical approximation to pi to 50 decimal places.

    In[2]:=

    Out[2]=