<commit_before># bigO

[![PyPI version](https://badge.fury.io/py/bigO.svg)](http://badge.fury.io/py/bigO)
[![Build Status](https://travis-ci.org/perimosocordiae/bigO.svg?branch=master)](https://travis-ci.org/perimosocordiae/bigO)

*Symbolic representation of big-O notation.*

I was [looking for something like this](http://stackoverflow.com/questions/14510216/is-there-a-library-for-programmatic-manipulation-of-big-o-complexities)
but couldn't find it.
So I wrote it, and it turned out to be much simpler than I expected.

Note that this is not the same as [sympy.series.order](http://docs.sympy.org/dev/modules/series.html#order-terms):
that handles terms in series expansions of functions, whereas this library deals with time and/or space complexity.

## Usage

```python
import sympy
from bigO import O, n

f_time = O(n)
g_time = O(n**2)
h_time = O(sympy.sqrt(n))

fastest_asymptotically = min(f_time, g_time, h_time)
# = h_time

total_time = f_time.inside(g_time).followed_by(h_time)
# = O(n**3)

# If you prefer a less verbose API:
total_time = f_time * g_time + h_time
# = O(n**3)
```
<commit_msg>updating note about sympy.series.order<commit_after># bigO

[![PyPI version](https://badge.fury.io/py/bigO.svg)](http://badge.fury.io/py/bigO)
[![Build Status](https://travis-ci.org/perimosocordiae/bigO.svg?branch=master)](https://travis-ci.org/perimosocordiae/bigO)

*Symbolic representation of big-O notation.*

I was [looking for something like this](http://stackoverflow.com/questions/14510216/is-there-a-library-for-programmatic-manipulation-of-big-o-complexities)
but couldn't find it.
So I wrote it, and it turned out to be much simpler than I expected.

Note that much of this functionality can now be achieved using [sympy.series.order](http://docs.sympy.org/dev/modules/series.html#order-terms),
if you're careful to specify that your limits go to infinity.

## Usage

```python
import sympy
from bigO import O, n

f_time = O(n)
g_time = O(n**2)
h_time = O(sympy.sqrt(n))

fastest_asymptotically = min(f_time, g_time, h_time)
# = h_time

total_time = f_time.inside(g_time).followed_by(h_time)
# = O(n**3)

# If you prefer a less verbose API:
total_time = f_time * g_time + h_time
# = O(n**3)
```

{'fraction_non_alphanumeric': 0.14330922242314648, 'fraction_numerical': 0.009945750452079566, 'mean_word_length': 4.88563829787234, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6211656', 'n_tokens_mistral': 854, 'n_tokens_neox': 818, 'n_words': 196}