0

Working on general cubic equation solver in form ax^3+bx^2+cx+d=0 And have no clue for special cases:

In terms of cubic there should be one real root and two complex, or 3 real roots if coefficients is real. (not sure if coefficients is complex or few or one of them then what?)

Before processing standard - say Cardano method to avoid divisions by zero we should work out edge cases, for example: What if

  1. constant 'd' is zero (this may happened when we use solver with some dynamic objects that specify positions etc) then I found that factoring of x is used, fill one of root as 0 and other two will be from solution of quadratic equation, just solve ax^2+bx+c=0 result will be second and third roots.
  2. coefficient 'a' is zero, seems obvious we just got then bx^2+cx+d=0 question is same as for 'd' but there is no clear explanation how we treat roots.

Quadratic solver that is used for those two cases like first if a zero then we obtain result from it, but depending on coefficients there can be one root if we can't go to discriminant part and some coefficients is zero too like we obtain linear equation that have one solution, or no solutions or infinite solutions or one means repeated root, or two distinct real roots, or two complex roots.

If we work out part with a = 0 separately then for part when d = 0 and quadratic solver may produce result as one/two real roots or two complex roots, and question is if in qubic we already define one of roots as zero then what other two means, does when one root is result we say that cubic has 3 real roots (one zero and two repeated that is equal to that one from quadratic solver), we say 3 real (one zero and two real roots from quadratic) and we say 1 real and 2 complex (one zero and those two complex from solver) or we need to something to be adjusted etc?

Now back to part when a = 0

There is no description in any sources for solving cubics, how treat one/two real and two complex solution then in terms of filling 3 roots for cubic with results, and how treat cases if b/c/d may be also zero when handling quadratic solution if it may result to no solutions or infinite solutions.

  • Use translation of variable in order to get a "depressed cubic" $y^3+py+q=0$. Then see here – Jean Marie Dec 04 '23 at 21:30
  • they thinking in term alternative than Cardano solution, but anyway they assuming a != 0, and I wish to work out cases when a == 0 also as d. – Vitaly Protasov Dec 05 '23 at 09:37
  • My comment is explainable by the fact you didn't mentionned at all the main "edge case" connected to the sign of the discriminant. Having re-read your formulation, I understand that you are puzzled by the transition when $a \to 0$ from a quadratic equation to a cubic equation. Why not considering that you are looking for the intersection points of curve $y=-ax^3$ with curve $y=bx^2+cx+d$ ? – Jean Marie Dec 05 '23 at 09:48

0 Answers0