Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Simple question or how Mathematica getting on my nerves.

  • To: mathgroup at
  • Subject: [mg45796] Re: Simple question or how Mathematica getting on my nerves.
  • From: Harold.Noffke at (Harold Noffke)
  • Date: Sun, 25 Jan 2004 03:04:50 -0500 (EST)
  • References: <butdvt$9se$>
  • Sender: owner-wri-mathgroup at


I downloaded your Notebook entries, and have examples which may save
you some hair.  You are getting a non-trivial difference between your
two integrals because you are "comparing apples to oranges".  The
example I use below illustrates this point.  However, it will not
answer all your questions; nor will it answer all my own.  Perhaps a
good number theorist can comment on the example's mathematical
background.  So, here goes.

When worried about accuracy in Mathematica calculations, it is better
to keep every number in "whole number fractional notation" -- that is,
as the ratio of two whole numbers.  You went from "apples" to
"oranges" when you changed 5242/10000 and 6214/10000 to 0.5242 and
0.6214, respectively.  If you read "The Mathematica Book > A Practical
Introduction to Mathematica > 1.1.4 Arbitrary Precision Calculations",
you will find some examples which explain the difference between
apple-fractions and orange-decimals.  This is the source material I
used here.

First, we define your "k-function" in TextForm ...

    In[1]:= k[f_] := 2687176093959399272413585923303421161600 * (1 -
f)^67 * f^61

Then, after reading Mathematica Book Section 1.1.4, we determine the
accurate fractional equivalent of 0.5242 and 0.6214.

    In[2]:= u = SetPrecision[ 0.5242, Infinity]

    Out[2]= ----------------

    In[3]:= l = SetPrecision[ 0.6214, Infinity]

    Out[3]= ----------------
Now, we calculate np (where "p" denotes "precise"), the value obtained
from using the precise fractional equivalents above.

    In[4]:= np = Integrate[ k[f], {f, l, u}]

    Out[4]= -(163 ... / ... 848) <-- Multiline whole-number fraction
abbreviated here.
Next, we let u and v be the fractions you specified.
    In[5]:= u = 5242/10000

    Out[5]= ----

    In[6]:= l = 6214/10000

    Out[6]= ----
Now, we calculate nf (where "f" denotes your original fractions).

    In[7]:= nf = Integrate[ k[f], {f, l, u}]

    Out[7]= -(321 ... / ... 000) <-- Multiline whole-number fraction
abbreviated here.
Now that we have derived two "apples" answers, we can determine how
close they are.
    In[8]:= Abs[ np - nf] // N

    Out[8]= 1.87048 10

So, np and nf differ by about 2 parts in 10^18, which is probably good
enough for government work.


  • Prev by Date: Re: typesetting fractions
  • Next by Date: Help browser
  • Previous by thread: Re: Simple question or how Mathematica getting on my nerves.
  • Next by thread: Re: Simple question or how Mathematica getting on my nerves.