# Eliminate variables by dividing two equations

how is it possible to divide two equations with Mathematica?

I have the following code:

eqn416 = a == Kp h (1 - E^(-ta/tau))
eqn417 = a/2 == Kp h (1 - E^(-ta2/tau))


Obviously one will get

2 E^(-(ta2/tau)) - E^(-(ta/tau)) == 1


by dividing them, but with

Eliminate[{eqn416, eqn417}, {Kp, h, a}]


I only get 'True'.

And if I try just to eliminate 2 of them and assuming afterwards 'a' is not zero

Eliminate[{eqn416, eqn417}, {Kp, h}];
%[[2]]
FullSimplify[%, a != 0]


I'm not getting rid of 'a'!

FullSimplify[a (1 + E^(-(ta/tau)) - 2 E^(-(ta2/tau))) == 0,
a != 0]
(* Out[434]= a (1 + E^(-(ta/tau)) - 2 E^(-(ta2/tau))) == 0 *)


Any suggestions?

-
Documentation Center told me that "Eliminate works primarily with linear and polynomial equations", so probably it's not the best solution here. – Wojciech Jan 13 '14 at 12:28
right, that's what I read too, but is there a better way? – Phab Jan 13 '14 at 12:32
When You try to eliminate only Kp and h You get 3 equations. When You apply FullSimplify to them assuming that a!=0, one of the results is the one You want. I copied the code block with %[[2]] from Your question and the result was the one You wanted. – Wojciech Jan 13 '14 at 12:42
This is closely related to Why the inequality does not take into account the domain?, which points out some inconsistencies of equation-solving functionality. Having said that I recommend Reduce in such cases. – Artes Jan 13 '14 at 13:24
@Wojciech I had this solution too, but in my book the author takes the other ;) ... in addition, i'll get a different plot for those two solutions!? – Phab Jan 13 '14 at 13:54

Try the following. Here are your equations:

 eqn416 = a == Kp h (1 - E^(-ta/tau));
eqn417 = a/2 == Kp h (1 - E^(-ta2/tau));


and this divides one over another:

eq1=Inner[Divide, eqn416, eqn417, Equal]

(* 2 == (1 - E^(-(ta/tau)))/(1 - E^(-(ta2/tau)))  *)


Another approach:

 eq2=Equal @@ MapThread[#1/#2 &, {List @@ eqn416, List @@ eqn417}]

(*   2 == (1 - E^(-(ta/tau)))/(1 - E^(-(ta2/tau)))   *)


Have fun.

A later edit to address your question below: yes, it is easy:

  eq1A = Map[Subtract[#, eq1[[1]]] &, eq1]

(* 0 == -2 + (1 - E^(-(ta/tau)))/(1 - E^(-(ta2/tau))) *)


if you mean something of this sort.

-
is there a possibility to enforce a zero on lhs or rhs of an equation? – Phab Jan 13 '14 at 14:53
To enforce zero: HomogenizeEquation[eq_]:=eq[[1]]-eq[[2]]==0 – Giovanni F. Jan 14 '14 at 16:46

Another suggestion:

eqn416 = a == Kp h (1 - E^(-ta/tau));
eqn417 = a/2 == Kp h (1 - E^(-ta2/tau));

DivideEquations[eq1_,eq2_]:=eq1[[1]]/eq2[[1]]==eq1[[2]]/eq2[[2]]

DivideEquations[eqn416,eqn417]

(* 2 == (1 - E^(-(ta/tau)))/(1 - E^(-(ta2/tau))) *)


Whenever you need to divide two equations then just call the DivideEquations function.

-
That's a good solution, more simple than the previous one. – Alexei Boulbitch Jan 15 '14 at 8:28