Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm getting a huge output, but it appears that almost every term should actually be zero, unless I'm misunderstanding the expression.

For example, part of the output reads

a (0.25 + 0. b) + b^2 (0. + 0./c) + b (-1. + 0. c) - 0.5 c + (b (-1. b - 0.5 c) c)/a^2

Simplify and FullSimplify won't get rid of these zero terms even with assumptions that a,b and c are real and non-zero. Suggestions ?

share|improve this question
    
expr /. {x_Real /; x==0 -> 0} –  ssch Oct 28 '13 at 17:32
6  
Examine the FullForm of the result. You may be surprised. Chop is useful too. –  Sjoerd C. de Vries Oct 28 '13 at 17:33
    
SetOptions[Simplify, TransformationFunctions :> Function[x, x //. {0. -> 0, 1. y_ :> y, -1. y_ :> y}]] and then Simplify simplifies as you want. –  Rolf Mertig Oct 28 '13 at 18:29
    
@RolfMertig. I think you meant to write -1. y_ :> -y –  RunnyKine Oct 28 '13 at 20:15
    
@RunnyKine : sure. thanx. –  Rolf Mertig Oct 28 '13 at 22:27

1 Answer 1

To get what was said in the comments on record as an answer.

Chop is probably what you are looking for.

expr = 
  a (0.25 + 0. b) + b^2 (0. + 0./c) + b (-1. + 0. c) - 0.5 c + 
   (b (-1. b - 0.5 c) c)/a^2 // Chop
0.25 a - 1. b - 0.5 c + (b (-1. b - 0.5 c) c)/a^2

You might want to go further

expr = expr /. {1. x_ :> x, -1. x_ :> -x}
0.25 a - b - 0.5 c + (b (- b - 0.5 c) c)/a^2
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.