0
$\begingroup$

In an array of steps including logarithms and integrations, I am finding the problem of small imaginary parts of some o/p's which are complicating/inhibiting the further steps.

I found that "Chop" function can take care of these issues. My problem is that in a complex array with more than hundred equations, it is not possible to find which step is creating the small imaginary part problem, specially when my I/p's are variables.

Is there a way by which we can tell Mathematica that there is no possibility of any complex number o/p on any step and hence do "Chop" kind of operation on the whole file.

thanks in advance

$\endgroup$
4
  • $\begingroup$ Threshold will probably be more efficient, but in any case Chop and Threshold are Listable, which means they'll automatically apply to every element in a list very efficiently. Just try applying them to all of your data at once. $\endgroup$
    – b3m2a1
    Oct 18 '18 at 7:15
  • $\begingroup$ Thanks. I never came across the function how can I use say, Threshold for the whole file. $\endgroup$
    – user49535
    Oct 18 '18 at 7:37
  • $\begingroup$ Literally just apply it to the data you get out of the file all at once. You get an array of data from your Import or ReadList or whatever. Then use Threshold directly on that. $\endgroup$
    – b3m2a1
    Oct 18 '18 at 7:41
  • $\begingroup$ maybe $Pre: i.e., $Pre = Chop? as the first line in the notebook and $Pre =. as the last line? $\endgroup$
    – kglr
    Oct 18 '18 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.