WorksFoMe(TM) on 9.7.beta3 :
sage: var("E, V0, p1, a")
(E, V0, p1, a)
sage: Ex=E == 1/2*(V0*p1*cos(sqrt(-(E - V0)*p1)*a)*sin(sqrt(-(E - V0)*p1)*a) - sqrt(-(E - V0)*p1)*sqrt(E)*sqrt(p1)*cos(sqrt(-(E - V0)*p1)*a)^2 + sqrt(-(E - V0)*p1)*sqrt(E)*sqrt(p1)*sin(sqrt(-(E - V0)*p1)*a)^2)/(p1*cos(sqrt(-(E - V0)*p1)*a)*sin(sqrt(-(E - V0)*p1)*a))
sage: var("beta")
beta
sage: Ex.subs(-(E-V0)*p1==beta)
E == 1/2*(V0*p1*cos(a*sqrt(beta))*sin(a*sqrt(beta)) - sqrt(E)*sqrt(beta)*sqrt(p1)*cos(a*sqrt(beta))^2 + sqrt(E)*sqrt(beta)*sqrt(p1)*sin(a*sqrt(beta))^2)/(p1*cos(a*sqrt(beta))*sin(a*sqrt(beta)))
$$E = \frac{V_{0} p_{1} \cos\left(a \sqrt{\beta}\right) \sin\left(a \sqrt{\beta}\right) - \sqrt{E} \sqrt{\beta} \sqrt{p_{1}} \cos\left(a \sqrt{\beta}\right)^{2} + \sqrt{E} \sqrt{\beta} \sqrt{p_{1}} \sin\left(a \sqrt{\beta}\right)^{2}}{2 \, p_{1} \cos\left(a \sqrt{\beta}\right) \sin\left(a \sqrt{\beta}\right)}$$
One can get a "nicer"(?) expression with :
sage: w0=SR.wild(0)
sage: (Ex.subs(-(E-V0)*p1*w0==beta*w0).expand().trig_reduce()-V0/2).factor()+V0/2
E == -1/2*sqrt(-(E - V0)*p1)*sqrt(E)*(cot(sqrt(-(E - V0)*p1)*a) - tan(sqrt(-(E - V0)*p1)*a))/sqrt(p1) + 1/2*V0
Another possibility is :
sage: var("EE")
EE
sage: mathematica.FullSimplify(Ex.subs(E==EE)).sage().subs(EE=E)
(cot(sqrt(-E + V0)*a*sqrt(p1))^2 - 1)*sqrt(E)*sqrt(-E + V0)*tan(sqrt(-E + V0)*a*sqrt(p1)) + 2*E == V0
[ Note that the E
variable clashes with Mathematica's E
constant (=exp(1)
). ]
What Sage version do you use ? And what did you expect ?
HTH,
EDIT : Yet another "nicer" answer :
sage: (Ex-V0/2).subs(-(E-V0)*p1==beta).expand().trig_reduce().factor().trig_simplify()+V0/2
E == 1/2*V0 + 1/2*(2*sin(a*sqrt(beta))^2 - 1)*sqrt(E)*sqrt(beta)/(sqrt(p1)*cos(a*sqrt(beta))*sin(a*sqrt(beta)))
$$E = \frac{1}{2} \, V_{0} + \frac{{\left(2 \, \sin\left(a \sqrt{\beta}\right)^{2} - 1\right)} \sqrt{E} \sqrt{\beta}}{2 \, \sqrt{p_{1}} \cos\left(a \sqrt{\beta}\right) \sin\left(a \sqrt{\beta}\right)}$$
or
sage: (Ex-V0/2).subs(-(E-V0)*p1==beta).expand().trig_reduce().factor().trig_simplify().trig_reduce()+V0/2
E == -sqrt(E)*sqrt(beta)*cos(2*a*sqrt(beta))*csc(2*a*sqrt(beta))/sqrt(p1) + 1/2*V0
$$E = -\frac{\sqrt{E} \sqrt{\beta} \cos\left(2 \, a \sqrt{\beta}\right) \csc\left(2 \, a \sqrt{\beta}\right)}{\sqrt{p_{1}}} + \frac{1}{2} \, V_{0}$$
or even
sage: w1=SR.wild(1)
sage: view((Ex-V0/2).subs(-(E-V0)*p1==beta).expand().trig_reduce().factor().trig_simplify().trig_reduce().subs(cos(w0)*csc(w0)*w1==cot(w0)*w1)+V0/2)
$$E = -\frac{\sqrt{E} \sqrt{\beta} \cot\left(2 \, a \sqrt{\beta}\right)}{\sqrt{p_{1}}} + \frac{1}{2} \, V_{0}$$
Season to taste...