Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Help with "chop" and "rounding"

I would like to be able to implement the equivalent of a "chop" as well as a specified rounding arithmetic in Sage in order to explore relative error in approximation of these floating point mathematical manipulations.

In particular, I'd like to write my own short functions that can demonstrate these simple concepts. As I am a relative newbie, I'd appreciate any insight.

As an example, I want to compare and contrast floating point arithmetic for (1) exact, (2) using three-digit chopping and (3) three digit rounding. Then I want to compute relative errors.

My specific question, though really is how can I implement a "chop" function in Sage? Any insight would be appreciated. I see there is an earlier response about the equivalent of Mathematica's chop function in Sage, but I'd like more help.