using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter2.Section1 { public class Example02 { public Example02() { } private string result; public string Result { get{return result;} } public void Compute() { Science.Mathematics.Function.ToLastType cf = new Science.Mathematics.Function.ToLastType(Box); V.Domain2D xd = new V.Domain2D(); xd.ConditionFunctionsLessThanZero = cf; xd.LowerBoundOfX = -1.0; xd.LowerBoundOfY = -1.0; xd.UpperBoundOfX = 1.0; xd.UpperBoundOfY = 1.0; Science.Mathematics.Function.ToLastType f = new Science.Mathematics.Function.ToLastType(func); V.LevelCurve ls = new V.LevelCurve(f, 3.0, xd); ls.FindCurve(0.01); for (int i = 0; i < ls.CurvePointX.Count; i++) { result += ls.CurvePointX[i].ToString() + "\t"; result += ls.CurvePointY[i].ToString() + "\r\n"; } } private double func(double x, double y) { return x + y + 2.0; } private double[] Box(double x, double y) { double[] f = new double[4]; f[0] = x - 1.0; f[1] = -x - 1.0; f[2] = y - 1.0; f[3] = -y - 1.0; return f; } } } /* 0.02 0.98 0.01 0.99 0.03 0.97 0.02 0.98 0.02 0.98 0.02 0.98 0.04 0.96 0.03 0.97 0.03 0.97 0.03 0.97 0.05 0.95 0.04 0.96 0.04 0.96 0.04 0.96 0.06 0.94 0.05 0.95 0.05 0.95 0.05 0.95 0.07 0.93 0.0600000000000001 0.94 0.0600000000000001 0.94 0.0600000000000001 0.94 0.0800000000000001 0.92 0.0700000000000001 0.93 0.0700000000000001 0.93 0.0700000000000001 0.93 0.0900000000000001 0.91 0.0800000000000001 0.92 0.0800000000000001 0.92 0.0800000000000001 0.92 0.1 0.9 0.0900000000000001 0.91 0.0900000000000001 0.91 0.0900000000000001 0.91 0.11 0.89 0.1 0.9 0.1 0.9 0.1 0.9 0.12 0.88 0.11 0.89 0.11 0.89 0.11 0.89 0.13 0.87 0.12 0.88 0.12 0.88 0.12 0.88 0.14 0.86 0.13 0.87 0.13 0.87 0.13 0.87 0.15 0.85 0.14 0.86 0.14 0.86 0.14 0.86 0.16 0.84 0.15 0.85 0.15 0.85 0.15 0.85 0.17 0.83 0.16 0.84 0.16 0.84 0.16 0.84 0.18 0.82 0.17 0.83 0.17 0.83 0.17 0.83 0.19 0.81 0.18 0.82 0.18 0.82 0.18 0.82 0.2 0.8 0.19 0.81 0.19 0.81 0.19 0.81 0.21 0.79 0.2 0.8 0.2 0.8 0.2 0.8 0.22 0.78 0.21 0.79 0.21 0.79 0.21 0.79 0.23 0.77 0.22 0.78 0.22 0.78 0.22 0.78 0.24 0.76 0.23 0.77 0.23 0.77 0.23 0.77 0.25 0.75 0.24 0.76 0.24 0.76 0.24 0.76 0.26 0.74 0.25 0.75 0.25 0.75 0.25 0.75 0.27 0.73 0.26 0.74 0.26 0.74 0.26 0.74 0.28 0.72 0.27 0.73 0.27 0.73 0.27 0.73 0.29 0.71 0.28 0.72 0.28 0.72 0.28 0.72 0.3 0.7 0.29 0.71 0.29 0.71 0.29 0.71 0.31 0.69 0.3 0.7 0.3 0.7 0.3 0.7 0.32 0.68 0.31 0.69 0.31 0.69 0.31 0.69 0.33 0.67 0.32 0.68 0.32 0.68 0.32 0.68 0.34 0.66 0.33 0.67 0.33 0.67 0.33 0.67 0.35 0.65 0.34 0.66 0.34 0.66 0.34 0.66 0.36 0.64 0.35 0.65 0.35 0.65 0.35 0.65 0.37 0.63 0.36 0.64 0.36 0.64 0.36 0.64 0.38 0.62 0.37 0.63 0.37 0.63 0.37 0.63 0.39 0.61 0.38 0.62 0.38 0.62 0.38 0.62 0.4 0.6 0.39 0.61 0.39 0.61 0.39 0.61 0.41 0.59 0.4 0.6 0.4 0.6 0.4 0.6 0.42 0.58 0.41 0.59 0.41 0.59 0.41 0.59 0.43 0.57 0.42 0.58 0.42 0.58 0.42 0.58 0.44 0.56 0.43 0.57 0.43 0.57 0.43 0.57 0.45 0.55 0.44 0.56 0.44 0.56 0.44 0.56 0.46 0.54 0.45 0.55 0.45 0.55 0.45 0.55 0.47 0.53 0.46 0.54 0.46 0.54 0.46 0.54 0.48 0.52 0.47 0.53 0.47 0.53 0.47 0.53 0.49 0.51 0.48 0.52 0.48 0.52 0.48 0.52 0.5 0.5 0.49 0.51 0.49 0.51 0.49 0.51 0.51 0.49 0.5 0.5 0.5 0.5 0.5 0.5 0.52 0.48 0.51 0.49 0.51 0.49 0.51 0.49 0.53 0.47 0.52 0.48 0.52 0.48 0.52 0.48 0.54 0.46 0.53 0.47 0.53 0.47 0.53 0.47 0.55 0.45 0.54 0.46 0.54 0.46 0.54 0.46 0.56 0.44 0.55 0.45 0.55 0.45 0.55 0.45 0.57 0.43 0.56 0.44 0.56 0.44 0.56 0.44 0.58 0.42 0.57 0.43 0.57 0.43 0.57 0.43 0.59 0.41 0.58 0.42 0.58 0.42 0.58 0.42 0.6 0.4 0.59 0.41 0.59 0.41 0.59 0.41 0.61 0.39 0.6 0.4 0.6 0.4 0.6 0.4 0.62 0.38 0.61 0.39 0.61 0.39 0.61 0.39 0.63 0.37 0.62 0.38 0.62 0.38 0.62 0.38 0.64 0.36 0.63 0.37 0.63 0.37 0.63 0.37 0.65 0.35 0.64 0.36 0.64 0.36 0.64 0.36 0.66 0.34 0.65 0.35 0.65 0.35 0.65 0.35 0.67 0.33 0.66 0.34 0.66 0.34 0.66 0.34 0.68 0.32 0.67 0.33 0.67 0.33 0.67 0.33 0.69 0.31 0.68 0.32 0.68 0.32 0.68 0.32 0.7 0.3 0.69 0.31 0.69 0.31 0.69 0.31 0.71 0.29 0.7 0.3 0.7 0.3 0.7 0.3 0.72 0.28 0.71 0.29 0.71 0.29 0.71 0.29 0.73 0.27 0.72 0.28 0.72 0.28 0.72 0.28 0.74 0.26 0.73 0.27 0.73 0.27 0.73 0.27 0.75 0.25 0.74 0.26 0.74 0.26 0.74 0.26 0.76 0.24 0.75 0.25 0.75 0.25 0.75 0.25 0.77 0.23 0.76 0.24 0.76 0.24 0.76 0.24 0.78 0.22 0.77 0.23 0.77 0.23 0.77 0.23 0.79 0.21 0.78 0.22 0.78 0.22 0.78 0.22 0.8 0.2 0.79 0.21 0.79 0.21 0.79 0.21 0.81 0.19 0.8 0.2 0.8 0.2 0.8 0.2 0.82 0.18 0.81 0.19 0.81 0.19 0.81 0.19 0.83 0.17 0.82 0.18 0.82 0.18 0.82 0.18 0.84 0.16 0.83 0.17 0.83 0.17 0.83 0.17 0.85 0.15 0.84 0.16 0.84 0.16 0.84 0.16 0.86 0.14 0.85 0.15 0.85 0.15 0.85 0.15 0.87 0.13 0.86 0.14 0.86 0.14 0.86 0.14 0.88 0.12 0.87 0.13 0.87 0.13 0.87 0.13 0.89 0.11 0.88 0.12 0.88 0.12 0.88 0.12 0.9 0.1 0.89 0.11 0.89 0.11 0.89 0.11 0.91 0.0900000000000001 0.9 0.1 0.9 0.1 0.9 0.1 0.92 0.0800000000000001 0.91 0.0900000000000001 0.91 0.0900000000000001 0.91 0.0900000000000001 0.93 0.0700000000000001 0.92 0.0800000000000001 0.92 0.0800000000000001 0.92 0.0800000000000001 0.94 0.0600000000000001 0.93 0.07 0.93 0.0700000000000001 0.93 0.0700000000000001 0.95 0.05 0.94 0.06 0.94 0.0600000000000001 0.94 0.0600000000000001 0.96 0.04 0.95 0.05 0.95 0.05 0.95 0.05 0.97 0.03 0.96 0.04 0.96 0.04 0.96 0.04 0.98 0.02 0.97 0.03 0.97 0.03 0.97 0.03 0.99 0.01 0.98 0.02 0.98 0.02 0.98 0.02 */