errr ... exponential integral ---> sum

Axel Vogt's picture
  restart: interface(version); Digits:=14:

    Classic Worksheet Interface, Maple 11.02, Windows, Nov 10 2007 Build ID 330022

  Ei(1,1/2*Pi*(1+2*k)): 
  %=convert(%,Sum);
  subs(k=0,%);
  evalf(%);

                    Pi (1 + 2 k)
              Ei(1, ------------) = GAMMA(Pi k + 1/2 Pi)
                         2

                             Pi            Pi
                      Ei(1, ----) = GAMMA(----)
                             2             2

                 0.090082461803865 = 0.89056089038154


and that mess not only for k=0 ...



Comments

Axel Vogt's picture

or simply

  Ei(1,x): 
  %=convert(%,Sum);
                         Ei(1, x) = GAMMA(x)

Robert Israel's picture

Strange bug

Interesting... 

 convert(Ei(1,x), GAMMA);

GAMMA(0,x)

(which is correct).

 convert(Ei(1,x), FormalPowerSeries, x);

-gamma-ln(x)+Sum((-1)^k/(k+1)!*x^(k+1)/(k+1),k = 0 .. infinity)

(also correct, I think).

Why is the <maple> tag not working for me?

John Fredsted's picture

Concerning the maple tag

It does not work for me either, and it has not worked since the mapleprimes "update" which, it seems, was more concerned with cosmestics than usability. See for instance The pre, code, and maple tags and Maple tag, still ....

Axel Vogt's picture

perhaps ...

perhaps of this?
   
  GAMMA(a,z) = GAMMA(a) - z^a/a * `1F1`(a,1+a,-z);  # from the help page for GAMMA
  subs(a=0,%);
    Error, numeric exception: division by zero


JacquesC's picture

The problem routine

The core routine that does this transformation is

> showstat(`convert/GAMMA/IC/from`[Ei]);

`convert/GAMMA/IC/from`[Ei] := proc(f)
local a, z, G;
   1   if nargs = 0 then
   2     return 1, (a, z) -> if nargs = 2 then [[z <> 0]] end if
       end if;
   3   if nops(f) = 2 then
   4     a, z := op(f);
   5     if `tools/type`(z <> 0) then
   6       if `tools/type`(a,'integer') then
   7         G := ('GAMMA')(1-a,z)
           else
   8         G := GAMMA(1-a,z)
           end if;
   9       return z^(a-1)*G
         end if
       end if;
  10   f
end proc

which gives GAMMA(0,z) when given Ei(1,z) as input.  What should it be instead?

Axel Vogt's picture

Gamma( z ) vs Gamma( 0 , z )

converting Ei( 1 , z ) to Sum returns GAMMA( z ), not GAMMA( 0 , z )

BTW: strange that Maple knows about the (modified) exponential integral Ei( z ),  but I can
not find it through the help (it should stand for the  formal series in  Robert's  reply)

Edited for the "BTW": ok, should have looked closer at the help pages ... there it is, sorry

Why GAMMA?

What I wonder is why

convert(Ei(1,z),Sum);

does not convert to a formal power series, as stated in ?convert,sum and something like this form is needed to get it:

convert(Ei(1,z), Sum, include = powers,dummy=n);

                 /infinity                 \
                 | -----        n  (n + 1) |
                 |  \       (-1)  z        |
-gamma - ln(z) + |   )     ----------------|
                 |  /      (n + 1)! (n + 1)|
                 | -----                   |
                 \ n = 0                   /

convert(Ei(1,z),Sum) OK in Maple10

 

In Maple 10

convert(Ei(1,z),Sum); 

does work as the help says.

But as you note, the same command does not work in Maple 11.


 

What I get

in Maple 10.06 is different:

convert(Ei(1,z),Sum); 

infinity
 -----     (_k1)             (-1 + _k1)
  \      (D     )(GAMMA)(1) z
   )     ------------------------------
  /                   _k1!
 -----
_k1 = 0

JacquesC's picture

Gamma(z) vs Gamma(0,z)

Internally, it first returns Gamma(0,z), which some other routines then ``simplify'' to Gamma(z).  Perhaps that is the actual bug?

Axel Vogt's picture

Gamma(z) vs Gamma(0,z)

That might it be, GAMMA(0,z)/GAMMA(z); plot(%,z=0..6); shows it ...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}