using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter8.Section1 { public class Example03 { public Example03() { } private string result; public string Result { get{return result;} } public void Compute() { Science.Mathematics.Function.ToLastType ff = new Science.Mathematics.Function.ToLastType(func); V.Surface s = new V.Surface(ff); s.Parameter1StartValue = 0.0; s.Parameter1EndValue = 1.0; s.Parameter2StartValue = 0.0; s.Parameter2EndValue = 1.0; Science.Mathematics.Function.ToLastType gg = new Science.Mathematics.Function.ToLastType(gunc); V.Path p = new V.Path(gg); p.ParameterFrom = 0.0; p.ParameterTo = 2.0; Science.Mathematics.Function.ToLastType P = new Science.Mathematics.Function.ToLastType(pf); Science.Mathematics.Function.ToLastType Q = new Science.Mathematics.Function.ToLastType(qf); V.GreenTheorem obj = new V.GreenTheorem(p, P, Q, s); obj.Compute(); result += obj.LeftHandSideBestEstimation.ToString() + "\r\n"; result += obj.RightHandSideBestEstimation.ToString() + "\r\n"; result += obj.RightHandSideStandardDeviation.ToString() + "\r\n"; result += (1.0 / 12.0).ToString() + "\r\n"; } private double[] func(double[] u) { double[] x = new double[3]; x[0] = u[0]; x[1] = u[1]*(u[0] - u[0]*u[0])+u[0]*u[0]; x[2] = 0.0; return x; } private double[] gunc(double t) { double[] x = new double[3]; if (t < 1.0) { x[0] = t; x[1] = t * t; } else { x[0] = 2.0 - t; x[1] = 2.0 - t; } x[2] = 0.0; return x; } private double pf(double[] x) { return x[0]*x[1]*x[1]; } private double qf(double[] x) { return x[0] + x[1]; } } } /* 0.0833332952270446 0.0833351364995018 8.81186019559675E-07 0.0833333333333333 */