On 31/07/2020 15:59, Mikhael Myara wrote:
Perhaps my example was not clear enough. I start with a fully symbolic expression. Then, I try two things :
- ask a simplify on the fully symbolic expression, that works well,
- replace  some symbols in the initial expression and then simplify.

The first step shows that a simplified expression exists, and replacing by values  may not change this fact (it can lead to an even more simplified expresssion isn'nt it ?).

I do not understand why Sympy cannot simplify at all the initial expression when symbols are replaced by values, whereas we know that a simplified expresssion exists as Sympy itself found it from the fully symbolic version.

My guess would be that due to rounding errors, when the floating point numbers get combined - added or subtracted etc. those rounding errors make what would be exact matches become inexact. For example A-B+B might be slightly different from A. Put another way, floating point numbers don't (quite) obey the laws of arithmetic!

I would definitely advise that you work with symbols and integers until you are ready to substitute floating point numbers.

I can't quite see why you would want to substitute and then simplify.

David

--
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/4747234e-c1a7-8eb9-c3fb-5f929facca49%40dbailey.co.uk.

Reply via email to