Working on solution to cubic equations