# 三次方程式の実数解と虚数解の割合

More than 1 year has passed since last update.
```ax^3 + bx^2 + cx + d = 0
```

の実係数a,b,c,dを乱数(-2,147,483,648 ～ 2,147,483,647)で発生させ

10,000,000回計算した結果

なぜ、この割合なのかを数学的に証明できたらと思っています。

```private void abcd_r_3()
{
double a;
double b;
double c;
double d;
double dd;

byte[] bs = new byte[4];
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();

int m = 0; //重解 multiple root
int r = 0;
int i = 0;

double total = 10000000;

for (int x = 0; x < total; x++)
{
do
{
rng.GetBytes(bs);
//Int32に変換する
a = BitConverter.ToInt32(bs, 0);
//a = -1;
} while (a == 0);

rng.GetBytes(bs);
//Int32に変換する
b = BitConverter.ToInt32(bs, 0);

rng.GetBytes(bs);
//Int32に変換する
c = BitConverter.ToInt32(bs, 0);

rng.GetBytes(bs);
//Int32に変換する
d = BitConverter.ToInt32(bs, 0);

dd = -4 * a * c * c * c - 27 * a * a * d * d + b * b * c * c + 18 * a * b * c * d - 4 * b * b * b * d;

if (dd == 0)
{
m++;
}
else if (dd > 0)
{
r++;
}
else
{
i++;
}
}

double m_p = m * 100 / total;
double r_p = r * 100 / total;
double i_p = i * 100 / total;

Invoke(new dldl(delegate
{
textBox1.AppendText("実数解:" + r.ToString() + "(" + r_p.ToString() + "%)" +
"虚数解:" + i.ToString() + "(" + i_p.ToString() + "%)" +
"三重解:" + m.ToString() + "(" + m_p.ToString() + "%)" + Environment.NewLine);
button3.Enabled = true;
}));
}
```