Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     try {
         EllipticFunction ell = new EllipticFunction(0.1, 1.0);  // parameter m = 0.1
         // See Abramowitz and Stegun, table 17.1
         Console.WriteLine( String.Format( "{0} {1}", ell.K(), ell.E()));
         double phi = 20 * Math.Acos(-1.0) / 180.0;;
         // See Abramowitz and Stegun, table 17.6 with
         // alpha = asin(sqrt(m)) = 18.43 deg and phi = 20 deg
         Console.WriteLine( String.Format("{0} {1}", ell.E(phi),
                 ell.E(Math.Sin(phi), Math.Cos(phi),
                     Math.Sqrt(1 - ell.k2 * Math.Sin(phi) * Math.Sin(phi))) ) );
         // See Carlson 1995, Sec 3.
         Console.WriteLine(String.Format("RF(1,2,0)      = {0}", EllipticFunction.RF(1,2)));
         Console.WriteLine(String.Format("RF(2,3,4)      = {0}", EllipticFunction.RF(2,3,4)));
         Console.WriteLine(String.Format("RC(0,1/4)      = {0}", EllipticFunction.RC(0,0.25)));
         Console.WriteLine(String.Format("RC(9/4,2)      = {0}", EllipticFunction.RC(2.25,2)));
         Console.WriteLine(String.Format("RC(1/4,-2)     = {0}", EllipticFunction.RC(0.25,-2)));
         Console.WriteLine(String.Format("RJ(0,1,2,3)    = {0}", EllipticFunction.RJ(0,1,2,3)));
         Console.WriteLine(String.Format("RJ(2,3,4,5)    = {0}", EllipticFunction.RJ(2,3,4,5)));
         Console.WriteLine(String.Format("RD(0,2,1)      = {0}", EllipticFunction.RD(0,2,1)));
         Console.WriteLine(String.Format("RD(2,3,4)      = {0}", EllipticFunction.RD(2,3,4)));
         Console.WriteLine(String.Format("RG(0,16,16)    = {0}", EllipticFunction.RG(16,16)));
         Console.WriteLine(String.Format("RG(2,3,4)      = {0}", EllipticFunction.RG(2,3,4)));
         Console.WriteLine(String.Format("RG(0,0.0796,4) = {0}", EllipticFunction.RG(0.0796, 4)));
     }
     catch (GeographicErr e) {
         Console.WriteLine( String.Format( "Caught exception: {0}", e.Message ) );
     }
 }
