用c++解一元三次方程的根.求出x3-3x-1=0在(-8,8)的所有实根x1=[-q/2+(q^2/4+p^3/27)^(1/2)]^(1/3)++[-q/2-(q^2/4+p^3/27)^(1/2)]^(1/3)x2=w[-q/2+(q^2/4+p^3/27)^(1/2)]^(1/3)++w^2[-q/2-(q^2/4+p^3/27)^(1/2)]^(1/3)x2=w^2[-q/2+(q^2/4+p^3/27)^

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 20:12:29

用c++解一元三次方程的根.求出x3-3x-1=0在(-8,8)的所有实根x1=[-q/2+(q^2/4+p^3/27)^(1/2)]^(1/3)++[-q/2-(q^2/4+p^3/27)^(1/2)]^(1/3)x2=w[-q/2+(q^2/4+p^3/27)^(1/2)]^(1/3)++w^2[-q/2-(q^2/4+p^3/27)^(1/2)]^(1/3)x2=w^2[-q/2+(q^2/4+p^3/27)^
用c++解一元三次方程的根.
求出x3-3x-1=0在(-8,8)的所有实根
x1=[-q/2+(q^2/4+p^3/27)^(1/2)]^(1/3)+
+[-q/2-(q^2/4+p^3/27)^(1/2)]^(1/3)
x2=w[-q/2+(q^2/4+p^3/27)^(1/2)]^(1/3)+
+w^2[-q/2-(q^2/4+p^3/27)^(1/2)]^(1/3)
x2=w^2[-q/2+(q^2/4+p^3/27)^(1/2)]^(1/3)+
+w[-q/2-(q^2/4+p^3/27)^(1/2)]^(1/3)
其中w=(-1+√3i)/2.
但是要求实根啊
我编的程序只能求出一个根啊 他要求出所有的根.

用c++解一元三次方程的根.求出x3-3x-1=0在(-8,8)的所有实根x1=[-q/2+(q^2/4+p^3/27)^(1/2)]^(1/3)++[-q/2-(q^2/4+p^3/27)^(1/2)]^(1/3)x2=w[-q/2+(q^2/4+p^3/27)^(1/2)]^(1/3)++w^2[-q/2-(q^2/4+p^3/27)^(1/2)]^(1/3)x2=w^2[-q/2+(q^2/4+p^3/27)^
看看这个帖子,说不定你会有所启发,共同学习啊.