Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7693

Re: For a variety of plotting experiences, maybe bugs?

From Richard Fateman <fateman@eecs.berkeley.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: For a variety of plotting experiences, maybe bugs?
Date 2012-01-09 08:26 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jee8bk$d2m$1@smc.vnet.net> (permalink)
References <je3vti$eeh$1@smc.vnet.net> <je6e5h$q7b$1@smc.vnet.net> <24475751.93762.1326015447306.JavaMail.root@m06> <006601ccce2f$c71c7ee0$55557ca0$@comcast.net>

Show all headers | View raw


David:
Thanks. Your suggestions would be useful if I were interested in exploring
the cosine function.  However, I was interested in exploring 
Cos[MachinePrecisionNumbers].
(actually, some other numerical functions. I just used cos to simplify 
the example).

  My interest was whether the numerical subroutine reflected the 
mathematical functions and
were appropriately monotonic in small ranges.  Looking "microscopically" 
one expects to see some kind of step function,
but if poorly implemented there may be some reversals-- i.e. local 
extrema-- that are not
mathematically justified, but are effects of the implemented algorithm, 
roundoff, etc.

I found that Mathematica refused to plot the most straightforward 
versions of these
investigations.


As far as why the powers of 2 instead of 10,  the fraction part of a 
machine float x has, as one
unit in the last place,  one part in  2^(52)  of x.    I find 2^-52 to 
be much nicer to look at than

2.220446049250313*^-16

as well as more accurate.




  On 1/8/2012 10:03 AM, David Park wrote:
> Small domains and small intervals are often treated masochistically. And why
> the powers of 2 instead of 10?
>
> This is the easy way to make the plots. Use a reasonable domain and range
> and enough WorkingPrecision.
>
> With[{n = 140},
>   Plot[(Cos[x 10^-n + 1] - Cos[1]) 10^n, {x, 0, 1},
>    WorkingPrecision ->  n + 3,
>    Frame ->  True,
>    FrameLabel ->  {(y - 1) 10.^n, 10.^n (Cos[y] - Cos[1])}]
>   ]
>
> Or use a series expansion:
>
> Series[10^n (Cos[1 + x 10^-n] - Cos[1]), {x, 0, 2}] // Normal
>
> -2^(-1 - n) 5^-n x^2 Cos[1] - x Sin[1]
>
> and then use MachinePrecision:
>
> With[{n = 145},
>   Plot[-2^(-1 - n) 5^-n x^2 Cos[1] - x Sin[1], {x, 0, 1},
>    WorkingPrecision ->  MachinePrecision,
>    Frame ->  True,
>    FrameLabel ->  {(y - 1) 10.^n, 10.^n (Cos[y] - Cos[1])}]
>   ]
>
> That is the way they do it in technical journals all the time.
>
>
> David Park
> djmpark@comcast.net
> http://home.comcast.net/~djmpark/index.html
>
>
>
>
>
>
> From: Richard Fateman [mailto:fateman@cs.berkeley.edu]
>
>
> try this (I did it on version 7...)
> Table[Plot[Cos[x], {x, 1 , 1 + 2.0^-i}], {i, 40, 45}]
>

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

JordanDecompose[] Leslaw Bieniasz <nbbienia@cyf-kr.edu.pl> - 2012-01-05 11:01 +0000
  Re: JordanDecompose[] danl@wolfram.com - 2012-01-06 09:16 +0000
    For a variety of plotting experiences, maybe bugs? (small intervals) Richard Fateman <fateman@cs.berkeley.edu> - 2012-01-08 09:23 +0000
    Re: JordanDecompose[] Leslaw Bieniasz <nbbienia@cyf-kr.edu.pl> - 2012-01-09 08:16 +0000
      Re: JordanDecompose[] danl@wolfram.com - 2012-01-10 10:59 +0000
    RE:  For a variety of plotting experiences, maybe bugs? (small intervals) "David Park" <djmpark@comcast.net> - 2012-01-09 08:25 +0000
    Re:  For a variety of plotting experiences, maybe bugs? Richard Fateman <fateman@eecs.berkeley.edu> - 2012-01-09 08:26 +0000

csiph-web