Clear atoms(symbol) and use free_symbols instead

TODO

- [ ] simplify `is_number` method of Integral as discussed in the review comments
- [x] do not use doit in polys

resolves #5526