For some reason, these two arguments are not equal...
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hey everyone,
I do have a bit of a weird issue right now. I am currently on a project and I have got these arguments:
L0 = - (50*x^3)/21 + (50*x^2)/7 - (269*x)/42 + 11/7 and the L0 from the "Solutions" which is actually : -1/0.42*(x^3-3*x^2+2.69*x-0.66)
These two equations are perfeclty equals, in fact whenever I apply the function "isequal", it gives me as an outcome 1.
However whenever I try to multiply both of them with a value y0 (which is 1.6094) they are completely different and totally not equal. My question now is how ???? And also, is there perhaps a way in Matlab to make my L0 look like the L0 from the actualy solution?
Thanks in advance !
5 Kommentare
dpb
am 15 Mai 2022
Have to show us the exact code that gives an unexpected result -- they evaluate to the same numerically within machine precision if write a function as
fnD=@(x)L0(x)-LS(x);
where L0 and LS are anonymous functions of the two expressions above.
Multiplying either by a constant will again produce the same difference times that constant.
It's possible you made a typo in one place, perhaps??? When first cut 'n pasted the above text to build the comparison function, somehow a "-" got inserted in one of the expressions extraneously instead of the "*" which did produce bizarre results until I finally saw the mistake. Anything like that possibly the problem there, maybe???
Jan
am 15 Mai 2022
@LUCA GIROTTI: Please post the code, which reproduces your observation. Then we can search for the difference.
"they are completely different and totally not equal." - Luckily they are not just a little bit not equal ;-)
Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!