Get Polynominal Coefficient of non linear equation [closed]

I have a non linear equation and want to create a polynomial of that. For this I have to calculate the coefficients. The problem is that the equation is a little bit long. So I wanted to do it with Mathematica. I tried it with the function coeffs but this didn't work.

0 =-s2 + s1 + th3*(v1 + (b1 - j2*x)^2/(2*j2) + (j2*x^2)/2 - (b1*(b1 - j2*x))/j2 + j2*x*th1) + ((j2*th3)/2 + (4*j2*v1 - 4*j2*v2 - 2*b1^2 + 2*b2^2 + 4*j2^2*x^2 + j2^2*th3^2 + 4*j2^2*x*th1)^(1/2)/2)^3/(6*j2^2) + x*(v1 + (b1 - j2*x)^2/(2*j2) - (b1*(b1 - j2*x))/j2 + j2*x*th1) - (j2*th3 - 2*b2 + (4*j2*v1 - 4*j2*v2 - 2*b1^2 + 2*b2^2 + 4*j2^2*x^2 + j2^2*th3^2 + 4*j2^2*x*th1)^(1/2))^3/(48*j2^2) - (b1 - j2*x)^3/(6*j2^2) + (j2*x^3)/3 + th1*(v1 + (b1 - j2*x)^2/(2*j2) - (b1*(b1 - j2*x))/j2) + (th3^2*((j2*th3)/2 + (4*j2*v1 - 4*j2*v2 - 2*b1^2 + 2*b2^2 + 4*j2^2*x^2 + j2^2*th3^2 + 4*j2^2*x*th1)^(1/2)/2))/2 + (v1 + (b1 - j2*x)^2/(2*j2) + (j2*x^2)/2 - (b1*(b1 - j2*x))/j2 + j2*x*th1)*(tau - x - th1 - th3 + (j2*th3 - 2*b2 + (4*j2*v1 - 4*j2*v2 - 2*b1^2 + 2*b2^2 + 4*j2^2*x^2 + j2^2*th3^2 + 4*j2^2*x*th1)^(1/2))/(2*j2) + (b1 - j2*x)/j2 + ((j2*th3)/2 + (4*j2*v1 - 4*j2*v2 - 2*b1^2 + 2*b2^2 + 4*j2^2*x^2 + j2^2*th3^2 + 4*j2^2*x*th1)^(1/2)/2)/j2) + (j2*x*th1^2)/2 - (v1*(b1 - j2*x))/j2 - ((j2*th3 - 2*b2 + (4*j2*v1 - 4*j2*v2 - 2*b1^2 + 2*b2^2 + 4*j2^2*x^2 + j2^2*th3^2 + 4*j2^2*x*th1)^(1/2))*(v1 - ((j2*th3)/2 + (4*j2*v1 - 4*j2*v2 - 2*b1^2 + 2*b2^2 + 4*j2^2*x^2 + j2^2*th3^2 + 4*j2^2*x*th1)^(1/2)/2)^2/(2*j2) + th3*((j2*th3)/2 + (4*j2*v1 - 4*j2*v2 - 2*b1^2 + 2*b2^2 + 4*j2^2*x^2 + j2^2*th3^2 + 4*j2^2*x*th1)^(1/2)/2) + (b1 - j2*x)^2/(2*j2) + (j2*x^2)/2 - (b1*(b1 - j2*x))/j2 + j2*x*th1))/(2*j2) - (((j2*th3)/2 + (4*j2*v1 - 4*j2*v2 - 2*b1^2 + 2*b2^2 + 4*j2^2*x^2 + j2^2*th3^2 + 4*j2^2*x*th1)^(1/2)/2)*(v1 + (b1 - j2*x)^2/(2*j2) + (j2*x^2)/2 - (b1*(b1 - j2*x))/j2 + j2*x*th1))/j2 + (b1*(b1 - j2*x)^2)/(2*j2^2) + (((j2*th3)/2 + (4*j2*v1 - 4*j2*v2 - 2*b1^2 + 2*b2^2 + 4*j2^2*x^2 + j2^2*th3^2 + 4*j2^2*x*th1)^(1/2)/2)*(j2*th3 - 2*b2 + (4*j2*v1 - 4*j2*v2 - 2*b1^2 + 2*b2^2 + 4*j2^2*x^2 + j2^2*th3^2 + 4*j2^2*x*th1)^(1/2))^2)/(8*j2^2)

or available here

expr = ToExpression@Import["https://pastebin.com/raw/91YKVF4N"]

There are only parameter in this function excepts of x which is the variable.

closed as unclear what you're asking by Henrik Schumacher, Daniel Lichtblau, MarcoB, JimB, m_goldbergJul 23 '18 at 23:17

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• It is not clear what you are asking for: If the expression is an equation you should use 0==... instead of 0=... ! Do you want to solve this equation (Solve[...]) or expand around x=... (Series[...])? – Ulrich Neumann Jul 23 '18 at 6:18
• There is no function coeffs, details are important!. Edit your question to explain in detail what you need and share the code you say didn't work. – rhermans Jul 23 '18 at 7:56
• How would the nonlinear equation and the polynomial that you want to create be related to each other? – Henrik Schumacher Jul 23 '18 at 8:05

If you expression is already a polynomial (your example) then use CoefficientList.

With[
{
expr = ToExpression@Import["https://pastebin.com/raw/91YKVF4N"]
},
CoefficientList[expr, x]
] If not, you can get the Series first.

With[
{
expr = Exp[x]
},
CoefficientList[
Normal@Series[expr, {x, 0, 5}]
, x
]
] Side note:

Do not confuse Set(=) with Equal (==).

• But is this a polynom ? because i have the variable x in the expression of the coefficients – IlPad Jul 25 '18 at 19:20