You can define complex equations by yourself. The following is to look at other people's questions and then do it yourself.
The following are the calculation results.
private void GetMinResult(out double resultX1, out double min)
{
double x1, result;
Random random1 = new Random(DateTime.Now.Millisecond* DateTime.Now.Second);
min = 999999;
resultX1 = 0;
for (int i = 0; i < 654321; i++)
{
if (random1.Next(0, 100) % 2 == 0)
{
x1 = resultX1 + random1.NextDouble()*100;
}
else
{
x1 = resultX1 - random1.NextDouble()*100;
}
if (x1 < 0 || x1 > 50)
{
continue;
}
result = x1 * Math.Sin(x1) * Math.Cos(2 * x1) - 2 * x1 * Math.Sin(3 * x1) + 3 * x1 * Math.Sin(4 * x1);
if (result < min)
{
resultX1 = x1;
min = result;
}
}
}