using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter8.Section1 { public class Example02 { public Example02() { } 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 = a; 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 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 += (3.0/8.0*Math.PI*a*a).ToString() + "\r\n"; } private double[] func(double[] u) { double[] x = new double[3]; x[0] = u[1] * Math.Pow(Math.Cos(u[0]), 3.0); x[1] = u[1] * Math.Pow(Math.Sin(u[0]), 3.0); x[2] = 0.0; return x; } private double a = 2.0; private double[] gunc(double t) { double[] x = new double[3]; x[0] = a*Math.Pow(Math.Cos(t),3.0); x[1] = a*Math.Pow(Math.Sin(t),3.0); x[2] = 0.0; return x; } private double pf(double[] x) { return -x[1]/2.0; } private double qf(double[] x) { return x[0]/2.0; } } } /* 4.71238898036606 4.71234556041428 0.000157450538742225 4.71238898038469 */