Beispiel #1
0
        public static double[] Electroestatica(Particula p1, Particula p2)
        {
            double[] f    = new double[p1.aceleracion.Length];
            double   dist = Interaccion.DistanciaCartesiana(p1, p2);

            double[] u = Interaccion.VectorUnitario(p1, p2);
            for (int i = 0; i < f.Length; i++)
            {
                f[i] = (Particula.K * (p1.carga * p2.carga) / (dist * dist)) * u[i];
            }
            return(f);
        }
Beispiel #2
0
        public static double[] Gravitatoria(Particula p1, Particula p2)
        {
            double[] f    = new double[p1.aceleracion.Length];
            double   dist = Interaccion.DistanciaCartesiana(p1, p2);

            double[] u = Interaccion.VectorUnitario(p1, p2);
            for (int i = 0; i < f.Length; i++)
            {
                f[i] = -1 * (Particula.G * (p1.masa * p2.masa) / (dist * dist)) * u[i];
            }
            return(f);
        }