Another way around this is to consider removing ((rat) a b) and
using common lisp rationals.
This requires changes in Maxima in many places, but maybe not as many as
some people would think.
Also, using common lisp complex constants. This makes the
representation of a+b*%i with symbols a, b
((mplus simp) $a ((mtimes simp) $b $%i)) which is
different from 3+4*%i, which would be common lisp #c(3,4). But then
complex bigfloats would be
((mplus simp) ((bigfloat...) ((mtimes simp) ....))
I think this has to be thought through more completely, not just for
gamma, and could be a nice application
of CLOS (as per the code I wrote for generic arithmetic, which might
however not be easy to drop in to Maxima).
RJF
There are only two caseDieter Kaiser wrote:
> Am Freitag, den 23.01.2009, 19:57 -0500 schrieb Raymond Toy:
>
>> Dieter Kaiser wrote:
>>
>>> The problem is that after a call e.g. to the Maxima function $gamma we
>>> get a back a Maxima number. To continue the calculation we need the
>>> number with a type which is compatible to the calculation within the
>>> package bigfloat. This number should not be in general a bigfloat, but a
>>> float, CL complex, ... and a bigfloat type only for Maxima bigfloat
>>> number.
>>>
>>> I think such a function has to be added.
>>>
>>>
>>>
>> Ok. I understand now. I think TO should do what you want and preserve
>> CL number types. When it finds '((rat) a b) it should convert to a Lisp
>> rational, and '((bfloat) ...) should be a BIGFLOAT:REAL object. If
>> maxima returns something like x+%i*y, TO should return a CL complex when
>> possible and then a BIGFLOAT:COMPLEX object.
>>
>> To explicitly convert a CL number to a bigfloat, we'll have to use
>> (float x <some bigfloat number>) or (coerce x 'bigfloat:real)).
>>
>> How does that sound?
>>
>
> Hello Ray,
>
> yes, that is the functionality I need to combine a call to a Maxima
> function with the calculation within the package bigfloat.
>
> Again the example. I have named the new function convert and added the
> prefix maxima to be more clear:
>
> (bigfloat:-
> (bigfloat:/
> (bigfloat:*
> (bigfloat:convert ($gamma (maxima:to a)))
> (bigfloat:convert ($gamma (maxima:to b))))
> (bigfloat:convert ($gamma (maxima:to (bigfloat:+ a b)))))
> (beta-incomplete b a (bigfloat:- 1.0 z))))
>
> Furthermore I would like to use the convention that a numerical function
> is called with and returns a type compatible to the package bigfloat.
>
> Thus a call to the numerical function beta-incomplete from the
> simplifier has been implemented as
>
> (maxima:to (beta-incomplete (bigfloat:convert a)
> (bigfloat:convert b)
> (bigfloat:convert z)))
>
> Dieter Kaiser
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>