MathGroup Archive 2002

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

Search the Archive

help in setting precision and getting a smooth curve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33377] help in setting precision and getting a smooth curve
  • From: "Salman Durrani" <dsalman at itee.uq.edu.au>
  • Date: Mon, 18 Mar 2002 23:38:48 -0500 (EST)
  • Organization: The University of Queensland, Australia
  • Sender: owner-wri-mathgroup at wolfram.com

Hi

I have tried increasing the precision but I still cannot get a smooth plot
for the following code with M=64.
( it works for M=2,4,8,16,32. I do not need to go beyond M=64)

The variable "p" is apparently not being calculated correctly and this
causes the final plot to look jagged.

Can anyone please suggest, how to get a smooth plot ?

Thanks

Salman

% ---------------------------------------------------------------
$MaxPrecision = Infinity;
\!\(\(Pb =
      Function[{}, \[IndentingNewLine]perr = {}; \[IndentingNewLine]For[
          a = 5, a <= 7,
          a += 0.1, \[IndentingNewLine]x =
            10\^\(a\/10\); \[IndentingNewLine]M = 64; \[IndentingNewLine]K =
            Log[2, M]; \[IndentingNewLine]r\  =
            1/3; \[IndentingNewLine]dist = {18, 19, \ 20, \ 21, \ 22, \ 23,
\
              24, \ 25, \ 26, \ 27, \ 28, \ 29, \ 30, \ 31, \ 32, \ 33, \
              34, \ 35}; \[IndentingNewLine]numErr = {11, \ 0, 32, \ 0, \
              195, \ 0, \ 564, \ 0, \ 1473, \ 0, \ 5129, \ 0, \ 17434, \ 0,
\
              54092, 0, \ 171117, \ 0}; \[IndentingNewLine]X =
            r\ K\ x; \[IndentingNewLine]p =
            Block[{$MaxExtraPrecision = Infinity},
              N[\(M/2\)\/\(M - 1\)\ Sum[
                    Binomial[M - 1,
                        n]\ \((\(-1\))\)\^\(n + 1\)\/\(1 + n\)\ Exp[\(-\
                            X\)\ n\/\(1 + n\)], {n, 1, M - 1}],
                512]]; \[IndentingNewLine]pfunct[
              pf_] := \((2\ \@\(p\ \((1 - p)\)\))\)\^pf; \
\[IndentingNewLine]sss =
            Sum[numErr[\([d]\)]\ pfunct[dist[\([d]\)]], {d, 1,
                Length[dist]}]; \[IndentingNewLine]AppendTo[
            perr, {a,
              sss}];\[IndentingNewLine]]; \[IndentingNewLine]perr\
\[IndentingNewLine]];\)\)
N[Pb[], 10000];
(*Block[{$MaxExtraPrecision = 10000}, N[Pb[], 256]];*)
<< Graphics`Graphics`;
one = LinearLogListPlot[perr,
      Axes -> False,
      Frame -> True,
      PlotJoined -> True,
      PlotRange -> All,
      PlotStyle -> {AbsoluteThickness[1.5], RGBColor[1, 0, 0]}
      ];
TableForm[perr] // N

% ---------------------------------------------------------------








  • Prev by Date: Re: Integrating using If[ ]
  • Next by Date: RE: help needed with mathematical calculation
  • Previous by thread: Re: Creating List of Sequence Iterates
  • Next by thread: Export Directory