<commit_before>
from sympy import Symbol, simplify, collect, latex, pprint 
rho = Symbol("rho")
s = Symbol("s")
q = Symbol("q")
r = Symbol("r")
eps = Symbol("epsilon")
pprint(collect(simplify((q*(rho**2)*(s+1)*(rho-1)**2).expand() - 
    (2*q*rho*((rho-1)**2) * (rho*(s+1)-s) ).expand() + 
    (r*rho**2*(rho*(s+1)-s)**2).expand() - 
    (2*r*rho*(rho-1)*(rho*(s+1)-s)**2).expand() -
    (eps*((rho*(s+1)-s)**2) *(rho-1)**2).expand()), rho))<commit_msg>Bound in terms of sigma. <commit_after>
from sympy import Symbol, simplify, collect, latex, pprint, solve 


rho = Symbol("rho")
s = Symbol("s")
p = Symbol("p")
q = Symbol("q")
r = Symbol("r")
eps = Symbol("epsilon")
sigma = Symbol("sigma")


print(collect(simplify( ((p - sigma)**2*(sigma**2 * (s+1) - 2*p*sigma)).expand() 
    + r*sigma**2*s**2 - (2*r*s*sigma*(p-sigma)).expand() - ((p - sigma)**2*eps).expand()), sigma))

"""
print(solve(collect(simplify((q*(rho**2)*(s+1)*(rho-1)**2).expand() - 
    (2*q*rho*((rho-1)**2) * (rho*(s+1)-s) ).expand() + 
    (r*rho**2*(rho*(s+1)-s)**2).expand() - 
    (2*r*rho*(rho-1)*(rho*(s+1)-s)**2).expand() -
    (eps*((rho*(s+1)-s)**2) *(rho-1)**2).expand()), rho), rho))"""

"""pprint(collect(simplify((q*(rho**2)*(s+1)*(rho-1)**2).expand() - 
    (2*q*rho*((rho-1)**2) * (rho*(s+1)-s) ).expand() + 
    (r*rho**2*(rho*(s+1)-s)**2).expand() - 
    (2*r*rho*(rho-1)*(rho*(s+1)-s)**2).expand() -
    (eps*((rho*(s+1)-s)**2) *(rho-1)**2).expand()), rho))"""
{'fraction_non_alphanumeric': 0.3448275862068966, 'fraction_numerical': 0.04482758620689655, 'mean_word_length': 4.850806451612903, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6516388', 'n_tokens_mistral': 667, 'n_tokens_neox': 625, 'n_words': 85}