Hello,
> De : Federico Miyara
> Envoyé : mardi 29 janvier 2019 21:36
>
> This is an improved version of the acos function with input argument check:
I would personally write it in the following way:
function y=acos1(x)
// Check if components are real
// Check if components are real and belong to [-1, 1]
absx = abs(x);
in_domain = (imag(x)==0) & (-1<=absx) & (absx<=1);
// Imaginary part of acos(x) is accepted only if
// x does not belong to [-1, 1]
y=acos(x);
y(in_domain) = real(y(in_domain));
endfunction
Regards
--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
Public
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error), please
notify the sender immediately and destroy this e-mail. Any unauthorized
copying, disclosure or distribution of the material in this e-mail is strictly
forbidden.
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users