[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Arbitrary precision integer arithmetic
From: |
Colin Macdonald |
Subject: |
Re: Arbitrary precision integer arithmetic |
Date: |
Sat, 8 Sep 2018 23:42:07 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 2018-09-07 10:21 PM, Etienne Grossmann wrote:
Hi again,
sorry, I didn't express myself clearly, and I didn't know about the
sym() function, only the vpa() function.
Let's say I want to compute 423^567 exactly.
With the vpa() function, I have to specify the length of the result, as
in vpa (vpa(423)^567, 1500).
The correct approach is to use the sym() function: with the sym()
function, sym('423^567') gives me the correct answer.
Sorry I'm late to this party. You're right; vpa is not appropriate
here: that is generally for variable precision floating point (i.e.,
inexact with rounding).
Your example is most easily done as:
sym(423)^567
And if you need to type a large integer, use strings:
sym('12345682349871248651953253257235')^sym('123123124125')
- - - - -
intinf looks like it was great fun to write so far! If you're into this
sort of thing, I can definitely use help with the Symbolic package---and
even more so with upstream SymPy that powers it.
The Interval package also involves @classes and overloading everything :)
cheers,
Colin