Simplify produces an incorrect result.

asked 2014-02-19 20:39:21 +0200

jcfried gravatar image

I am using sagemath.com for this test on 19 Feb 2014. I applied Simplify to

C = ((((K - 1)*L*sin(-(K - 1)*t/K) + (K - 1)) *
        ((K - 1)^2*L*sin(-(K - 1)*t/K)/K + (K - 1)*sin(t))) - 
         ((K - 1)*L*cos(-(K - 1)*t/K) - (K - 1)*cos(t)) *
         (-(K - 1)^2*L*cos(-(K - 1)*t/K)/K + (K - 1)*cos(t)))
     / ((((K - 1)*L*sin(-(K - 1)*t/K) + (K - 1)*sin(t))^2 +
       ((K - 1)*L*cos(-(K - 1)*t/K) - (K - 1)*cos(t))^2)^(3/2))

The result returned is about 10 times too small and the peaks shift position as K is increased toward 1. K and L are parameters that should be within (0,1). Plot with K = 0.42 and L = 0.22 in Sagemath demonstrates the problem.

Cs = ((K - 1)*L*cos((K - 1)*t/K) - (K - 1)*cos(t)) *
((K - 1)^2*L*cos((K - 1)*t/K)/K - (K - 1)*cos(t)) + 
((K - 1)*L*sin((K - 1)*t/K) - K + 1) *
((K - 1)^2*L*sin((K - 1)*t/K)/K - (K - 1)*sin(t))

As K approaches 0, the results more closely agree. Is this possibly a roundoff problem because of the numerator in C?

I verified the difference between the two using both Sagemath.com plot and Geogebra.

edit retag flag offensive close merge delete

Comments

After examining the denominator of C carefully i've come to the conclusion this is not a problem with roundoff. If i can figure out how to edit my original statement, i will remove that suggestion.

jcfried gravatar imagejcfried ( 2014-02-19 20:53:05 +0200 )edit

Can you put the entire session here? `C.simplify()` doesn't seem to really change things except rearrange terms. `C.simplify_full()` gives quite a different result. Is it possible that your `Cs` is only the numerator and this is why it's different from `C`?

kcrisman gravatar imagekcrisman ( 2014-02-19 22:22:38 +0200 )edit

There should be an "edit" button just under the tags you can click to edit your post.

kcrisman gravatar imagekcrisman ( 2014-02-19 22:22:59 +0200 )edit