Approximated complex numbers. How I put them to zero?

Click For Summary
SUMMARY

The discussion centers on simplifying complex numbers in Mathematica, specifically addressing the challenge of eliminating the imaginary part when it approaches zero. The solution provided is to use the built-in function Chop[x], which effectively sets small imaginary components to zero. Additionally, users can define a custom threshold using Chop[expr, delta] to determine when to consider a number as zero. This method enhances the efficiency of subsequent calculations involving complex expressions.

PREREQUISITES
  • Familiarity with complex numbers and their representations.
  • Basic understanding of Mathematica syntax and functions.
  • Knowledge of numerical thresholds and their applications in programming.
  • Experience with mathematical simplifications in computational tools.
NEXT STEPS
  • Explore the Chop function in Mathematica documentation for advanced usage.
  • Learn about custom thresholding techniques in numerical computing.
  • Investigate other Mathematica functions for handling complex numbers, such as Re and Im.
  • Research best practices for optimizing calculations involving complex numbers in computational environments.
USEFUL FOR

Mathematics students, computational scientists, and software developers working with complex numbers in Mathematica or similar computational tools.

matteo.bina
Messages
2
Reaction score
0
Dear all,
I'm fighting against complicated expressions which contain complex numbers that, after some calculations and simplifications, appear in a form like: 1. + 0.I. I think that this weighs down the next calculations.
The question is: how can I put zero the imaginary part? or, in general, how can I set a threshold for a number under which it must be considered as zero?
Thank you very much!

Teo
 
Physics news on Phys.org
Looking at your notation, I suspect you are talking about Mathematica?
In that case, you could try
Code:
Chop[x]
You can also set your own threshold, with Chop[expr, delta].
 
Ok...thank you very much!
I was absolutely convinced to have put the Mathematica reference...I've learned: never to be convinced!
Thanks again...I will try!
 

Similar threads

  • · Replies 24 ·
Replies
24
Views
7K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 19 ·
Replies
19
Views
3K
Replies
7
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K