C#, Calcul numérique - Méthode de calcul et programme source des fonctions hypergéométriques

Fonctions hypergéométriques

utiliser le système ;

espace de noms Legalsoft.Truffer
{

    /// <summary>
    /// Fonctions hypergéométriques
    /// </summary>
    public class Hypergeo
    {         //private Complex series, deriv;         Hypergéo privé()         {         }



        public static void hypser(Complex a, Complex b, Complex c, Complex z, Complex series, Complex deriv)
        {             deriv = new Complex(0.0);             fac complexe = nouveau Complexe(1.0);             Temp complexe = new Complex(fac);             Complexe aa = nouveau Complexe(a);             Complexe bb = nouveau Complexe(b);             Complexe cc = nouveau Complexe(c);





            for (int n = 1; n <= 1000; n++)
            {                 fac *= ((aa * bb) / cc);                 dérivé += fac ;                 fac *= ((1.0/n) * z);                 série = temp + fac ;                 si (série == temp)                 {                     retour ;                 }                 temp = série ;                 aa += 1,0 ;                 bb += 1,0 ;                 cc += 1,0 ;             }             throw new Exception("échec de convergence dans hypser");         }














        public Complexe hypgeo0(Complexe a, Complexe b, Complexe c, Complexe z)
        {             double atol = 1.0e-14;             double rtol = 1.0e-14 ;             Complexe ans = nouveau Complexe();             Complexe dz = nouveau Complexe();             Complexe z0 = nouveau Complexe();             Complexe[] y = nouveau Complexe[2] ;             double[] yy = nouveau double[4] ;             if ((z.norm()) <= 0.25)             {                 hypser(a, b, c, z, ans, y[1]);                 retour répond;             }             sinon si ((z.re) < 0.0)             {                 z0 = nouveau Complexe(-0.5, 0.0);             }
















            sinon si ((z.re) <= 1.0)
            {                 z0 = new Complex(0.5, 0.0);             }             sinon             {                 z0 = new Complex(0.0, (z.im) >= 0.0 ? 0.5 : -0.5);             }             dz = z - z0 ;             hypser(a, b, c, z0, y[0], y[1]);             yy[0] = (y[0].re);             yy[1] = (y[0].im);             yy[2] = (y[1].re);             yy[3] = (y[1].im);











            Hypderiv d = new Hypderiv(a, b, c, z0, dz);
            Sortie xout = nouvelle Sortie();
            StepperBS s = nouveau StepperBS();
            Odeint ode = nouveau Odeint(yy, 0.0, 1.0, atol, rtol, 0.1, 0.0, xout, d, s);
            ode.integrate();

            y[0] = nouveau Complexe(yy[0], yy[1]);
            renvoie y[0] ;
        }

        public Complexe hypgeo(Complexe a, Complexe b, Complexe c, Complexe z)
        {             Hypergeo h = new Hypergeo();             return h.hypgeo0(a, b, c, z);         }     } }





 

Je suppose que tu aimes

Origine blog.csdn.net/beijinghorn/article/details/131894033
conseillé
Classement