We create two power series, and .
The power series keeps a record of and as its ancestors.
We can set the display styles for and independently. We ensure that enough terms are computed to show the difference.
The power series is a copy of , however, they share and , therefore when more terms of are computed, the precision of and will be updated too. Consequently, the computation of new terms of must be cheaper as it does not involve computing the coefficients of and .
memory used=143.59MiB, alloc change=108.62MiB, cpu time=1.60s, real time=1.52s, gc time=216.32ms
| |
memory used=6.70MiB, alloc change=0 bytes, cpu time=22.00ms, real time=23.00ms, gc time=0ns
| |