What exactly is the desired output? I guess “simplifying” is not uniquely defined. If you want to have a polynomial in rₙ in the “usual” form, simplify has a few keyword arguments.
Docstring
help?> simplify
search: simplify simplify_fractions
simplify(x; expand=false,
threaded=false,
thread_subtree_cutoff=100,
rewriter=nothing)
Simplify an expression (x) by applying rewriter until there are no changes. expand=true applies expand (/api/#expand) in the beginning
of each fixpoint iteration.
By default, simplify will assume denominators are not zero and allow cancellation in fractions. Pass simplify_fractions=false to
prevent this.
By using expand=true in your example, we can get the (I assume) desired output
Absolutely, it took me a while to realize and get used to just hitting ? and search the built-in docs. As a bonus, it really makes one appreciate the effort many package authors put into their docstrings.
Ah, one more think I just remembered: There is also a tutorial specifically about defining your own “rewriters” – you can put them as a kwarg into simplify. If you have a very specific final form of the symbolic expression in mind, it might be useful to define such custom simplification rules: