# Solving for coefficients of a polynomial ansatz in a rational function

(This is now a solved problem by my own alternative methods, and using some more physical arguments to limit the complexity of the problem. However more generally, any answers and strategies would be appreciated, to feel I have not wasted the entirely of the bounty.)

Firstly, I apologise for the numerical messiness, and for the extended length of this question. If this is successful, this is the last question I will need to ask for a long time.

ratfunc=(2 (-3 + x[2])^3 (233 - 50 x[2] + x[2]^2))/(49 (-2 + x[2]) (-5 + x[2]) (-13 + 5 x[2]))


where the numbers are a result from my theory. This is a rational function of polynomials in x[2], my only free variable in this situation.

I know from theory that this function can be refactorised in some way, determined in terms of 3 coefficients a[1], a[2] and a[3], functions of the independent variable x[2]. After doing necessary evaluations, and factored for simplicity to write down, it is given by

factoredform = ((-3 + x[2]) (-2 + x[2]) (980 a[1]^2 + 1176 a[1] a[2] + 1638 a[2]^2 +
112 a[1] a[3] + 336 a[2] a[3] + 64 a[3]^2 - 1568 a[1]^2 x[2] -
980 a[1] a[2] x[2] - 1722 a[2]^2 x[2] - 56 a[1] a[3] x[2] -
112 a[2] a[3] x[2] + 833 a[1]^2 x[2]^2 + 196 a[1] a[2] x[2]^2 +
602 a[2]^2 x[2]^2 - 147 a[1]^2 x[2]^3 -
70 a[2]^2 x[2]^3))/(98 (-5 + 3 x[2]) (-13 + 5 x[2]))


The original form (which is not shown) is much cleaner and structured, but when evaluated, it looks like this, which is important for the method.

THE PROBLEM

I am looking for a way to solve for all three coefficients a[1], a[2] and a[3], which are functions of x[2], that give the same form as the rational function ratfunc. I know from theory that the coefficients must be rational functions of polynomials, and so I create a general form for them like this:

poly = ratfunc-factoredform//Factor//Numerator;
variables = Cases[Variables[%],_x]
newa1ansatz = polynomial[variables,2, Ca1] /polynomial[variables,1,
Da1]
newa2ansatz = polynomial[variables,2, Ca2] /polynomial[variables,1,
Da2]
newa3ansatz = polynomial[variables,2, Ca3] /polynomial[variables,1,
Da3]


where polynomial is the function as in the SE post

polynomial[vars_List, n_Integer, coeff_] :=
#.Array[coeff, Length@#] &@ DeleteDuplicates[Times @@@
Tuples[Prepend[vars, 1], n]].


In particular, we have that our guess looks like

newa2ansatz= (Ca2[1] + Ca2[2] x[2] + Ca2[3] x[2]^2)/(Da2[1] + Da2[2] x[2])


and other similar results for the other coefficients. I am now trying to solve for these coefficients Ca2[1] etc which are simply real numbers. One could probably choose one of the coefficients to be one to reduce the number of components, maybe Da21 for example for simplicity.

I know the results beforehand from theory, but I am trying to rederive them in a different method to use for future applications

a1expected = 0
a2expected = -(2/(-2 + x[2]))
a3expected = ((-3 + x[2]) (3 + x[2]))/(4 (-2 + x[2]))


I want to find these results from first principles, purely from an algebraic method. Note that if we substitute these into the original factoredform we return the result ratfunc, which is exactly what we wanted to do.

In this case, I am expecting to solve the coefficients that I find. For a[2]:

Ca2[1] = -2
Ca2[2] = 0
Ca2[3] = 0
Da2[1] = -2
Da2[2] = 1


and similarly for a[3] and a[1] (which will have Ca1 and Da[1]) be zero. If I can find a method to derive these coefficients, then I can apply this in multiple other scenarios.

EDIT: A summary I have a function ratfunc that is given. I know that it can be factorise it in some way given by my ansatz, guaranteed by theory. I would like to find the structure of these coefficients in this ansatz, a[1], a[2] and a[3], such that the ansatz is now equivalent to the original ratfunc. Every term and every coefficient is simply a rational function of a polynomial in the variable x[5]. Despite knowing what the answer should be, through the expected values, I want to be able to derive them from an algebraic solution, i.e for a different ratfunc, how could I find out what these are.

• I’ve read your question a few times since you posted it, I’ve looked up ansatz and read the Wikipedia page, and I still don’t understand what you are trying to do. Could you elaborate? Can you give a simpler example, together with the expected output? – MarcoB Mar 17 '19 at 3:56
• I think you want to find values for a[1],a[2],a[3] such that ratfunc == ansatz or equivalently poly == 0 but now poly is a quadratic polynomial in the a[1],a[2],a[3]. So solve the quadratic for a[3], for example. The solution for a[3] denominator factors as linear and a quadratic in x[5]. The numerator has a square root of the discriminant. I think you want this to factor nicely also by suitable choices of a[1],a[2]. – Somos Mar 17 '19 at 11:23
• Do the same thing with solving for a[1] in terms of a[2],a[3] and also solving for a[2] in terms of a[1],a[3]. You get similar results with different denominators. This must be significant. – Somos Mar 17 '19 at 11:30
• @MarcoB I don't think I could make this simpler, but I have added an edit summarising a few bits. Is that easier? – Brad Mar 17 '19 at 12:34
• @Somos I will try that. My power series method gets a bit stuck when I get to solving for the 6th out of 12 coefficient! – Brad Mar 17 '19 at 12:36