Hello It is quite elementary to transform by hand an expression like
$\frac{m}{n}= \frac{p}{q}$ into $ mq - n p = 0 $ where $ m, n, p, q $ can be much longer expressions and $p,q \ne 0$
However with Mathematica I find it far from easy.
expr = m/n == p/q
Code instances such as below I do not like as it tells Mathematica exactly what to do
Numerator[expr[[1]]] Denominator[expr[[2]]] - Numerator[expr[[2]]] Denominator[expr[[1]]] == 0
expr /.{ Equal[Times[a_,Power[b_,-1]],Times[c_,Power[d_,-1]]] :> Equal[Plus[Times[-1,a,b],Times[c,d]],0]
This is more promising:
Map[Subtract[#, expr[[2]]] &, expr] // Factor
But to get rid of the denominator in the answer I see no other way than to use a pattern transformation :
% /. Equal[Times[Power[n_,-1],Power[q_,-1],Plus[Times[-1,n_,p_],Times[m_,q_]]],0] :> Equal[Plus[Times[-1,n,p],Times[m,q]],0]
What is the correct way to handle this simplification ?