# How to simplify expression depending on former definition?

If

a = x + y

b = x - y

u = a + b

v = a


This gives me for u/v the expression (2 x)/(x + y) But I want to get 1+b/a. How to do that when a and b are very long expressions?

• Why does it matter if a and b are long expressions if you just want 1+b/a? Dec 21, 2023 at 6:19
• Or are you saying you want 1 + (x-y)/(x+y)? Dec 21, 2023 at 6:22
• 1+b/a is ok, I just wanted to avoid long Replace answers. I was looking for some kind of short switch (from x,y to a,b), because I have many variables to deal with. I was looking sore something like Eliminate, but that works only for equations. Dec 21, 2023 at 7:21
• Does this answer your question? Can I simplify an expression into form which uses my own definitions? Dec 21, 2023 at 12:31
• I found that the following works eq1 = a == x + y; eq2 = b == x - y; eq3 = u == a + b; eq4 = v == a; eq5 = c == u/v; sol = Eliminate[{eq1, eq2, eq3, eq4, eq5}, {x, y, u, v}]; Solve[sol, c] Which looks very clumsy. Any better ideas? Dec 21, 2023 at 13:44

u/v /. u -> a + b /. v -> a // Apart