Wednesday, October 5, 2016

In Python 2.7, math.sqrt(x) is slower than x**0.5

Hi,

Today I have found that using math.sqrt(x) generally take a longer period of time than x**0.5 to get a result. I was using Python 2.7 on Windows 7 with CPU i5 5200u coupled with 8GB of RAM to produce the claim. I am curious that this may vary with machines. If you have a few minutes, please try yours and let me know how it was.

Thanks,
Saran

Monday, November 23, 2015

Understanding Adaptive Replacement Cache (ARC) through a simple Python code

Hello,

Recently, I had a rather annoying problem of understanding Adaptive Replacement Cache (ARC) algorithm. ARC is an efficient, self-tuning, and patented cache algorithm proposed by folks at IBM about ten years ago. It is much more efficient than LRU and requires just minimal additional overhead. Nevertheless, this cache algorithm is a bit complicated to follow. So I decided to implement it by myself using Python. Note that there is already a nice Python code of ARC. However, that code utilizes wrapper and decoration functions, being quite a bit complex. My code is straightforward and may be more understandable to some Python beginners.

Warning: The code is only for educational purposes. The ARC algorithm is protected by US patent law.

Link to my code on GitHub
Code

Now you know what to do next. Have fun! :)

-
Saran
   

Wednesday, October 22, 2014

Sympy: A Python Library for Symbolic Mathematics

SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible. SymPy is written entirely in Python and does not require any external library.
To find out more, check this.

Saran

Thursday, October 16, 2014

WHAT IS THE DIFFERENCE BETWEEN A THEOREM, A LEMMA, AND A COROLLARY?


I find this useful for me.

WHAT IS THE DIFFERENCE BETWEEN A THEOREM, A LEMMA,
AND A COROLLARY?

PROF. DAVE RICHESON

Definition — a precise and unambiguous description of the meaning of a mathematical term. It characterizes the meaning of a word by giving all the properties and only those properties that must be true.

Theorem — a mathematical statement that is proved using rigorous mathematical reasoning. In a mathematical paper, the term theorem is often reserved for the most important results.

Lemma — a minor result whose sole purpose is to help in proving a theorem. It is a stepping stone on the path to proving a theorem. Very occasionally lemmas can take on a life of their own (Zorn’s lemma, Urysohn’s lemma, Burnside’s lemma, Sperner’s lemma).

Corollary — a result in which the (usually short) proof relies heavily on a given theorem (we often say that “this is a corollary of Theorem A”).

Proposition — a proved and often interesting result, but generally less important than a theorem.

Conjecture — a statement that is unproved, but is believed to be true (Collatz conjecture, Goldbach conjecture, twin prime conjecture).

Claim — an assertion that is then proved. It is often used like an informal lemma.

Axiom/Postulate — a statement that is assumed to be true without proof. These are the basic building blocks from which all theorems are proved (Euclid’s five postulates,Zermelo-Fraenkel axioms, Peano axioms).

Identity — a mathematical expression giving the equality of two (often variable) quantities (trigonometric identities, Euler’s identity).

Paradox — a statement that can be shown, using a given set of axioms and definitions, to be both true and false. Paradoxes are often used to show the inconsistencies in a flawed theory (Russell’s paradox). The term paradox is often used informally to describe a surprising or counterintuitive result that follows from a given set of rules (Banach-Tarski paradox, Alabama paradox, Gabriel’s horn).

Wednesday, October 1, 2014

Working with Excel Files via Python

You may find yourself working with excel file (.xls) and Python is your main language. Don't worry, there is an efficient tool that can help you get through most basic tasks.
To find our more, visit Python Excel.
http://www.python-excel.org/

Cheers,
Saran Tarnoi