sympy/sympy — pull request #2141 by smichr (2013-05-30 04:50:36+00:00)
Title: factor gets deep flag

This allows factor to work inside functions:

e.g in answering the question, "What is the angle subtended by a circle of radius r that is a distance d from the origin?":

```
>> t=Circle((d,0),r).tangent_lines((0,0)) >> a=t[0].angle_between(t[1]) >> simplify(a)
acos((d**4 - 3*d**2*r**2 + 2*r**4)/(d**2*(d**2 - r**2)))
>> factor(_)
acos(d**4/(d**4 - d**2*r**2) - 3*d**2*r**2/(d**4 - d**2*r**2) + 2*r**4/(d**4 - d **2*r**2))
>> factor(_, deep=1)
acos(-(-d**2 + 2*r**2)/d**2)
>> expand(_)
acos(1 - 2*r**2/d**2)
```

That last expression is a lot nicer than the default form obtained from factor.