I am trying to work with sympy and work with manipulation of expressions.

```
import sympy as sym
from sympy.abc import  t

x0,v0 = sym.symbols("x0 v0 ",  real=True)
wn = sym.symbols("omega_n",  positive = True, real=True)
z = sym.symbols("zeta",  positive = True, real=True)

x = sym.Function('x')
Dx = sym.Derivative(x(t), t)
Dx2= sym.Derivative(x(t), t,2)

res = sym.dsolve(Dx2 +2*z*wn*Dx+ wn**2*x(t), x(t), 
   ics = {  x(0): x0, 
            Dx.subs(t,0):v0})

```

The above yields the following expression

[![enter image description here](https://i.stack.imgur.com/NIJtj.png)](https://i.stack.imgur.com/NIJtj.png)

The part circled in red can be further simplified to [![enter image description here](https://i.stack.imgur.com/LPYOl.png)](https://i.stack.imgur.com/LPYOl.png), however I can't figure out how is it possible to simplify selected portions of the expression.

If I take a simpler exampler `wn*x0*z**2/(2*wn*z**2-2*wn)` then its possible to cancel out the terms with simplify(), but I could find anywhere some good documentation on how to work and substitute parts of the equation.

---

Another similar issue is with the term [![enter image description here](https://i.stack.imgur.com/sEAau.png)](https://i.stack.imgur.com/sEAau.png), which I would like to transform to [![enter image description here](https://i.stack.imgur.com/lf8OP.png)](https://i.stack.imgur.com/lf8OP.png)