Incorrect calculations: csc(x) near x=k*π

In this blog post, we explore incorrect calculations of the cosecant function csc(x) in MATLAB near numbers around

k π.
k\,\pi.
kπ.

Example 1. Given that

x1=0.942477796123e1≈3 π
x_1=0.942477796123\textup{e}1 \approx 3\,\pix1​=0.94247779…


This content originally appeared on DEV Community and was authored by Caleb Zhao

In this blog post, we explore incorrect calculations of the cosecant function csc(x) in MATLAB near numbers around k π. k\,\pi. kπ.

Example 1. Given that x1=0.942477796123e1≈3 π x_1=0.942477796123\textup{e}1 \approx 3\,\pix1=0.942477796123e13π and
x2=0.7853981633974e2≈25 π ,x_2=0.7853981633974\textup{e}2 \approx 25\,\pi\,, x2=0.7853981633974e225π, calculate csc⁡(x1) \csc(x_1) csc(x1) and csc⁡(x2) \csc(x_2) csc(x2) in MATLAB.

Using MATLAB, we computed the values of csc⁡(x1) \csc(x_1) csc(x1) and csc⁡(x2). \csc(x_2). csc(x2). The result is shown in the following screenshot.

MATLAB outputFrom the above screenshot, it can be seen that the outputs from MATLAB are
−2.170988725424315e+09-2.17098\red{8725424315}\textup{e}+092.170988725424315e+09 and 2.069879330499836e+11 2.069\red{879330499836}\textup{e}+112.069879330499836e+11 , respectively.

However, the correct values with 16 significant digits are -0.217098558923038e10 and 0.2069981278717736e12, respectively (as provided by ISRealsoft).

Thus, the output of MATLAB contains only 6 and 4 correct digits, with error rates of (16-6)/16 = 62.5% and (16-4)/16 = 75% respectively for the significant figures.

previous


This content originally appeared on DEV Community and was authored by Caleb Zhao


Print Share Comment Cite Upload Translate Updates
APA

Caleb Zhao | Sciencx (2024-11-12T02:20:34+00:00) Incorrect calculations: csc(x) near x=k*π. Retrieved from https://www.scien.cx/2024/11/12/incorrect-calculations-cscx-near-xk%cf%80/

MLA
" » Incorrect calculations: csc(x) near x=k*π." Caleb Zhao | Sciencx - Tuesday November 12, 2024, https://www.scien.cx/2024/11/12/incorrect-calculations-cscx-near-xk%cf%80/
HARVARD
Caleb Zhao | Sciencx Tuesday November 12, 2024 » Incorrect calculations: csc(x) near x=k*π., viewed ,<https://www.scien.cx/2024/11/12/incorrect-calculations-cscx-near-xk%cf%80/>
VANCOUVER
Caleb Zhao | Sciencx - » Incorrect calculations: csc(x) near x=k*π. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/11/12/incorrect-calculations-cscx-near-xk%cf%80/
CHICAGO
" » Incorrect calculations: csc(x) near x=k*π." Caleb Zhao | Sciencx - Accessed . https://www.scien.cx/2024/11/12/incorrect-calculations-cscx-near-xk%cf%80/
IEEE
" » Incorrect calculations: csc(x) near x=k*π." Caleb Zhao | Sciencx [Online]. Available: https://www.scien.cx/2024/11/12/incorrect-calculations-cscx-near-xk%cf%80/. [Accessed: ]
rf:citation
» Incorrect calculations: csc(x) near x=k*π | Caleb Zhao | Sciencx | https://www.scien.cx/2024/11/12/incorrect-calculations-cscx-near-xk%cf%80/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.