Q. TSE: Math: Solving 3rd degree equations with TSE and PowerShell.exe on Linux WSL and Microsoft Windows
Hello,
1. See also more about the history of solving this 3rd degree equation in 'How Imaginary Numbers Were Invented'
2. The TSE program works out of the box and without extra installation in
Microsoft Windows
and also out of the box and without extra installation on
Linux WSL (e.g. Ubuntu Linux WSL)
3. The TSE program solves and finds the always totally 3 roots of a
given 3rd degree algebraic equation in one variable numerically.
It uses PowerShell.exe mathematical functions to do so.
E.g. the following equation 1 . x^3 + 2 . x^2 + 3 . x + 4 = 0
has 3 roots: -1.65062919143938, -0.174685404280309 + 1.54686888723139 * i, -0.174685404280309 - 1.54686888723139 * i
E.g. the following equation -1 . x^3 + 2 . x^2 + 3 . x + 4 = 0
has 3 roots: 3.28427753730695, -0.642138768653473 + 0.897542015304751 * i, -0.642138768653473 - 0.897542015304751 * i
4. See the attached program
getstrfs.s
5. Method:
Given ax^3 + bx^2 + cx + d = 0
1. -First divide the equation by a because that takes away the a of the x^3 term and makes the calculations simpler
x^3 + (b/a)x^2 + (c/a)x + (d/a) = 0
2. -Then use the substitution x = t - b/(3a) and substitute that into the equation and work that out
3. -That will eliminate the x^2 term
4. -So then left is the equation
t^3 + pt + q = 0
5. -You can then use p and q to calculate the discriminant
6. -Then 3 cases:
1. The discriminant is negative: then use Cardano's formula (using e.g. square roots and cube roots) to find the 3 roots (one root is always real and the other two roots are 2 conjugate complex numbers
2. The discriminant is zero: then you get 3 equal real roots or otherwise 1 real root and 2 other but equal real roots
3. The discriminant is positive: then use Viete's formula (using e.g. trigonometry) to find the 3 roots (always 3 real numbers)
6. See the 2 screenshots,
TSE for Microsoft Windows, running on Microsoft Windows
and
TSE for Linux, running on Linux WSL Ubuntu
with friendly greetings
Knud van Eeden