using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter8.Section4 { public class Example04 { public Example04() { } private string result; public string Result { get{return result;} } public void Compute() { Science.Mathematics.Function.ToLastType ff = new Science.Mathematics.Function.ToLastType(surface); V.Surface s = new V.Surface(ff); s.Parameter1StartValue = 0.0; s.Parameter1EndValue = Math.PI; s.Parameter2StartValue = 0.0; s.Parameter2EndValue = 2.0 * Math.PI; Science.Mathematics.Function.ToLastType gg = new Science.Mathematics.Function.ToLastType(volume); double[] from = { -1.0, -1.0, -1.0 }; double[] to = { 1.0, 1.0, 1.0 }; V.Volume v = new V.Volume(from, to, gg); Science.Mathematics.Function.ToLastType F = new Science.Mathematics.Function.ToLastType(vectorField); V.GaussDivergenceTheorem obj = new V.GaussDivergenceTheorem(v, F, s); obj.Compute(); result += obj.LeftHandSideBestEstimation.ToString() + "\r\n"; result += obj.LeftHandSideStandardDeviation.ToString() + "\r\n"; result += obj.RightHandSideBestEstimation.ToString() + "\r\n"; result += obj.RightHandSideStandardDeviation.ToString() + "\r\n"; result += (4.0 * Math.PI / 3.0).ToString() + "\r\n"; } private double[] surface(double[] u) { double[] x = new double[3]; x[0] = Math.Sin(u[0]) * Math.Cos(u[1]); x[1] = Math.Sin(u[0]) * Math.Sin(u[1]); x[2] = Math.Cos(u[0]); return x; } private double volume(double[] x) { return x[0] * x[0] + x[1] * x[1] + x[2] * x[2] - 1.0; } private double[] vectorField(double[] x) { double[] f = new double[3]; f[0] = x[0]; f[1] = 1.0; f[2] = 1.0; return f; } } } /* 4.18855996400195 0.00140580602534285 4.18879104819216 0.000163868935100773 4.18879020478639 */