Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Does this help?

var('p s t')
expr = (p^(s + 3) - 1)*(p - 1)*p^(2*s)/((p^(s + 1) - 1)*(p^(2*s + 3) - 1))
pretty_print(expr)
w0 = SR.wild(0); w1 = SR.wild(1); w2 = SR.wild(2);

expr_t = expr.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})

pretty_print(expr_t)

produces:

(p1)p2s(ps+31)(p2s+31)(ps+11)

(p3t1)(p1)t2(p3t21)(pt1)

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 perfectly fine mathematically to catch all instances, but since the expression is syntactically different from the others, we need the previous ones.

click to hide/show revision 2
No.2 Revision

Does this help?

var('p s t')
expr = (p^(s + 3) - 1)*(p - 1)*p^(2*s)/((p^(s + 1) - 1)*(p^(2*s + 3) - 1))
pretty_print(expr)
w0 = SR.wild(0); w1 = SR.wild(1); w2 = SR.wild(2);

expr_t = expr.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})

pretty_print(expr_t)

produces:

(p1)p2s(ps+31)(p2s+31)(ps+11)

(p3t1)(p1)t2(p3t21)(pt1)

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 perfectly fine mathematically to catch all instances, instances (if wildcard meant anything) but since the expression is syntactically different from the others, we need the previous ones.

click to hide/show revision 3
No.3 Revision

Does this help?

var('p s t')
expr = (p^(s + 3) - 1)*(p - 1)*p^(2*s)/((p^(s + 1) - 1)*(p^(2*s + 3) - 1))
pretty_print(expr)

def transf(expr):
    w0 = SR.wild(0); w1 = SR.wild(1); w2 = SR.wild(2);

expr_t = expr.subs({p^(w0*s):t^w0})
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})

pretty_print(expr_t)
    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}[1]{\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}[1]{\mathbf{#1}}\frac{{\left(p^{3} \newcommand{\Bold}[1]{\mathbf{#1}}\frac{p^{s}}{p^{s + 1} - 1} \mapsto \frac{t}{p t - 1\right)} {\left(p - 1\right)} t^{2}}{{\left(p^{3} t^{2} - 1\right)} {\left(p t - 1\right)}} 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.