Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You could just formally express s in terms of t by setting s=log(t)/log(p) and trust formal manipulations to do what you want:

sage: f=(p-1)*p^(2*s)*(p^(s+3)-1)/(p^(2*s+3)-1)*p^(s+1)
sage: f.subs({s:log(t)/log(p)}).canonicalize_radical().factor()
(p^3*t - 1)*(p - 1)*p*t^3/(p^3*t^2 - 1)

You could just formally express s in terms of t by setting s=log(t)/log(p) and trust formal manipulations to do what you want:

sage: f=(p-1)*p^(2*s)*(p^(s+3)-1)/(p^(2*s+3)-1)*p^(s+1)
expr = (p^(s + 3) - 1)*(p - 1)*p^(2*s)/((p^(s + 1) - 1)*(p^(2*s + 3) - 1))
sage: f.subs({s:log(t)/log(p)}).canonicalize_radical().factor()
expr.subs({s:log(t)/log(p)}).canonicalize_radical().factor()
(p^3*t - 1)*(p - 1)*p*t^3/(p^3*t^2 1)*t^2/((p^3*t^2 - 1)
1)*(p*t - 1))

it might save you having to come up with a fancy pattern of wildcards to catch all possible cases.