Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,125 Was thanked: 506 time(s) in 337 post(s)
|
I had encountered this issue last night and tried to simplify it here. Some equalities are not resulted as "1" but they should be. If I use eval() they are calculated correctly. Should I have to use eval() everytime to be sure of boolean calculations? Below you can find the issue as an example. Regards equality.sm (32kb) downloaded 8 time(s).Edited by user 11 March 2021 13:29:47(UTC)
| Reason: Not specified
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,868 Was thanked: 980 time(s) in 808 post(s)
|
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,868 Was thanked: 980 time(s) in 808 post(s)
|
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Originally Posted by: overlord I had encountered this issue last night and tried to simplify it here. Some equalities are not resulted as "1" but they should be. If I use eval() they are calculated correctly. Should I have to use eval() everytime to be sure of boolean calculations? Below you can find the issue as an example.
Regards
Hi overlord. Usually it's hard to check equalities in math programs. For example, check the issues in Wolfram Mathematica (this picture is from https://reference.wolfra.../language/ref/Equal.html ): For numeric testing I use Best regards. Alvaro.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,868 Was thanked: 980 time(s) in 808 post(s)
|
Originally Posted by: Razonar Hi overlord. Usually it's hard to check equalities in math programs. That was discussed few months ago ... ULP ULP in short: Unit (floating numerical) in Last Place Well explained in Mathematica 4.0 ... Floating maths are granularHola Alvaro !
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,125 Was thanked: 506 time(s) in 337 post(s)
|
Originally Posted by: Razonar Hi overlord. Usually it's hard to check equalities in math programs. Best regards. Alvaro. You are right about arbitrary precision and how computers store numbers, my bad. But I can't still understand the behavior of SMath in the example below. As you can see, sqr(3) * sqr(12) = 6. Obviously sqr(36) = 6 too. But if you subtract them inline, result is not zero unless they are attached to a variable. When the subtract is assigned to variable c calculation is still not zero. However if you assign them to a and b, subtraction is magically zero again. All calculations are set to numerical optimization with SMath by the way. What I am trying to say, there is an inconsistency between calculations and results. What I would expect is all answers to be zero or -8.8818x10^-16. Not to differentiate between expressions. maple() doesn't suffer from this issue. I have also checked with Wolfram Mathematica 8.0, no matter how I enter result is always 0. WolframAlpha is showing -8.8818x10^-16 during expression entry but resulted as zero when you press enter. Regards
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,868 Was thanked: 980 time(s) in 808 post(s)
|
Originally Posted by: overlord Not to differentiate between expressions. Never mind systems that reply to please. Numerical maths are of no commerce.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,868 Was thanked: 980 time(s) in 808 post(s)
|
... in Smath, zero [0] is undefined. I commented that in my early 2015 Smath, not acknowledged. From recollection in 1990, IEEE was discussing what zero [0] should be valued ... ± agreed 10^-12. Since, I lost track and after all don't bloody care for a dime. In there, insert 0 to turn Bolean 1.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,868 Was thanked: 980 time(s) in 808 post(s)
|
... all that equality reflects in practical projects. Take care Overlord ... Jean Solve Difficult.sm (10kb) downloaded 5 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Hi overlord. Originally Posted by: overlord But I can't still understand the behavior of SMath in the example below. As you can see, sqr(3) * sqr(12) = 6. Obviously sqr(36) = 6 too. But if you subtract them inline, result is not zero unless they are attached to a variable. When the subtract is assigned to variable c calculation is still not zero. However if you assign them to a and b, subtraction is magically zero again. All calculations are set to numerical optimization with SMath by the way.
What I am trying to say, there is an inconsistency between calculations and results. What I would expect is all answers to be zero or -8.8818x10^-16. Not to differentiate between expressions. ...
SMath convert all numbers to an internal rational representation. This is why, in my opinion, you get different answers doing the roots in one line than store partial results into variables. Originally Posted by: overlord ... maple() doesn't suffer from this issue.
Yes, it have the same issue, but you can't see it inside the maple plugin, because SMath parse values as exact rationals. In maple you can use a dot for indicate floating point numbers Originally Posted by: overlord
I have also checked with Wolfram Mathematica 8.0, no matter how I enter result is always 0.
It's harder to show the same behavior in Mathematica, but you can see it with some other numbers and floating point operations Hope that this notes helps. Best regards. Alvaro.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.