using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter8.Section2 { 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 = 2.0 * Math.PI; 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 * Math.PI; Science.Mathematics.Function.ToLastType F = new Science.Mathematics.Function.ToLastType(vectorField); V.StokesTheorem obj = new V.StokesTheorem(p, F, s); obj.Compute(); result += obj.LeftHandSideBestEstimation.ToString() + "\r\n"; result += obj.RightHandSideBestEstimation.ToString() + "\r\n"; result += obj.RightHandSideStandardDeviation.ToString() + "\r\n"; result += (-2.0 * Math.PI).ToString() + "\r\n"; } private double[] func(double[] u) { double[] x = new double[3]; x[0] = u[0] * Math.Cos(u[1]); x[1] = u[0] * Math.Sin(u[1]); x[2] = Math.Sqrt(1.0 - x[0]*x[0] - x[1]*x[1]); return x; } private double[] gunc(double t) { double[] x = new double[3]; x[0] = Math.Cos(t); x[1] = Math.Sin(t); x[2] = 0.0; return x; } private double[] vectorField(double[] x) { double[] f = new double[3]; f[0] = x[1]; f[1] = -x[0]; f[2] = Math.Exp(x[0] * x[2]); return f; } } } /* -6.28318530717965 -6.28323876387889 4.34725901506289E-05 -6.28318530717959 */