from sympy import *
x, y, mu, sigma, density1, density2 = symbols('x y mu sigma density1 density2')
eq1 = Eq(density1, 1/(sqrt(2*pi)*sigma)
*exp(-(x-mu)**2/(2*sigma**2))) # normal
eq2 = Eq(y, exp(x)) # substitution
eq3 = Eq(density2, 1/(y*sqrt(2*pi)*sigma)
*exp(-(ln(y)-mu)**2/(2*sigma**2))) # lognormal
[eq1, eq2, eq3]
How can I make SymPy take the normal density (eq1), apply the x to y substitution (eq2) and output the lognormal density (eq3)?
(I received no answer to this question at https://stats.stackexchange.com/q/55353/14202 .)