Ejemplo n.º 2
0
 private void OnSet(object sender, EventArgs e)
 {
     try
     {
         double k2     = Double.Parse(m_k2TextBox.Text);
         double alpha2 = Double.Parse(m_alpha2TextBox.Text);
         if (m_constructorComboBox.SelectedIndex == 0)
         {
             m_func = new EllipticFunction(k2, alpha2);
         }
         else
         {
             double kp2     = Double.Parse(m_kp2TextBox.Text);
             double alphap2 = Double.Parse(m_alphap2TextBox.Text);
             m_func = new EllipticFunction(k2, alpha2, kp2, alphap2);
         }
         m_KtextBox.Text  = m_func.K().ToString();
         m_EtextBox.Text  = m_func.E().ToString();
         m_DtextBox.Text  = m_func.D().ToString();
         m_KEtextBox.Text = m_func.KE().ToString();
         m_PItextBox.Text = m_func.Pi().ToString();
         m_GtextBox.Text  = m_func.G().ToString();
         m_HtextBox.Text  = m_func.H().ToString();
     }
     catch (Exception xcpt)
     {
         MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 3
0
 static void Main(string[] args)
 {
     try {
         EllipticFunction ell = new EllipticFunction(0.1, 1.0);  // parameter m = 0.1
         // See Abramowitz and Stegun, table 17.1
         Console.WriteLine(String.Format("{0} {1}", ell.K(), ell.E()));
         double phi = 20 * Math.Acos(-1.0) / 180.0;;
         // See Abramowitz and Stegun, table 17.6 with
         // alpha = asin(sqrt(m)) = 18.43 deg and phi = 20 deg
         Console.WriteLine(String.Format("{0} {1}", ell.E(phi),
                                         ell.E(Math.Sin(phi), Math.Cos(phi),
                                               Math.Sqrt(1 - ell.k2 * Math.Sin(phi) * Math.Sin(phi)))));
         // See Carlson 1995, Sec 3.
         Console.WriteLine(String.Format("RF(1,2,0)      = {0}", EllipticFunction.RF(1, 2)));
         Console.WriteLine(String.Format("RF(2,3,4)      = {0}", EllipticFunction.RF(2, 3, 4)));
         Console.WriteLine(String.Format("RC(0,1/4)      = {0}", EllipticFunction.RC(0, 0.25)));
         Console.WriteLine(String.Format("RC(9/4,2)      = {0}", EllipticFunction.RC(2.25, 2)));
         Console.WriteLine(String.Format("RC(1/4,-2)     = {0}", EllipticFunction.RC(0.25, -2)));
         Console.WriteLine(String.Format("RJ(0,1,2,3)    = {0}", EllipticFunction.RJ(0, 1, 2, 3)));
         Console.WriteLine(String.Format("RJ(2,3,4,5)    = {0}", EllipticFunction.RJ(2, 3, 4, 5)));
         Console.WriteLine(String.Format("RD(0,2,1)      = {0}", EllipticFunction.RD(0, 2, 1)));
         Console.WriteLine(String.Format("RD(2,3,4)      = {0}", EllipticFunction.RD(2, 3, 4)));
         Console.WriteLine(String.Format("RG(0,16,16)    = {0}", EllipticFunction.RG(16, 16)));
         Console.WriteLine(String.Format("RG(2,3,4)      = {0}", EllipticFunction.RG(2, 3, 4)));
         Console.WriteLine(String.Format("RG(0,0.0796,4) = {0}", EllipticFunction.RG(0.0796, 4)));
     }
     catch (GeographicErr e) {
         Console.WriteLine(String.Format("Caught exception: {0}", e.Message));
     }
 }
        private void Sigma(double u, double snu, double cnu, double dnu,
                           double v, double snv, double cnv, double dnv,
                           out double xi, out double eta)
        {
            // Lee 55.4 writing
            // dnu^2 + dnv^2 - 1 = _mu * cnu^2 + _mv * cnv^2
            var d = _mu * Sq(cnu) + _mv * Sq(cnv);

            xi  = _Eu.E(snu, cnu, dnu) - _mu * snu * cnu * dnu / d;
            eta = v - _Ev.E(snv, cnv, dnv) + _mv * snv * cnv * dnv / d;
        }
Ejemplo n.º 5
0
 private void OnValidate(object sender, EventArgs e)
 {
     try
     {
         double           phi = 0.8;
         EllipticFunction f   = new EllipticFunction(0.3, 0.4, 0.7, 0.6);
         f.Reset(0.2, 0.3, 0.8, 0.7);
         f = new EllipticFunction(0.3, 0.4);
         f.Reset(0.2, 0.3);
         double cn, sn, dn;
         f.sncndn(0.3, out sn, out cn, out dn);
         f.Delta(sn, cn);
         f.D();
         f.D(phi);
         f.D(sn, cn, dn);
         f.Pi();
         f.Pi(phi);
         f.Pi(sn, cn, dn);
         f.KE();
         f.K();
         f.H();
         f.H(phi);
         f.H(sn, cn, dn);
         f.G();
         f.G(phi);
         f.G(sn, cn, dn);
         f.F(phi);
         f.F(sn, cn, dn);
         f.Einv(0.75);
         f.Ed(60.0);
         f.E();
         f.E(phi);
         f.E(sn, cn, dn);
         double tau = 3.1415927 / 10.0;
         f.deltaEinv(Math.Sin(tau), Math.Cos(tau));
         f.deltaD(sn, cn, dn);
         f.deltaE(sn, cn, dn);
         f.deltaF(sn, cn, dn);
         f.deltaG(sn, cn, dn);
         f.deltaH(sn, cn, dn);
         f.deltaPi(sn, cn, dn);
     }
     catch (Exception xcpt)
     {
         MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Ejemplo n.º 6
0
 private void OnValidate(object sender, EventArgs e)
 {
     try
     {
         double phi = 0.8;
         EllipticFunction f = new EllipticFunction(0.3, 0.4, 0.7, 0.6);
         f.Reset(0.2, 0.3, 0.8, 0.7);
         f = new EllipticFunction(0.3, 0.4);
         f.Reset(0.2, 0.3);
         double cn, sn, dn;
         f.sncndn(0.3, out sn, out cn, out dn);
         f.Delta(sn, cn);
         f.D();
         f.D(phi);
         f.D(sn, cn, dn);
         f.Pi();
         f.Pi(phi);
         f.Pi(sn, cn, dn);
         f.KE();
         f.K();
         f.H();
         f.H(phi);
         f.H(sn, cn, dn);
         f.G();
         f.G(phi);
         f.G(sn, cn, dn);
         f.F(phi);
         f.F(sn, cn, dn);
         f.Einv(0.75);
         f.Ed(60.0);
         f.E();
         f.E(phi);
         f.E(sn, cn, dn);
         double tau = 3.1415927 / 10.0;
         f.deltaEinv(Math.Sin(tau), Math.Cos(tau));
         f.deltaD(sn, cn, dn);
         f.deltaE(sn, cn, dn);
         f.deltaF(sn, cn, dn);
         f.deltaG(sn, cn, dn);
         f.deltaH(sn, cn, dn);
         f.deltaPi(sn, cn, dn);
     }
     catch (Exception xcpt)
     {
         MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }