In this blog post, we explore incorrect calculations of the cosine function cos(x) in MATLAB near numbers around
k π+π2.
k\,\pi+\frac{\pi}{2}.
kπ+2π.
Example 1. Given that
x1=0.392699082e2≈12 π+π2
x_1=0.392699082\textup{e}2\approx 12\,\pi+\frac{\pi}{2}x1=0.392699082e2≈12π+2π
and
x2=0.1115265392024e3≈35 π+π2 ,x_2=0.1115265392024\textup{e}3\approx 35\,\pi+\frac{\pi}{2}\,,
x2=0.1115265392024e3≈35π+2π,
calculate
cos(x1)
\cos(x_1)
cos(x1)
and
cos(x2)
\cos(x_2)
cos(x2)
in MATLAB.
Let's just post the figure directly.
).
Thus, the outputs of MATLAB contain 9 and 12 incorrect digits, with error rates of 9/16 = 56.25% and 12/16 = 75% respectively for the significant figures.
SOCIAL SHARE CARD GENERATOR