# How to simplify complicated expressions

Hello,

This complicated expression would be a zero function, but I can't achive to simplify it. I think I've run into lots of expressions like this one, but I've never come up with a solution.

This is mi code:

```
var('R d',domain='positive')
var('p',domain='real')
var('t',domain='real',latex_name="\\theta")
f=(R*cos(t) - d)*p/(-2*R*d*cos(t) + R^2 + d^2)^(3/2) + (R*cos(t) -R^2/d)*R^3*p/((-2*R^3*cos(t)/d + R^2 + R^4/d^2)^(3/2)*d^3) +R*p/(sqrt(-2*R^3*cos(t)/d + R^2 + R^4/d^2)*d^2
```

Thanks for your edits. Your question is much easier to read and to work on now.