On Dec 21, 2009, at 6:31 AM, Mike Hansen wrote:

Hello,

On Mon, Dec 21, 2009 at 5:34 AM, daan <[email protected]> wrote:
For simulations I'm running, I'd like to perform some calculations
with an arbitrary precision, but I want to store my variables in
arrays so I can iterate through them for calculations. I've found
http://www.sagemath.org/doc/reference/sage/rings/real_mpfr.html for
working with real numbers with arbitrary precision, but I can't figure
out if/how I can put those numbers in arrays.

Sage has arbitrary fixed precision floating point arithmetic.   You
can make a matrix with these as entries like this:

You can also use Python lists, if all you need to do is index and iterate over them.

http://diveintopython.org/native_data_types/lists.html

sage: m = matrix(RealField(1000), 2, 2, [[1,2],[3,4]])

All of the entries will be real numbers with 1000 bits of precision.
Let us know if there are any other questions you have.

It should be noted that matrix operations in this case are done using the naive algorithms, with no regard for numerical stability. (We'd love for someone who knows about this area to fix that.) Matrices over RDF and CDF (53 bits only) do use more appropriate algorithms from SciPy and NumPy.

- Robert

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

Reply via email to