Re-implementing R in Maxima



Re: What's missing with bfloats?

In all the following, I've set keepfloat:true;

First of all, there are many cases where Maxima doesn't support floats OR
bfloats, and converts them to rationals.  For example:

(%i15) integrate(x^2.1,x,0,2.3);
rat: replaced 2.1 by 21/10 = 2.1
(%o15) 4.2657421262112

But diff is OK with floats and bfloats.

The biggest case I can think of off the top of my head is that CREs support
floats (using keepfloat:true) but not bfloats.  This also means that taylor
and some matrix operations also don't support bfloats.

(%i3) mr:matrix([1/2,1/3],[1/4,1/5]);
(%o3) matrix([1/2,1/3],[1/4,1/5])
(%i4) mf:float(mr);
(%o4) matrix([0.5,0.333333333333333],[0.25,0.2])
(%i5) mb:bfloat(mr);
(%o5) matrix([5.0b-1,3.333333333333333b-1],[2.5b-1,2.0b-1])
(%i6) mr^^-1;
(%o6) matrix([12,-20],[-15,30])
(%i7) mf^^-1;
(%o7) matrix([11.99999999999999,-19.99999999999999],
             [-14.99999999999999,29.99999999999998])
(%i8) mb^^-1;
`rat' replaced 5.0B-1 by 1/2 = 5.0B-1
`rat' replaced 3.333333333333333B-1 by 1/3 = 3.333333333333333B-1
`rat' replaced 2.5B-1 by 1/4 = 2.5B-1
`rat' replaced 2.0B-1 by 1/5 = 2.0B-1
(%o8) matrix([12,-20],[-15,30])
(%i9) taylor(.3b0,x,0,1);
`rat' replaced 3.0B-1 by 3/10 = 3.0B-1
(%o9) +3/10

solve and allroots don't support bfloats.  romberg doesn't support bfloats

Of course, none of the external math packages (quadpack etc.) support
bfloats.

That's off the top of my head.  I'm sure there are others.

           -s

On Mon, Oct 31, 2011 at 11:46, Raymond Toy <toy.raymond at gmail.com> wrote:

>
>
> On Sun, Oct 30, 2011 at 7:22 PM, Stavros Macrakis <macrakis at alum.mit.edu>wrote:
>
>> On Sat, Oct 29, 2011 at 16:44, Robert Dodier <robert.dodier at gmail.com>wrote:
>>
>>> ...Well, I'd like to see stuff like this: compute the mean / variance /
>>> etc
>>> of [a, b, c] where a, b, and c are symbols, intervals, objects which
>>> represent some special-purpose implementation (e.g. multiple precision
>>> numbers), expressions like 2 i + 3 j - 4 k, dimensional quantities
>>> (feet, meters, etc), or ordinary numbers, or combinations thereof.
>>>
>>
>> Well, yes, right now, neither Maxima nor R can deal with arbitrary-type
>> arithmetic objects for most operations.  R, though it has a wealth of
>> object systems (some standard and others added on), has no standard
>> functions which can operate with opaque arithmetic types.
>>
>> Maxima almost succeeds in supporting bigfloats everywhere it supports
>> floats, but not quite, so adding
>>
>
> What's missing with bfloats?
>
>
>>  anything that doesn't behave like a number is probably a fair amount of
>> work (e.g. for intervals, trichotomy doesn't hold).
>>
>> Of course, Maxima has the advantage that it does support arbitrary
>> symbolic expressions, so it doesn't assume things like trichotomy in
>> general.  Still, I don't see that anyone has succeeded in building a
>> reasonably complete and efficient interval arithmetic system on top of it.
>>
>>
> Do you want symbolic intervals too?
>
> Ray
>