zeta(%i-1),numer; causes an error



On 2/19/12 11:03 AM, Richard Fateman wrote:
> On 2/19/2012 9:09 AM, Robert Dodier wrote:
>> On 2/19/12, ???? <yasuaki.honda at gmail.com> wrote:
>>
>>> (%i1) zeta(%i-1),numer;
>>> BIGFLOAT: unable to convert #C(2.0 -1.0) to a CL or BIGFLOAT number.
>> Looks like BIGFLOAT:TO is called w/ a Lisp complex as its
>> argument, and it doesn't know what to do with that.
>> I suppose it should just return it unmodified.
> 
> I think bfloat( ?complex(2,-1))   should return  2.0b0 - 1.0b0*%i
> just as bfloat(2-%i) returns that.
> 
> But why is zeta() using bigfloats?

It's a badly named package.  Originally, the BIGFLOAT package was only
meant to provide an easy-to-use way of using maxima's bfloat numbers.
Hence the package name of BIGFLOAT.  But with a little bit of extra
work, it also provided 99% of the infrastructure to allow one piece of
lisp code to handle bfloats and floats (both real and complex) so that
the author didn't need to write up to 4 different but essentially
identical versions of the same piece of code.  (To handle float, complex
float, bfloat and complex bfloat).

So there is just one routine to compute zeta functions, and it uses the
BIGFLOAT package to handle floats and bfloats, and complex versions
thereof.  So, when given a float, only float arithmetic is used.

Yes, this approach is slower (possibly much slower) than 4 separate
routines, but at least then we get all precisions at once and if the
speed of the float routine is a concern, it can easily be changed to a
hand-written version.

Ray