%mathpiper,def="ArcSin"

2 # ArcSin(x_IsNumber)_(InNumericMode() And Abs(x)<=1) <-- ArcSinNum(x);
/// complex ArcSin
3 # ArcSin(x_IsNumber)_InNumericMode() <-- Sign(x)*(Pi/2+I*ArcCosh(x));

110 # ArcSin(Complex(_r,_i)) <--
    (- I) * Ln((I*Complex(r,i)) + ((1-(Complex(r,i)^2))^(1/2)));

150 # ArcSin(- _x)_(Not IsConstant(x))             <-- -ArcSin(x);
160 # (ArcSin(x_IsConstant))_(IsNegativeNumber(N(Eval(x)))) <-- -ArcSin(-x);

200 # ArcSin(0) <-- 0;
200 # ArcSin(1/2) <-- Pi/6;
200 # ArcSin(Sqrt(1/2)) <-- Pi/4;
200 # ArcSin(Sqrt(3/4)) <-- Pi/3;
200 # ArcSin(1) <-- Pi/2;
200 # ArcSin(_n)_(n = -1) <-- -Pi/2;
200 # ArcSin(_n)_(-n = Sqrt(3/4)) <-- -Pi/3;
200 # ArcSin(_n)_(-n = Sqrt(1/2)) <-- -Pi/4;
200 # ArcSin(_n)_(-n = 1/2) <-- -Pi/6;

ArcSin(xlist_IsList) <-- MapSingle("ArcSin",xlist);

200 # ArcSin(Undefined) <-- Undefined;

%/mathpiper



%mathpiper_docs,name="ArcSin",categories="User Functions;Trigonometry (Symbolic)"
*CMD ArcSin --- inverse trigonometric function arc-sine
*STD
*CALL
	ArcSin(x)

*PARMS

{x} -- argument to the function

*DESC

This function represents the inverse trigonometric function arcsine. For
instance, the value of $ArcSin(x)$ is a number $y$ such that
$Sin(y)$ equals $x$.

Note that the number $y$ is not unique. For instance, $Sin(0)$ and
$Sin(Pi)$ both equal 0, so what should $ArcSin(0)$ be? In MathPiper,
it is agreed that the value of $ArcSin(x)$ should be in the interval
[-$Pi$/2,$Pi$/2]. 

Usually, MathPiper leaves this function alone unless it is forced to do
a numerical evaluation by the {N} function. If the
argument is -1, 0, or 1 however, MathPiper will simplify the
expression. If the argument is complex,  the expression will be
rewritten using the {Ln} function.

This function is threaded, meaning that if the argument {x} is a
list, the function is applied to all entries in the list.

*E.G.

In> ArcSin(1)
Result: Pi/2;
	
In> ArcSin(1/3)
Result: ArcSin(1/3);
In> Sin(ArcSin(1/3))
Result: 1/3;
	
In> x:=N(ArcSin(0.75))
Result: 0.848062;
In> N(Sin(x))
Result: 0.7499999477;

*SEE Sin, Cos, Tan, N, Pi, Ln, ArcCos, ArcTan
%/mathpiper_docs
