using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter7.Section5 { 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 = Math.PI; s.Parameter2StartValue = 0.0; s.Parameter2EndValue = Math.PI * 2.0; Science.Mathematics.Function.ToLastType g = new Science.Mathematics.Function.ToLastType(gfunc); V.SurfaceIntegralScalar obj = new V.SurfaceIntegralScalar(g, s); obj.Compute(); result += obj.Result.ToString() + "\r\n"; double res = 4.0*Math.PI/3.0; result += res.ToString() + "\r\n"; } private double[] func(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 gfunc(double[] x) { return x[2]*x[2]; } } } /* 4.18877766802809 4.18879020478639 */