In this blog post, we explore incorrect calculations of the secant function sec(x) in MATLAB near numbers around
Example 1. Given that
and
calculate
and
in MATLAB.
Using MATLAB, we computed the values of and The result is shown in the following screenshot.
From the above screenshot, it can be seen that the outputs from MATLAB are
and
, respectively.
However, the correct values with 16 significant digits are 0.4105556037464873e9 and 0.3670813182326778e13, respectively (as provided by ISRealsoft).
Thus, the output of MATLAB contains only 6 and 1 correct digits, with error rates of (16-6)/16 = 62.5% and (16-1)/16 = 93.75% respectively for the significant figures.
Top comments (0)