// Update chart of LTEs. public void UpdateChartLTE(DifferentialEquation MyDifferentialEquation, Euler EulerApproximation, ImprovedEuler ImprovedEulerApproximation, RungeKutta RungeKuttaApproximation, double X0, double X) { // Set minimum and maximum values of Tab1ChartLTE. Tab1ChartLTE.ChartAreas[0].AxisX.Minimum = X0; Tab1ChartLTE.ChartAreas[0].AxisX.Maximum = X; // Plot the graphs of Local Truncation errors of numerical solutions. Tab1ChartLTE.Series[0].Points.DataBindXY(EulerApproximation.GetX(), EulerApproximation.ComputeLocalTruncationErrors(MyDifferentialEquation)); Tab1ChartLTE.Series[1].Points.DataBindXY(ImprovedEulerApproximation.GetX(), ImprovedEulerApproximation.ComputeLocalTruncationErrors(MyDifferentialEquation)); Tab1ChartLTE.Series[2].Points.DataBindXY(RungeKuttaApproximation.GetX(), RungeKuttaApproximation.ComputeLocalTruncationErrors(MyDifferentialEquation)); }
// Update chart of approximations. public void UpdateChartApproximation(DifferentialEquation MyDifferentialEquation, Euler EulerApproximation, ImprovedEuler ImprovedEulerApproximation, RungeKutta RungeKuttaApproximation, double X0, double X) { // Set minimum and maximum values of Tab1ChartApproximation. Tab1ChartApproximation.ChartAreas[0].AxisX.Minimum = X0; Tab1ChartApproximation.ChartAreas[0].AxisX.Maximum = X; // Plot the graphs of exact and numerical solutions. Tab1ChartApproximation.Series[0].Points.DataBindXY(MyDifferentialEquation.GetX(), MyDifferentialEquation.GetY()); Tab1ChartApproximation.Series[1].Points.DataBindXY(EulerApproximation.GetX(), EulerApproximation.GetY()); Tab1ChartApproximation.Series[2].Points.DataBindXY(ImprovedEulerApproximation.GetX(), ImprovedEulerApproximation.GetY()); Tab1ChartApproximation.Series[3].Points.DataBindXY(RungeKuttaApproximation.GetX(), RungeKuttaApproximation.GetY()); }