A few days ago I wrote about my solution for factoring a polynomial into factors corresponding to complex roots, factorC.
One of the uses for that utility is to perform a partial fractions decomposition of rational functions. Here’s a complex partial fraction function that uses factorC and the built-in Maxima function partfrac.
I’m getting ready for my fall Complex Variables class. I noticed that the built-in Maxima function residue doesn’t reliably do the right thing. My goal is to make some improvements to Maxima residue calculations in Maxima over the course of the next month.
As I started to look at some test cases, I realized I didn’t know how to factor a polynomial into complex factors. In the simplest case:
but I wanted to see
Maybe someone will find this and let me know that there’s a simple way to make that happen using existing Maxima commands. Until then, I’ve written a little utility to identify the roots (both real and complex) of a polynomial and return a factorization. Here’s an example, and the code. Notice that it only works as well as the root finder solve. I tried to upgrade to the more robust to_poly_solve, but I don’t yet know how to handle multiplicities in that case.
/* This commented code was meant to use the
more robust solver to_poly_solve, but
I couldn't understand how to handle multiplicities
for j:1 thru n do