MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

SetPrecision vs N


Hi all,

Suppose I want to evaluate an expression at a given precision. What is
the difference between using N[expr, precision] and using
SetPrecision[expr, precision]?

I've noticed that SetPrecision seems to be equivalent even in such
situations as e.g. N[Integrate[...]] automatically calling
NIntegrate[...] when the integral can't be done exactly:

SetPrecision[Integrate[x^x, {x, 0, 1}], 20]
  and
N[Integrate[x^x, {x, 0, 1}], 20]
  both give
0.78343051071213440706

Are there important differences between SetPrecision and N that I
should be aware of?

Cheers,
Andrew


  • Prev by Date: Re: Partition
  • Next by Date: Re: Partition
  • Previous by thread: Re: Not accepting function as parameter
  • Next by thread: Re: SetPrecision vs N