# What's wrong with Simplify and FullSimplify?

I have a quite complex list of equations and inequalities I combine to a boundary condition for my cost function. After investigation of two days I found the bug (I really name it a bug!). One of my equations gets simplified to False, which is not the desired result!

This is one inequality which drives me crazy!

eq = 0.0055356626 + 0.000029 x + 0.000034 y <= 1000.;


All coefficients are machine numbers:

MachineNumberQ /@ Select[Level[eq, {-1}], Head[#] == Real &]
(* {True, True, True, True} *)


Because my variables are real numbers and greater than zero, I have added this assumption to my list of inequalities and equations.

On my system (Win7,64bit, Mathematica 10.1.0 for Microsoft Windows (64-bit) (March 24, 2015))

Simplify[eq, Assumptions -> {x>0, y>0}]


yields False!

Simplify[eq]


just yields 1. x+1.17241 y<=3.44826*10^7, which is ok.

I have tried different settings for ComplexityFunction, but I still get False!

Running

TableForm@Table[Simplify[eq/.x_Real:>n*x,Assumptions->{x>0,y>0}],{n,1,20}]


gives an interesting result:

False
False
False
False
1. x+1.17241 y<=3.44826*10^7
False
False
False
1. x+1.17241 y<=3.44826*10^7
1. x+1.17241 y<=3.44826*10^7
False
False
True
False
True
False
True
1. x+1.17241 y<=3.44826*10^7
True
1. x+1.17241 y<=3.44826*10^7


I really don't understand this! What can I do? Is there something totally wrong with my equation setup?

I have restarted the Kernel twice and tested this on two computers: I get the same result.

Could anyone please verify this on other OS and version? Thanks!

UPDATE

Wolframalpha also shows False, but the evaluation seems to involve complex numbers:

UPDATE 2

Using the Assumption {x>=0, y>=0} is working fine ?!

• V8 returns True, and V9 and V10 return False (Win8.1-64). IMHO the result should be neither True nor False. Looks like a bug indeed. Have you contacted support@wolfram.com? – Sjoerd C. de Vries Jul 1 '15 at 16:16
• Not yet. I will contact them soon. BTW, FullSimplify gives the same result. – akm Jul 1 '15 at 16:31
• Confirmed on Linux. v8.0 gives True, v9.0, 10.0, 10.1 gives False. – jkuczm Jul 1 '15 at 22:39
• Note that Refine[eq, {x>0, y>0}] gives slightly different results, and not all correct. Another workaround seems to be to use arbitrary precision numbers: N@Simplify[SetPrecision[eq, $MachinePrecision], Assumptions -> {x > 0, y > 0}]. (V10.1, Mac OSX) – Michael E2 Jul 2 '15 at 3:45 • Support case #3373364 – akm Jul 2 '15 at 6:46 ## 1 Answer Extended comment: $Version


"10.1.0 for Mac OS X x86 (64-bit) (March 24, 2015)"

eq = 0.0055356626 + 0.000029 x + 0.000034 y <= 1000.;

eq // Simplify

1. x + 1.17241 y <= 3.44826*10^7

Use of assumptions reproduces the problem:

Simplify[eq, {x > 0, y > 0}]


False

However, use of Rationalize avoids the problem with using assumptions

Simplify[eq // Rationalize[#, 0] &, {x > 0, y > 0}]


616842869 (29 x + 34 y) <= 616839454366000000

Which is equivalent to the original

% // N // Simplify

1. x + 1.17241 y <= 3.44826*10^7
• Thanks for your suggestion. It's easier for me to add the SetPrecision approach from Michael E2 to my specific problem, but your answer is totally correct. In parallel, I will wait for the support case to be finished. – akm Jul 6 '15 at 12:51