Post Reply 
CAS simplifying non-zero expressions to 0
10-06-2014, 10:12 AM (This post was last modified: 10-06-2014 10:23 AM by kickniko.)
Post: #1
CAS simplifying non-zero expressions to 0
Working with a rather lengthy rational quotient of polynomials with numeric coefficients I just encountered a problem in the CAS. Simplifying the quotient just wiped out powers with small coefficients. I didn't even notice that at first, since the disappearing powers were way off screen to the right. It was only afterwards (after two hours work!), trying a plot of the simplified expression, when I saw that something probably went astray, since the behavior of the plot for big values of X was completely wrong. (It should fall with growing X but it was rising.) So the whole work inbetween was in vain.

Searching for the reason of this behavior I tried to simplify one of the powers in the denominator of the original expression using:

simplify(6.0929985e-32*Cvar^2*Omega^8)

The result was 0. (Omega denotes the capital greek letter omega here.) There is nothing stored in variables Cvar and Omega.

I tried tinkering around with epsilon (down to 1e-200) and it did not help.

Then I tried

exact(6.0929985e-32*Cvar^2*Omega^8)

and it returned

0*Cvar^2*Omega^8

Even exact(6.0929985e-32) returns 0, no matter of epsilon and/or Exact/Approx setting of the CAS.

So it seems that simplify tries first to "exactify" the numeric coeffs, which just returns 0 for small numbers that do not fit its plan? Is this is the reason for simplifying the non-zero sub-expressions to 0? Undecided

Anyway, expanding the expression worked OK and all powers remained intact. (This is important since Omega is of order of 10^6 and more here.)

So, is it better to not use simplify when small but still important floats are involved? Are there any other similar caveats that we should be aware of?

Ciao,

Nick

P.S.: Bummer! Unfortunately even expanding does not do my job since it returns an expression which looks right, but with which I cannot do anything anymore. Whatever I try to do with that I get a syntax error. Just tried to substitute X for Omega in order to plot it, and it complains about syntax. Same behavior when I just try to copy the result of expand into the command line. So, what do I do?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
CAS simplifying non-zero expressions to 0 - kickniko - 10-06-2014 10:12 AM



User(s) browsing this thread: 1 Guest(s)