Manipulation of expression

Let

ss2 = (γ + ν)/β;
is2 = ((γ + ν)/β) (β/((γ + ν)) - 1);

I wish to do the following computation but want to keep the output in terms of ss2 and is2:

-β s i + (γ + ν) i -
ss2/s (-β s i + (γ + ν) i) + (ν/(γ + \
ν)) (β s i - (γ + ν) i ) -  (ν is2/(γ \
+ ν)) (β s - (γ + ν))

So an example would be:

ss = (-n p γ + n δ + n ϵ + n σ)/β;

is = (n (β γ +
p γ σ - δ σ - ϵ σ - \
σ^2))/(β (ϵ + σ));

Lyapunov function computation:

γ n - β s i /
n + (δ - p γ) i - σ s - γ n (ss/
s) + β ss i / n - (δ - p γ) ss i /
s + σ ss + ((σ + ϵ)/(δ + σ + \
ϵ - p γ)) (β s i /n - β s is/
n) - (σ + ϵ) (i - is)

The above will give the same as this:

-(γ n + (δ - p γ) i) (s/ss) (1 - ss/s)^2
• I'm sorry, I don't really understand what you're trying to do, or how you arrived at the final result. Can you clarify? From what you're saying, if you want to leave an expression in terms of, say, ss, just don't set ss to anything (i.e., don't evaluate ss = (-n p γ + n δ + n ϵ + n σ)/β;). But when you say "computation", do you mean "simplification" maybe? Can you please clarify what you're actually trying to do here? Oct 20 '21 at 16:12
• @march The "computation" here is the Lyapunov function.
– Math
Oct 21 '21 at 11:56
• @march The example was from a paper. if you do the first computation and then the second, you will arrive at the same answer.
– Math
Oct 21 '21 at 13:03
• I'm sorry. I still don't understand what you're asking. What computation are you asking us*/*Mathematica to do? When you say "I wish to do the following computation but want to keep the output in terms of ss2 and is2:", I read that as "keep the following expression in terms of ss2 and is2", which to my mind means: don't evaluate the definitions of ss2 and is2 above, and the expression will remain in terms of ss2 and is2. Again, maybe what you want is to "invert" the simplification by writing the full expression (the result of some computation) in terms of the variable ss? Oct 22 '21 at 15:39
• The last sentence is what I want to do. Sorry for my ambiguous explanations. I manually found out that the solution is $$-\frac{\beta(S_2^*-S)^2}{S}$$ but how would I do this using Mathematica?
– Math
Oct 26 '21 at 12:08