Hi, I have a problem with a polynomial fitting using sympy. I have asked the question on Stack Overflow <http://stackoverflow.com/questions/26160213/how-to-convert-a-sympy-polynomial-into-a-list> but I got no feedback, so I thought that I would get some help here.
The core issue is in the args tuple from sympy.core.add.Add . If I define a polynomial function like p4 = a0 + a1x + ... an*x**n and impose conditions on the function at symbolic points (xa, xb, ...) as well on the function derivative, I can get some other polynomials. For example, saying that the first derivative of p4 equals zero at a symbolic point xa p4diff = diff(p4, x) c4 = p4diff.subs(x, xa) creates a basis for a linear combination of a0, a1, .. a4 valued with the xa symbol. For a polynomial of order 4, if I impose 4 such conditions, I can build for c0, c1,... c4 condition polynomials. As a result, I get a linear system of 4 equations for four polynomial coefficients a0,... a4. If the system has a unique solution, I have fitted a polynomial with the conditions c0, ... c4 to the interval [xa, xb]. This is the point where I'm stuck. I can't get to arrange the linear system for the solve_linear_system function using Matrix. Basically, it should look like this: A = Matrix([a0 term from c0, a1 term from c0, ...., a4 term from c0, condition value], [.... c1 ...], ... , [ ... c4 ...]]) and then I can solve the system with solve_linear_system(A, a0, a1, a2, a3, a4), with the solution expressed with the symbols xa and xb. This way, I can fit the polynomial with the aforementioned conditions to any interval I = [xa, xb]. I could replace xa and xb with real values, but I need the symbolic solution - I am using it to construct a polynomial function in C++. Any advice on this? Thanks, Tomislav -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/794a2a11-0e01-4836-a21f-12ce88d07964%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
