On Sun, Apr 11, 2010 at 12:47 PM, bb <bblo...@arcor.de> wrote:
> In an earlier posting (I am always thankful for any help!) you wrote:
> One could do a little work to get Sage's interval arithmetic to do
> something similar. Would be an interesting experiment.

Here's a brief example

sage: RIF
Real Interval Field with 53 bits of precision
sage: R = RealIntervalField(200); R
Real Interval Field with 200 bits of precision
sage: f = RIF(pi) + 0.5; f
3.641592653589794?
sage: g = R(f); g
3.641592653589794?
sage: g.parent()
Real Interval Field with 200 bits of precision

Even when you increase the precision, it doesn't print out more digits
since it knows the upper and lower bounds.  However, this does not
currently play nice with the .n() stuff.


> I found an internet page about that topic concerning MPFR from 2/5/2006:
> http://www.ma.utexas.edu/users/kschalm/mpfr-in-sage.html
> (MPFR seems to be very broadly used by different Progs under GNU Lesser GPL.
> Added is a list of related software.)
>
> There are used some Sage-examples with a strange line-numbering with
> underscores? May be that is an outdated Sage-Version? Actual versions do not
> do any line numbering.

This page is indeed quite outdated.


> I did not find any evidence that MPFR or MAPM is included in Sage? I do not
> understand if MPFR is compiled with Sage in this examples on that page? I
> cannot find any evidence that MPFR is loaded?

MPFR is included in Sage by default.  Sage's RealNumber class is a
wrapper around an MPFR object.  Any high-precision floating point
arithmetic in Sage uses MPFR.

> In an extension of the floating point issue I am actually interested in: I
> found a list of libs to support floating point arithmetics that are not in
> the list of included libs to Sage. I found some examples to include tools
> with a CLI via http in the documentatin. I did not find hints how to include
> C/C++ or other language libs to Sage? (To clear that statement: The fact I
> could not find it does not mean it is not documented in some place!)

If you want to interface with other C/C++ libraries, the easiest way
to do so is using Cython [1].  There are also lots of examples in the
Sage library; for example,
$SAGE_ROOT/devel/sage/sage/rings/real_mpfr.pyx

--Mike

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

To unsubscribe, reply using "remove me" as the subject.

Reply via email to