Archive: March 2020

  • Creating a Python function to calculate Pi

    Pi is 3.14159 to 5 decimal places.To work out Pi, we will be using Leibniz’s formula:X = 4 – 4/3 + 4/5 – 4/7 + 4/9 – …This series converges to Pi, the more terms that are added to the series, the closer the value is to Pi.For the proof on why this series converges to Pi – https://proofwiki.org/wiki/Leibniz%27s_Formula_for_PiThere are several points to note about the series: It’s infinite, we need to find a way to continue…

    » Read more
  • SQL LAST_VALUE() wrong results

    You may have come across the following scenario when using the LAST_VALUE() function. You want to find the first or last value loaded in a result set, therefore you use the FIRST_VALUE() and LAST_VALUE() functions like below: You expect to get “A” for every record in the FirstValue column and “E” for every record in the LastValue column.However you see the following output: LAST_VALUE() on its own is implemented from the…

    » Read more