This representation of natural numbers could be used as constructive implementation of sequences in maths. (E.g. for the mentioned continued fractions.) From there one can use:
def partial_sum(generator):
mysum = 0.
for v in generator:
mysum += v
yield mysum
arctan_series_times_4 = (4*(-1)**n/(2*n+1) for n in nats(0)) # 4*(1, -1/3, 1/5, ....)
pi_approx = partial_sum(arctan_series_times_4) # 4*(1 - 1/3 + 1/5 - ....)
to calculate an approximation of pi. Using pi_approx:
This is a horribly slow convergent series. One can use other series representation or the continued fractions to accelerate it. The point is: In the message one could write something like
intro pi;
(< (abs (- pi (next pi_approx))) (frac 2 1));
(< (abs (- pi (next pi_approx))) (frac 1 2));
(< (abs (- pi (next pi_approx))) (frac 1 3));
...
which shows the listener that pi is a constant which is approximated better with every step of (next pi_approx). In some sense, one shows the limit in a manual way. :-) From this point, it is possible to show the listener irrational numbers as limits of certain sequences. Maybe this cannot be done for every irrational number, but for important numbers like pi, e, sqrt(2), the golden ratio, and so on.
One could use a similar construction to show the listener what infinity is:
In Python there exist generators which serve as finite or infinite data sources.
How to use:
Or infinite
Usage:
This representation of natural numbers could be used as constructive implementation of sequences in maths. (E.g. for the mentioned continued fractions.) From there one can use:
to calculate an approximation of
pi
. Usingpi_approx
:This is a horribly slow convergent series. One can use other series representation or the continued fractions to accelerate it. The point is: In the message one could write something like
which shows the listener that
pi
is a constant which is approximated better with every step of(next pi_approx)
. In some sense, one shows the limit in a manual way. :-) From this point, it is possible to show the listener irrational numbers as limits of certain sequences. Maybe this cannot be done for every irrational number, but for important numbers likepi
,e
,sqrt(2)
, the golden ratio, and so on. One could use a similar construction to show the listener what infinity is:Maybe one has to use more than one generator to transport the concept.
Does this make any sense?