4
$\begingroup$

Is it possible to get the following result in Mathematica by using only built-in functions:

$$\arcsin( \sin(x)) = x $$ if $x \in [-\pi /2 , \pi/2]$

$$\arcsin ( \sin(x)) = \pi - x $$ if $x \in [\pi /2 , 3\pi/2]$

$\endgroup$
  • $\begingroup$ This should be reported as a bug, since ArcSin[Sin[x]] is correctly not simplified to x, whereas, as you note above, Sin[ArcSin[x]] is. $\endgroup$ – barrycarter Jan 8 at 18:26
6
$\begingroup$

We can take the Floor and Ceiling from Carl's answer and expand them out:

PiecewiseExpand[
  PowerExpand[ArcSin[Sin[x]], Assumptions -> x ∈ Reals], 
  -π/2 < x < 3π/2
]

enter image description here

Edit

As it turns out, we can just pass the interval into PowerExpand:

PowerExpand[ArcSin[Sin[x]], Assumptions -> -π/2 < x < 3π/2]

enter image description here

$\endgroup$
  • $\begingroup$ Hello @ChipHurst, can you tell me why in the second line of the output there is True instead of "-pi/2<=x<=pi/2" please? $\endgroup$ – Gennaro Arguzzi Nov 7 '18 at 4:50
  • 1
    $\begingroup$ We told PiecewiseExpand that our domain is restricted to -π/2 < x < 3π/2. Under this constraint, x > π/2 corresponds to π/2 < x < 3π/2 and True (I always read as 'otherwise' here) corresponds to -π/2 < x <= π/2. $\endgroup$ – Chip Hurst Nov 7 '18 at 12:57
  • $\begingroup$ thank you very much for your elegant solution. $\endgroup$ – Gennaro Arguzzi Nov 7 '18 at 16:04
4
$\begingroup$

@kglr was on the right track with PowerExpand. With the default option Assumptions->Automatic, Mathematica may return a result that is not valid. On the other hand, if you give PowerExpand a non-default assumption, then it will return a result valid given those assumptions. So, for your example:

Assuming[
    x ∈ Reals,
    Simplify @ PowerExpand[ArcSin[Sin[x]], Assumptions -> x ∈ Reals]
]

1/2 (-1)^(Ceiling[1/2 + x/π] + Floor[-(1/2) + x/π] + Floor[1/2 + x/π]) (π + (-1)^( Ceiling[1/2 + x/π] + Floor[1/2 + x/π]) π + 2 x - 2 π Floor[1/2 + x/π])

$\endgroup$
  • $\begingroup$ Hello @CarlWoll, I have some difficult to interpret the solution. Can you explain me how it is related to the solution which I expected (the one in the question) please? $\endgroup$ – Gennaro Arguzzi Nov 7 '18 at 4:52
  • $\begingroup$ I am a bit puzzled by this solution; I would never have found it myself. My idea about PowerExand is that it has to do with expansion of powers and nothing with inverse trigonometric functions. Is there a mathematical or Mathematica reason that I should think of using PowerExpand for problems like these? $\endgroup$ – Fred Simons Nov 7 '18 at 8:53
0
$\begingroup$

Answer to the first question

Simplify[x == ArcSin[Sin[x]], -Pi/2 <= x <= Pi/2]
(* True *)
$\endgroup$
  • $\begingroup$ Hello @UlrichNeumann, if possible i'd like to avoid to specify the range -Pi/2 <= x <= Pi/2. I prefer a more general statement because the above one is valid also for instance when Simplify[x == ArcSin[Sin[x]], 0 <= x <= Pi/2] $\endgroup$ – Gennaro Arguzzi Nov 6 '18 at 20:54
  • $\begingroup$ @Gennaro Arguzzi You want to prove ArcSin[Sin[x]]=="triangle function"? $\endgroup$ – Ulrich Neumann Nov 6 '18 at 21:00
  • $\begingroup$ I'm looking for built-in functions that allow me to "simplify" arcsin(sin(x)). $\endgroup$ – Gennaro Arguzzi Nov 6 '18 at 21:07
0
$\begingroup$

An easy way is to define a new function sin which will work as intended:

sin /: (ArcSin[sin[x :(_Real | _Integer| _Rational)]]
        /;-(Pi/2)<=Mod[x, 2 Pi, -Pi/2] <= Pi/2) := x;
sin /: (ArcSin[sin[x :(_Real | _Integer| _Rational)]]
        /; Pi/2<Mod[x, 2Pi,-Pi/2] < (3 Pi)/2) := Pi - x;
sin[x_] := Sin[x];

I intentionally restricted to real numbers (why I used heads Real, Integer, and Rational) so that I can use Mod.

Instead of trying to convert each Sin to sin, we can automate it by

$Pre = Function[# /. Sin -> sin];

Now, we do not have to do anything: The code works as expected. For example

Plot[ArcSin[Sin[x]], {x, -Pi, 3 Pi}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.