First time here? Check out the FAQ!
answered 6 years ago
For simplifying expressions involving square roots, it often helps to use the canonicalize_radical method.
canonicalize_radical
In your case:
sage: f.canonicalize_radical() 0