Ask Your Question
1

arcsin() return value with tiny imaginary part ?

asked 2020-11-08 06:41:23 -0600

ortollj gravatar image

updated 2020-11-08 06:43:47 -0600

Hi

where does this imaginary small quantity come from ?

SageMath notebook 9.1 W10

show(arcsin(sqrt(2)*sqrt(1/2)).n()) 

show(arcsin(sqrt(2)*sqrt(2^(-1))).n())

show(arcsin(sqrt(2)/sqrt(2)).n(),"\t ok no small imaginary part")
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2020-11-08 11:56:27 -0600

Florentin Jaffredo gravatar image

updated 2020-11-08 11:56:56 -0600

It comes from machine precision. sqrt(2)*sqrt(1/2) is slightly bigger than one. In fact sqrt(2)*sqrt(1/2)-1 returns 2.22044604925031e-16 on my computer, instead of zero. To avoid the issue, you can simply replace .n() by .simplify().n().

edit flag offensive delete link more

Comments

Hi Florentin

but arcsin((2.22044604925031e-16)).n() does not have tiny imaginary part .

ortollj gravatar imageortollj ( 2020-11-08 13:18:40 -0600 )edit

You forgot the +1. Arcsin is a complex (multivalued) function outside $[-1, 1]$. Try to compute arcsin(1+1/1000). (Also It's not accepting floats, since reals values outside the interval define a branch cut, you can find the plots on wikipedia).

Florentin Jaffredo gravatar imageFlorentin Jaffredo ( 2020-11-09 01:56:48 -0600 )edit

Thank you Florentin

ortollj gravatar imageortollj ( 2020-11-10 01:26:32 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-11-08 06:41:23 -0600

Seen: 62 times

Last updated: Nov 08