Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

SetPrecision vs N

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71683] SetPrecision vs N
  • From: "Andrew Moylan" <andrew.j.moylan at gmail.com>
  • Date: Sun, 26 Nov 2006 03:49:19 -0500 (EST)

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