]> www.ginac.de Git - ginac.git/blobdiff - ginac/inifcns_gamma.cpp
replaced fraction addition algorithm with a slightly faster one (no polynomial
[ginac.git] / ginac / inifcns_gamma.cpp
index e6ba5b1155f569e60073d8c50550f01c5e186fa0..cd21ce4c85a69b36eeb957d99eb10a2c741260c5 100644 (file)
@@ -4,7 +4,7 @@
  *  some related stuff. */
 
 /*
- *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -85,9 +85,9 @@ static ex lgamma_deriv(const ex & x, unsigned deriv_param)
 
 
 static ex lgamma_series(const ex & arg,
-                                               const relational & rel,
-                                               int order,
-                                               unsigned options)
+                        const relational & rel,
+                        int order,
+                        unsigned options)
 {
        // method:
        // Taylor series where there is no pole falls back to psi function
@@ -105,15 +105,14 @@ static ex lgamma_series(const ex & arg,
        ex recur;
        for (numeric p; p<=m; ++p)
                recur += log(arg+p);
-       cout << recur << endl;
        return (lgamma(arg+m+_ex1())-recur).series(rel, order, options);
 }
 
 
 REGISTER_FUNCTION(lgamma, eval_func(lgamma_eval).
-                                                 evalf_func(lgamma_evalf).
-                                                 derivative_func(lgamma_deriv).
-                                                 series_func(lgamma_series));
+                          evalf_func(lgamma_evalf).
+                          derivative_func(lgamma_deriv).
+                          series_func(lgamma_series));
 
 
 //////////
@@ -182,9 +181,9 @@ static ex tgamma_deriv(const ex & x, unsigned deriv_param)
 
 
 static ex tgamma_series(const ex & arg,
-                                               const relational & rel,
-                                               int order,
-                                               unsigned options)
+                        const relational & rel,
+                        int order,
+                        unsigned options)
 {
        // method:
        // Taylor series where there is no pole falls back to psi function
@@ -207,9 +206,9 @@ static ex tgamma_series(const ex & arg,
 
 
 REGISTER_FUNCTION(tgamma, eval_func(tgamma_eval).
-                                                 evalf_func(tgamma_evalf).
-                                                 derivative_func(tgamma_deriv).
-                                                 series_func(tgamma_series));
+                          evalf_func(tgamma_evalf).
+                          derivative_func(tgamma_deriv).
+                          series_func(tgamma_series));
 
 
 //////////
@@ -280,10 +279,10 @@ static ex beta_deriv(const ex & x, const ex & y, unsigned deriv_param)
 
 
 static ex beta_series(const ex & arg1,
-                                         const ex & arg2,
-                                         const relational & rel,
-                                         int order,
-                                         unsigned options)
+                      const ex & arg2,
+                      const relational & rel,
+                      int order,
+                      unsigned options)
 {
        // method:
        // Taylor series where there is no pole of one of the tgamma functions
@@ -295,7 +294,7 @@ static ex beta_series(const ex & arg1,
        const symbol *s = static_cast<symbol *>(rel.lhs().bp);
        ex arg1_ser, arg2_ser, arg1arg2_ser;
        if ((!arg1_pt.info(info_flags::integer) || arg1_pt.info(info_flags::positive)) &&
-               (!arg2_pt.info(info_flags::integer) || arg2_pt.info(info_flags::positive)))
+           (!arg2_pt.info(info_flags::integer) || arg2_pt.info(info_flags::positive)))
                throw do_taylor();  // caught by function::series()
        // trap the case where arg1 is on a pole:
        if (arg1.info(info_flags::integer) && !arg1.info(info_flags::positive))
@@ -318,9 +317,9 @@ static ex beta_series(const ex & arg1,
 
 
 REGISTER_FUNCTION(beta, eval_func(beta_eval).
-                                               evalf_func(beta_evalf).
-                                               derivative_func(beta_deriv).
-                                               series_func(beta_series));
+                        evalf_func(beta_evalf).
+                        derivative_func(beta_deriv).
+                        series_func(beta_series));
 
 
 //////////
@@ -390,9 +389,9 @@ static ex psi1_deriv(const ex & x, unsigned deriv_param)
 }
 
 static ex psi1_series(const ex & arg,
-                                         const relational & rel,
-                                         int order,
-                                         unsigned options)
+                      const relational & rel,
+                      int order,
+                      unsigned options)
 {
        // method:
        // Taylor series where there is no pole falls back to polygamma function
@@ -415,11 +414,11 @@ static ex psi1_series(const ex & arg,
 
 const unsigned function_index_psi1 =
        function::register_new(function_options("psi").
-                                                  eval_func(psi1_eval).
-                                                  evalf_func(psi1_evalf).
-                          derivative_func(psi1_deriv).
-                          series_func(psi1_series).
-                          overloaded(2));
+                              eval_func(psi1_eval).
+                              evalf_func(psi1_evalf).
+                              derivative_func(psi1_deriv).
+                              series_func(psi1_series).
+                              overloaded(2));
 
 //////////
 // Psi-functions (aka polygamma-functions)  psi(0,x)==psi(x)
@@ -513,10 +512,10 @@ static ex psi2_deriv(const ex & n, const ex & x, unsigned deriv_param)
 }
 
 static ex psi2_series(const ex & n,
-                                         const ex & arg,
-                                         const relational & rel,
-                                         int order,
-                                         unsigned options)
+                      const ex & arg,
+                      const relational & rel,
+                      int order,
+                      unsigned options)
 {
        // method:
        // Taylor series where there is no pole falls back to polygamma function
@@ -541,11 +540,11 @@ static ex psi2_series(const ex & n,
 
 const unsigned function_index_psi2 =
        function::register_new(function_options("psi").
-                                                  eval_func(psi2_eval).
-                                                  evalf_func(psi2_evalf).
-                          derivative_func(psi2_deriv).
-                          series_func(psi2_series).
-                          overloaded(2));
+                              eval_func(psi2_eval).
+                              evalf_func(psi2_evalf).
+                              derivative_func(psi2_deriv).
+                              series_func(psi2_series).
+                              overloaded(2));
 
 
 #ifndef NO_NAMESPACE_GINAC