using System; namespace Science.Mathematics.VectorCalculus { public class TangentVectorOnSurface { private Surface s; private double[] u; public TangentVectorOnSurface(Surface surface, double[] at) { s = surface; u = at; } public double[] At { get { return u; } set { u = value; } } private Vector[] res; public Vector[] Result { get { return res; } } private int kth; public void Compute() { int n = s.Parametrization(u).Length; res = new Vector[u.Length]; for(int i = 0; i < u.Length; i++) res[i] = new Vector(n); Function.ToLastType f = new Function.ToLastType(func); PartialDerivative obj = new PartialDerivative(f,u); for (int k = 0; k < n; k++) { kth = k; for (int j = 0; j < u.Length; j++) { obj.WithRespectTo = j; obj.Compute(); res[j][kth] = obj.Result; } } } private double func(double[] v) { return s.Parametrization(v)[kth]; } } }