本文整理汇总了C#中System.Function.GetSolve方法的典型用法代码示例。如果您正苦于以下问题:C# Function.GetSolve方法的具体用法?C# Function.GetSolve怎么用?C# Function.GetSolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Function
的用法示例。
在下文中一共展示了Function.GetSolve方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRungeKytSolves
private void GetRungeKytSolves(Function func, InputData data, out List<double> x, out List<double> y)
{
double curX = data.X0;
double curY = data.Y0;
double h = data.H;
x = new List<double>();
y = new List<double>();
while (Math.Round(curX, 10) <= data.RightLimit + h)
{
y.Add(curY);
x.Add(curX);
double K1 = h * func.GetSolve(curX, curY);
double K2 = h * func.GetSolve(curX + h / 2, curY + K1 / 2);
double K3 = h * func.GetSolve(curX + h / 2, curY + K2 / 2);
double K4 = h * func.GetSolve(curX + h, curY + K3);
curY = curY+1f/6f*(K1+2*K2+2*K3+K4);
curX += data.H;
}
}
示例2: GetEulerMSolves
private void GetEulerMSolves(Function func, InputData data, out List<double> x, out List<double> y)
{
double curX = data.X0;
double curY = data.Y0;
x = new List<double>();
y = new List<double>();
while (Math.Round(curX, 10) <= data.RightLimit + data.H)
{
x.Add(curX);
y.Add(curY);
curY = curY + data.H * func.GetSolve(curX+data.H/2,
curY+(data.H/2)*func.GetSolve(curX,curY));
curX += data.H;
}
}
示例3: GetEulerSolves
private void GetEulerSolves(Function func, InputData data, out List<double> x, out List<double> y)
{
double curX = data.X0;
double curY = data.Y0;
x = new List<double>();
y = new List<double>();
while (Math.Round(curX, 10) <= data.RightLimit + data.H)
{
y.Add(curY);
x.Add(curX);
curY = y[y.Count - 1] + data.H * func.GetSolve(x[x.Count - 1], y[y.Count - 1]);
curX += data.H;
}
}
示例4: GetAdamsSolves
private void GetAdamsSolves(Function func, InputData data, out List<double> x, out List<double> y)
{
double curX = data.X0;
double curY = data.Y0;
x = new List<double>();
y = new List<double>();
x.Add(curX);
y.Add(curY);
double curPrevY = curY;
double curPrevX = curX;
double h = Math.Pow(data.H,2);
//Calculate next y and x
double K1 = h * func.GetSolve(curX, curY);
double K2 = h * func.GetSolve(curX + h / 2, curY + K1 / 2);
double K3 = h * func.GetSolve(curX + h / 2, curY + K2 / 2);
double K4 = h * func.GetSolve(curX + h, curY + K3);
curY = curY + 1f / 6f * (K1 + 2 * K2 + 2 * K3 + K4);
curX += h;
//--------------------------------
h = data.H;
while (Math.Round(curX, 10) <= data.RightLimit+h)
{
x.Add(curX);
y.Add(curY);
curY = curY + h * ((3f / 2) * func.GetSolve(curX, curY) - 0.5 * func.GetSolve(curPrevX, curPrevY));
curX += h;
curPrevX = x[x.Count-1];
curPrevY = y[y.Count-1];
}
}