# Algebraic transformation of equations [duplicate]

From an analytical computation I get an equation G1:

G1 = Sum[ (Log[y[i]] - u) / s^2, {i, 1, n}] == 0


Solve can not handle this equation and find a solution for u. Furthermore when writing G11 as

G11 = s^2 G1


G11 is essentially returned unevaluated. Mathematica can not be convinced to multiply the s^2 term into the equation -- which would be perfectly OK for all s != 0. I then used a different approach:

G12 = G1 //. s -> 1


which produced the desired result:

Mathematica still can not solve this equation for u.

Note: for simplicity I used u above instead of μ.

Try this.

eq = Sum[(Log[y[i]] + u)/s^2, {i, 1, n}] == 0;


This solves it:

sl=Solve[MapAt[Distribute, MapAt[Apart, eq, {1, 1}], 1], u]


You may then want to also cancel s^2:

sl /. Sum[Times[a_, Log[y[i]]], {i, 1, n}] ->a*Sum[Log[y[i]], {i,1,n}]


Done. Have fun!