0
$\begingroup$

Suppose I get the output expression as: $$z(\Delta)=\frac{1+gk^2+h}{\Delta+g+U/h}$$

Now I want to write as: $$z(\Delta/k)=\frac{\frac{1}{k}+gk+\frac{h}{k}}{\frac{\Delta}{k}+\frac{g}{k}+\frac{U}{hk}}$$

Now, this is the exact same expression but can Mathematica transform it like this on command?

$\endgroup$
2
  • $\begingroup$ If you define z(delta) as above, then z(delta/k) is not equal to the expression you indicate, where you simply divide the numerator and denominator by k $\endgroup$ Apr 30, 2021 at 15:47
  • $\begingroup$ Because u can write the ratio as totally another parameter and hence it no longer depends on delta but the ratio. Right. Correct. Ah but lets say I still wanted the latter RHS expression. $\endgroup$
    – Lost
    Apr 30, 2021 at 15:56

1 Answer 1

1
$\begingroup$

A combination of pattern matching and the function Distribute can help.

exp = z[Δ] == (1 + g k^2 + h)/(Δ + g + (U/h));

exp /. {z[Δ] -> z[Δ/k], x__Plus :> Distribute[x/k]}
(* z[Δ] == (1/k + h/k + g k)/(g/k + U/(h k) + Δ/k) *)

TeXForm[exp /.{z[Δ] -> z[Δ/k], x__Plus :> Distribute[x/k]}]

$z\left(\frac{\Delta }{k}\right)=\frac{g k+\frac{h}{k}+\frac{1}{k}}{\frac{g}{k}+\frac{U}{h k}+\frac{\Delta }{k}}$

Now if you want to control the order exactly more work will need to be done.

$\endgroup$
1
  • $\begingroup$ Helps a lot. I'll accept after waiting for more answers. Also, can we make logarithmic y for a parametric plot? There is no LogParametricPlot function like LogPlot. $\endgroup$
    – Lost
    Apr 30, 2021 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.