how to best simplify product of square roots
I'd like to simplify expressions like
p1,p2,p3 = var('p1 p2 p3')
assume(p1>0,p2>0,p3>0)
R = p1*p2*sqrt(p3)*sqrt(p3/p1)*sqrt(p3/p2)
R
without using R.canonicalize_radical(), which unfortunately messes up other factors. I understand there are some options using R.simplify_chain_real(), but what else can I try?
Let us see an example where also R.simplify_chain_real() messes things up:
p1,p2,p3 = var('p1 p2 p3')
assume(p1>0,p2>0,p3>0)
# R = p1*p2*sqrt(p3)*sqrt(p3/p1)*sqrt(p3/p2)
R = p1*p2*sqrt(p3)*sqrt(p3/p1)*sqrt(p3/p2)/((p1 - p3)*(p2 - p3)*(p3 - 1))
%display latex
from sage.manifolds.utilities import simplify_chain_real
simplify_chain_real(R)
#R
what is
simplify_chain_real? Not in Sagemath 9.1.beta0...One has to import it:
It is documented here
Indeed,
simplify_chain_realdoes the job here:On general grounds, for real expressions,
simplify_chain_realis safer thancanonicalize_radical(see the doc examples for a case wherecanonicalize_radicalyields a wrong result).@eric_g I understand, but still
simplify_chain_realmesses things up, look at the second example I added.