clear all ; This is the famous Bailey-Borwein-Plouffe (BBP) algorithm. ; Sum this n = 0 to infinity to compute pi. ; This is especially useful for calculating pi in hexadecimal. ; One hexadecimal digit of pi is generated with each iteration. ((4/((8*n) + 1)) - (2/((8*n) + 4)) - (1/((8*n) + 5)) - (1/((8*n) + 6)))/(16^n) simplify sum n 0 10 ; Sum as n goes from 0 to 10. pi ; Verify that the digits are the same. x^n/n! ; Sum this n = 0 to infinity to compute (e^x). replace x with 1 ; Sum this n = 0 to infinity to compute e: sum n 0 20 ; Sum as n goes from 0 to 20. e ; Verify that the digits are the same.