title: Multiplying parenthesis to get a polynomial in python
body: <p>I was asked to do the newton polynomial interpolation and I was able to write the main code. 
  <a href="https://en.wikipedia.org/wiki/Newton_polynomial" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Newton_polynomial</a>
  But there is still one small thing that I am not able to get around since a couple of days, after reading I found a way to do it using Sympy, but I am not allowed to use anything other than basic numpy. 
  Now my problem is that I trying to multiply something like this </p>
  
  <p>p(x)=j(x-q)(x-w)(x-e)+k(x-w)(x-e)+l(x-e)+d</p>
  
  <p>to get this p(x)=ax³+bx²+cx+d , so I amlooking for the polynomial coefficients a,b,c,d</p>
  
  <p>for example:</p>
  
  <p>p(x)=5-7(x+1)+9(x+1)(x)-7(x+1)(x)(x-1)=-7x³+9x²+9x-2</p>
  
  <p>of course I am looking for the general case, not only for ploynomials from third degree. 
  Any tip would be much appreciated, I am really stuck at this since a couple of days. 
  and Sorry for the sloppy writing of notation, but it seems stackoverflow doesn't accept latex and I am not able to post a picture because I don't have rhe required reputation. (if there is other solutuions to post it properly please tell me and I'll just post it again)</p>
  
  <p>Thanks in advance :) </p>