SageMath, Cython and Julia: BBP algorithm
1. Outline
outline of the talk
how do I use Sage and Julia
comparison of Sage and Julia
practical comparative example (implementation of BBP algorithm)
2. How do I use SageMath/Julia
SageMath:
teaching math (basics of calculus and linear algebra)
topics for students
Julia:
numerical experiments (related to my research)
topics for students
3. SageMath and Julia
SageMath
Most important facts were already mentioned yesterday.
aims to be an open-source alternative to MMM
uses Python to glue together various math-related software
contains considerable ammount of original code too
its monolithic codebase is hosted on trac server
uses Cython for speed (more about this in a moment)
Julia
Motto: "a new approach to technical computing."
it attempts to
be fast
be easy and fun to use
replace C and FORTRAN (in numerical computing)
relatively small core language library hosted on github
abundance of optional user contributed packages (~960)
Key features:
JIT (Just In Time) compilation
dynamically typed, with optional type annotation
multiple-dispatch
We will demonstrate Sage/Cython/Julia on the following...
4. Bailey-Borwin-Plouffe (BBP) formula
The Bailey-Borwin-Plouffe formula was discovered in 1996. It expresses in the form of a particular infinite series,
One can use this formula to compute hexadecimal digits of at an arbitrary position (without the need to compute any of previous digits).
The algorithm
Let be a non-negative integer. Multiply the relation by , and split the sum into four parts
We are interested only in the fractional part of the left-hand side,
where we have used notation
The denominator of the fraction in the first sum can be computed efficiently using the square and multiply algorithm. The second sum can be evaluated approximately in the given floating point arithmetic since it decays very rapidly.
Fun part: Let us now try to implement this in SageMath and Julia.
