Chop

Chop[expr]

replaces approximate real numbers in expr that are close to zero by the exact integer 0.

Details

  • Chop[expr,delta] replaces numbers smaller in absolute magnitude than delta by 0.
  • Chop uses a default tolerance of 10-10.
  • Chop works on both Real and Complex numbers.

Examples

open allclose all

Basic Examples  (1)

Zero out elements that are very close to 0:

Scope  (2)

Drop small imaginary parts:

Convert from approximate zeros to exact zeros:

Applications  (2)

Test if two numbers are the same to a certain tolerance:

They are the same to the default tolerance of :

They are not the same to the tolerance of :

Eliminate very small terms before comparing with Equal:

They are not equal because a small number is not equal to zero:

Once the small terms are eliminated, equality holds:

Properties & Relations  (1)

A functional implementation of Chop:

Chop is much faster for large expressions:

Possible Issues  (1)

Machine complex numbers have machine reals for both real and imaginary parts:

Consequently, Chop does not make the real part of machine complex numbers an exact zero:

Small imaginary parts from machine complex numbers are eliminated to make a machine real:

Wolfram Research (1988), Chop, Wolfram Language function, https://reference.wolfram.com/language/ref/Chop.html.

Text

Wolfram Research (1988), Chop, Wolfram Language function, https://reference.wolfram.com/language/ref/Chop.html.

BibTeX

@misc{reference.wolfram_2021_chop, author="Wolfram Research", title="{Chop}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Chop.html}", note=[Accessed: 24-October-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_chop, organization={Wolfram Research}, title={Chop}, year={1988}, url={https://reference.wolfram.com/language/ref/Chop.html}, note=[Accessed: 24-October-2021 ]}

CMS

Wolfram Language. 1988. "Chop." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Chop.html.

APA

Wolfram Language. (1988). Chop. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Chop.html