I am trying to evaluate a decimal expansion of a fractional value to a large number of digits of precision (in this example 100):


I am trying to do this in wxMaxima, that's what the expression above works in. It's trying to take a high precision floating point value numerator and denominator, and evaluate them to a particular precision (100 digits).

My trouble is perhaps just a display issue in Maxima:

    1.0020030040050060070080090100[44 digits]920930940950960970980991001b-6

I am not sure what the above means, but I think it means that the middle 44 digits are not being shown on the screen even though they are available internally. What I was hoping for would be:

  1. A way to get the period of the repeating decimal, if there is one,

  2. The full precision (100 digits as requested above) shown on the screen as the result.

Perhaps I'm just doing it wrong. So my question is really (a) how can I determine a precise value for the above, and (b) do something similar to what wolfram alpha does with respect to showing me the period of a repeating decimal if the expansion is periodic. It is very interesting that Wolfram Alpha automatically reports the period of the decimal expansion, if it repeats.

  • 1
    $\begingroup$ You could also create a free account at sagenb.org and enter: ((10^3-1)^(-2)).n(digits=100). If you want to see it without scientific notation, add one to it before formatting (and ignore it in the output). $\endgroup$
    – bgins
    Jan 24, 2012 at 20:38
  • $\begingroup$ thanks. Maybe that's easier than getting this to work in maxima. It works fine in Wolfram Alpha, but I'd like a real app on my computer that I can learn to do stuff in. (The goal is to learn to do some math in a math program.) sage for windows appears to be dead... $\endgroup$
    – Warren P
    Jan 24, 2012 at 20:48
  • $\begingroup$ For windows try this: sagemath.org/download-windows.html $\endgroup$
    – bgins
    Jan 24, 2012 at 21:13
  • $\begingroup$ ma.utexas.edu/pipermail/maxima/2006/003118.html $\endgroup$ Jan 24, 2012 at 21:16
  • $\begingroup$ That's not really a windows version. It's a complete virtual machine packaged as an appliance. :-) I may as well just install the Linux version in my linux vm. $\endgroup$
    – Warren P
    Jan 24, 2012 at 21:45

2 Answers 2


$$ \frac{1}{(1000-1)^2} =\frac{10^{-6}}{(1-\frac{1}{1000})^2} =\frac{10^{-6}}{(1-x)^2} =10^{-6}\left(\sum_{n=0}^{\infty}x^n\right)^2 =10^{-6}\sum_{n=1}^{\infty}nx^{n-1} $$ for $x=.001$, which has no carries in its decimal expansion for $n<1000$. Thus the first $1000$ triplets ($3000$ digits after the decimal place) will be $0.000\;001\;002\;003\;\dots\;996\;997\;999\;000$, which brings us up to the first digit which receives a carry. If you want to see it without the scientific notation, add one before formatting. In sage:

(1+(10^3-1)^(-2)).n(digits=3001) # ignore the leading one in the output!

or in scientific notation:

((10^3-1)^(-2)).n(digits=3001) # note the e-6 at the end, meaning times 10^{-6}

As to the formula above, it can be derived by differentiation: $$ \left(\sum_{n=0}^{\infty}x^n\right)^2 =(1-x)^{-2} =\frac{d}{dx}(1-x)^{-1} =\frac{d}{dx}\left(\sum_{n=0}^{\infty}x^n\right) =\sum_{n=1}^{\infty}nx^{n-1} \qquad\text{for} \qquad|x|<1 $$

  • $\begingroup$ This is really cool. I am now going to check out sage on Linux since it seems kind of "not much supported" on Windows. $\endgroup$
    – Warren P
    Jan 24, 2012 at 21:42

Looks like this works:

fpprec : 100;

The first command (set display) is found in the menus as Hans stated, under "Maxima -> Change 2d display".

Thanks to Hans Ludmark for the link.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .