using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter7.Section6 { public class Example01 { public Example01() { } 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 = 2.0 * Math.PI; s.Parameter2StartValue = 0.0; s.Parameter2EndValue = Math.PI; Science.Mathematics.Function.ToLastType g = new Science.Mathematics.Function.ToLastType(gfunc); V.SurfaceIntegral obj = new V.SurfaceIntegral(g, s); obj.Compute(); result += obj.Result.ToString() + "\r\n"; double res = -4.0 * Math.PI; result += res.ToString() + "\r\n"; } private double[] func(double[] u) { double[] x = new double[3]; x[0] = Math.Cos(u[0]) * Math.Sin(u[1]); x[1] = Math.Sin(u[0]) * Math.Sin(u[1]); x[2] = Math.Cos(u[1]); return x; } private double[] gfunc(double[] x) { double[] r = new double[3]; r[0] = x[0]; r[1] = x[1]; r[2] = x[2]; return r; } } } /* -12.5664071903788 -12.5663706143592 */