# Factoring Algebraic Expressions [closed]

Say I have an expression

$$x = L-(L-N)y^2(1+AB)$$

is there a way I can use mathematica to put the expression into the form

$$x = M(1+\sigma B)$$

where $$M$$ and $$\sigma$$ are lumped terms?

## closed as off-topic by Daniel Lichtblau, m_goldberg, Alex Trounev, AccidentalFourierTransform, EdmundJun 29 at 12:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Daniel Lichtblau, m_goldberg, Alex Trounev, AccidentalFourierTransform, Edmund
If this question can be reworded to fit the rules in the help center, please edit the question.

This is just an extended comment as you'll need to be more specific as to what you need in general. (Also, in Mathematica you should avoid single capital letters for variable names especially N and D.) For example, is what you're look for deals only with equations linear in powers of B? Or is it just solving for M and $$\sigma$$ in this particular case?

If it's just this particular case, then the following is one way to do so:

f = CoefficientList[L - (L - n) y^2 (1 + a b), b]
(* {L+(-L+n) y^2,-a (L-n) y^2} *)

m = f[[1]]
(* L+(-L+n) y^2 *)

σ = f[[2]]/f[[1]]
(* -((a (L-n) y^2)/(L+(-L+n) y^2)) *)