# [✓] Solve a cubic equation?

Posted 11 months ago
1071 Views
|
6 Replies
|
3 Total Likes
|
 Please look at this outcome:As you see, all 3 roots are complex numbers. But this equition has a real root at least 1. This is 0.1736 ... (exactly sin 10 degrees).Where is my fault?
6 Replies
Sort By:
Posted 11 months ago
 You can use NSolve: NSolve[(8*t^3 - 6*t + 1 == 0), t] This gives {{t -> -0.939693}, {t -> 0.173648}, {t -> 0.766044}}For exact solutions: ComplexExpand@Solve[(8*t^3 - 6*t + 1 == 0), t] 
Posted 11 months ago
 Thanks for your explanations. But what I can't understand is the behavior of Mathematica. Is this equition has more than 3 roots, 3 of them are real, other 3 are complex?
Posted 11 months ago
 Mathematica is a mathematical program that performs computations on complex numbers(complex plain) and therefore we see the imaginary unit I everywhere.If You want solution try with ComplexExpand : sol = Solve[8*t^3 - 6*t + 1 == 0, t] // ComplexExpand (* {{t -> 1/2 Cos[\[Pi]/9] + 1/2 Sqrt[3] Sin[\[Pi]/9]}, {t -> 1/2 Cos[\[Pi]/9] - 1/2 Sqrt[3] Sin[\[Pi]/9]}, {t -> -Cos[\[Pi]/9]}} *) sol//N (* {{t -> 0.766044}, {t -> 0.173648}, {t -> -0.939693}} *) Yours equation has 3 real roots: Plot[8*t^3 - 6*t + 1, {t, -1, 1}, Epilog -> {Red, PointSize[0.02], Point[{t /. sol[[#]] // N, 0} & /@ {1, 2, 3}]}, AxesLabel -> {t, f[t]}, PlotLabels -> Placed[{"8*t^3-6*t+1"}, Above]] Another example with 1 real and 2 complex roots: sol1 = Solve[t^3 - t + 1 == 0, t] // ComplexExpand (* {{t -> -(2/(3 (9 - Sqrt[69])))^(1/3) - (1/2 (9 - Sqrt[69]))^(1/3)/3^( 2/3)}, {t -> (1/2 (9 - Sqrt[69]))^(1/3)/(2 3^(2/3)) + 1/( 2^(2/3) (3 (9 - Sqrt[69]))^(1/3)) + I (-(3^(1/6)/(2^(2/3) (9 - Sqrt[69])^(1/3))) + (9 - Sqrt[69])^( 1/3)/(2 2^(1/3) 3^(1/6)))}, {t -> (1/2 (9 - Sqrt[69]))^(1/3)/( 2 3^(2/3)) + 1/(2^(2/3) (3 (9 - Sqrt[69]))^(1/3)) + I (3^(1/6)/(2^(2/3) (9 - Sqrt[69])^(1/3)) - (9 - Sqrt[69])^(1/3)/( 2 2^(1/3) 3^(1/6)))}}*) sol1 // N (* {{t -> -1.32472}, {t -> 0.662359 - 0.56228 I}, {t -> 0.662359 + 0.56228 I}} *) Plot[t^3 - t + 1, {t, -2, 2}, Epilog -> {Red, PointSize[0.02], Point[{t /. sol1[[#]] // N, 0} & /@ {1}]}, AxesLabel -> {t, f[t]}, PlotLabels -> Placed[{"t^3-t+1"}, Above]] 
Posted 11 months ago
 Thanks for detailed explanations.
 (1) Please post actual code rather than an image of code.(2) Have a look at the casus irreducibilus.(3) One can avoid seemingly complex radicals in the result using an option setting to disable the Cardano/Tartaglia cubic form of result. InputForm[Solve[(8*t^3 - 6*t + 1 == 0), t, Cubics->False]] (* Out[2]//InputForm= {{t -> Root[1 - 6*#1 + 8*#1^3 & , 1, 0]}, {t -> Root[1 - 6*#1 + 8*#1^3 & , 2, 0]}, {t -> Root[1 - 6*#1 + 8*#1^3 & , 3, 0]}} *) N[%] (* Out[3]= {{t -> -0.939693}, {t -> 0.173648}, {t -> 0.766044}} *) Alternatively convert the cubic radicals to trigs. InputForm[ComplexExpand[Solve[(8*t^3 - 6*t + 1 == 0), t]]] (* Out[5]//InputForm= {{t -> Cos[Pi/9]/2 + (Sqrt[3]*Sin[Pi/9])/2}, {t -> Cos[Pi/9]/2 - (Sqrt[3]*Sin[Pi/9])/2}, {t -> -Cos[Pi/9]}} *)