If I define a function using
alpha[y_, d_] := 2 ArcCos[1 - (2 y)/d]
Then if $y$ and $d$ are equal, the result is $2\pi$ :
alpha[x, x]
and
alpha[4, 4]
are both evaluated as
$2 \pi$
But when I use this in a table with:
Table[alpha[y1, d1], {d1, 0.1, 5, 0.1}, {y1, 0, d1, 0.1}]
Some imaginary parts (although very small) for example $6.28319 - 5.96046*10^-8 i$ appear. Am I doing something wrong? It seems like something basic that I am doing wrong because of not understanding a concept in MMA.
Table
are approximate your problem appears to be trivial. Nevertheless if there is a certain problem at all, it was raised in his question How to eliminate the zero real part of a purely imaginary number?. The issue is version dependent. $\endgroup$Table[]
that's doing the approximation; it's your use of0.1
in the iterator. Try replacing all those with1/10
, and applyN[]
afterwards. $\endgroup$0.1
resulted in everything being done in machine precision. $\endgroup$