# Exponential change of variables in symbolic ring

I am using a program that outputs elements of the symbolic ring that are rational expressions in an exponential variables $p^s$ for some prime $p$. (Specifically, it is the igusa_zeta() function from here.) For example, one possible output is

(p^(s + 3) - 1)*(p - 1)*p^(2*s)/((p^(s + 1) - 1)*(p^(2*s + 3) - 1))}.

I would like to know if there is an automated way to change to the variable $t = p^s$ such that this expression becomes $$\frac{(p^3 t - 1) (p-1) t^2}{(pt-1) (p^3 t^2 - 1)}.$$

edit retag close merge delete

Sort by » oldest newest most voted

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: expr = (p^(s + 3) - 1)*(p - 1)*p^(2*s)/((p^(s + 1) - 1)*(p^(2*s + 3) - 1))
(p^3*t - 1)*(p - 1)*t^2/((p^3*t^2 - 1)*(p*t - 1))


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

more

Does this help?

var('p s t')

def transf(expr):
w0 = SR.wild(0); w1 = SR.wild(1);
expr_t = expr.subs({p^s:t})
expr_t = expr_t.subs({p^(w0*s):t^w0})
expr_t = expr_t.subs({p^(s+w1):t*p^w1})
expr_t = expr_t.subs({p^(w0*s+w1):t^w0*p^w1})
return expr_t

# expression 1
expr1 = (p^(s + 3) - 1)*(p - 1)*p^(2*s)/((p^(s + 1) - 1)*(p^(2*s + 3) - 1))

# expression 2
expr2 = p^s / (p^(s+1) - 1)

for expr in [expr1, expr2]:
pretty_print(expr, LatexExpr(r"\mapsto"), transf(expr))


produces:

$$\newcommand{\Bold}{\mathbf{#1}}\frac{{\left(p - 1\right)} p^{2 \, s} {\left(p^{s + 3} - 1\right)}}{{\left(p^{2 \, s + 3} - 1\right)} {\left(p^{s + 1} - 1\right)}} \mapsto \frac{{\left(p^{3} t - 1\right)} {\left(p - 1\right)} t^{2}}{{\left(p^{3} t^{2} - 1\right)} {\left(p t - 1\right)}}$$

$$\newcommand{\Bold}{\mathbf{#1}}\frac{p^{s}}{p^{s + 1} - 1} \mapsto \frac{t}{p t - 1}$$

My limited knowledge of using wild cards is that you have to be very careful because it does not identify "units", and "zero"; see the last substitution would be fine mathematically to catch all instances (if wildcard meant anything) but since the expression is syntactically different from the others, we need the previous ones.

more

It doesn't work with expr = p^s itself, or any expression containing it (I found this when looking at expr = p^s / (p^(s+1) - 1). ) I can't figure out why. (I've tried adding an addition expr_t = expr_t.subs({p^s : t}) but that doesn't catch it either.)

i've edited the script so that it works with the new expression also, maybe answers your comment. but i upvoted @nbruin's solution because it is simpler.