# Inverse Function question

#### R_W_B

I'm retired and write computer programs as a hobby.

I'm not up on calculus, only had algebra & trig years ago. But I've written a computer program to calc the sin of an angle using the (I think) Taylor series. Anyhow it works as I checked my answers with online calcs.

Now I want to write a program to find the arcsin which would be the inverse.

I've searched and see a lot of number formulas that don't give me the logistics to write code with.

Trying to find the inverse function of

sin(x) = x - x^n/n! + x^n/n! - x^n/n! +.... -infinity < x < infinity
or if it makes it simplier,
sin(x) = x - x^3/6 + x^5/120 - x^7/5040

I.e. I need the inverse of the above with something that would allow me to see how the denominator is figured in the inverse function. Cause some of the inverse samples I've seen don't seem to all be factorials of n.

Can anybody help with this?

#### romsek

Math Team
$\arctan(x) = \sum \limits_{k=0}^\infty~(-1)^k \dfrac{x^{2k+1}}{2k+1}$

#### R_W_B

$\arctan(x) = \sum \limits_{k=0}^\infty~(-1)^k \dfrac{x^{2k+1}}{2k+1}$
Thanks for that, but I'm not smart enough to integrate (or expand ) that into something I can write code from. I did look around and find this,
d/dx(sin-1x) 1/SqRt of 1-x^2
sin-1x = integral symbol
= (1-x^2)^1/2 dx + c (constant)
= 1 + x^2/2 + 3x^4/8 + 5x^6/16 + ... + c
= x + 1/2 * x^3/3 + 1/2 * 3/4 * x^5/5 + 1/2 * 3/4 * 5/6 * x^7/7 + ... + c
with sin-1 = 0 at x =0 =>C = 0
sin-1x would then =
x + 1/2 * x^3/3 + 1/2 * 3/4 * x^5/5 + 1/2 * 3/4 * 5/6 * x^7/7 + ...,|x| < 1

And it obviously is expanded (integrated ?) and the exponet values seem to increment by 2 but I don't really understand how they arrived at the denominators. Do I have to learn calculus to understand this or can it be said in simple terms ?

#### romsek

Math Team
it's just

$\arctan(x) = x - \dfrac {x^3}{3} + \dfrac{x^5}{5} - \dfrac{x^7}{7} + \dots$

#### R_W_B

it's just

$\arctan(x) = x - \dfrac {x^3}{3} + \dfrac{x^5}{5} - \dfrac{x^7}{7} + \dots$
Thanks!, but uh well I still need a bit of help. I just now realized that's the arctan(x) instead of the arcsin(x). I originally asked for the inverse of the sin(x).

Is the arctan(x) the inverse of the sin(x) ?

But running with what you gave could you please give me some input on your 1st reply inverse function depiction. I.e. does the (-1)k multiply the entire (x^2k + 1 / 2k+1) ?
as in (-1)k * (x^2k + 1 / 2k+1) (I don't know how to print symbols like you had it)

When looking at depictions I've seen of function expressions, the parts are placed so close. But I assume it's the same as regular algebra expressions when there is no . (dot) or multiplication symbol it's assumed multiplication, correct ?

Also if you would be so kind, could you show me the steps you did to expand that function? It might help me grasp some of the concept in function depictions.

#### romsek

Math Team
Thanks!, but uh well I still need a bit of help. I just now realized that's the arctan(x) instead of the arcsin(x). I originally asked for the inverse of the sin(x).
oh, I don't know why I read that as arctan().

$\arcsin(x)$ has a fairly complicated series

$\arcsin(x) = \sum \limits_{n=0}^\infty~\dfrac{(2n)!}{2^{2n}(n!)^2(2n+1)}x^{2n+1}$

You can view a derivation here if you like.

#### R_W_B

oh, I don't know why I read that as arctan().

$\arcsin(x)$ has a fairly complicated series

$\arcsin(x) = \sum \limits_{n=0}^\infty~\dfrac{(2n)!}{2^{2n}(n!)^2(2n+1)}x^{2n+1}$

You can view a derivation here if you like.
Thanks! You've been a big help to me in the decipher of this paradigm. Which is really more what my interest is since my programming compiler's lib has inbuilt routines that will return sin(x) and ArcSin(sin). It's the theory behind it that intriques me to write the base code. I will watch that link's video also to try to educate myself more on the factoring & solving of the expansions.

To wrap up this thread could you tell me if I've understood the above function premise with what I've written below.

{for summation infinity to n=0}
(2n)! / ( 2^(2n) * (n!)^2 * (2n +1) ) * x^(2n+1)

Last edited:

#### Joppy

{for summation infinity to n=0}
(2n)! / ( 2^(2n) * (n!)^2 * (2n +1) ) * x^(2n+1)
A for loop is basically a summation. Instead of 'summing from n=0 to infinity' we can say 'for n=0 to infinity'. Of course, you can't sum to infinity on your computer!

Your compiler will need to know what ^ and ! mean.

Also, I can't tell if you want to express the series symbolically, or actually evaluate the function manually with a series? A symbolic expression can become a bit tedious in some environments.

If just want to approximate the function then you can easily calculate all the terms individually and store them in an array, then add them together. All this depends on what software you using however.

M = 1000; // Make this number bigger/smaller and
// compare with functions true value
x = 3; // The number to evaluate your function at
f_val = 0;
for n=1 to M
f_temp(n) = [[(2n)! / (2^(2n)*(n!)^2 *(2n +1))] * x^(2n+1)]; // Stores each term in f_temp.
f_val = f_val + f_temp(n); //Add the terms together.
end

#### R_W_B

$\arcsin(x) = \sum \limits_{n=0}^\infty~\dfrac{(2n)!}{2^{2n}(n!)^2(2n+1)}x^{2n+1}$
A for loop is basically a summation. Instead of 'summing from n=0 to infinity' we can say 'for n=0 to infinity'. Of course, you can't sum to infinity on your computer!

Your compiler will need to know what ^ and ! mean.

Also, I can't tell if you want to express the series symbolically, or actually evaluate the function manually with a series? A symbolic expression can become a bit tedious in some environments. . . . . . . . . . . . . . . . . .
. . . . . . . . . . .
Thanks, my compiler will use the ^ for intergal exponents, for floating point nums it uses pow(x,y). I've written my own function for Factorials (!) as that is pretty straight forward to decipher. And thanks for the routine help.

But you lost me a bit on your function symbolic expression answer. Basically what I am fishing for is in the function depictions (like the one shown above by romsek) does the last X^(2n+1) tacked onto the right side multiply by the previous part of the function depiction (or expression) ?

I.e. is it similar to any other algebra expression that does not give a dot or any other operator. The reason I'm asking is that it's placed (in most graphic depictions) so close, right up against the previous part of the function expression with no space at all. Just looks a bit ambiguous to a new to calculus person like me.

Any elaboration of input you have would be appreciated.

#### R_W_B

Well I guess my last question was too ambiguous (or too stupid) for an answer. So I bought a Calculus for Dummies book and did some study and experimented by plugging in actual values in very basic formulas for the value of n . I also deciphered the code (to some extent) on how you guys are posting Greek Letters & formulas on this forum.

So (if I've learned correctly) something like,
$\sum \limits_{n=0}^\infty~\dfrac{(2n)!}{2^{2n}(n!)^2(2n+1)}x^{2n+1}$

with all it's intimidating depiction to a non-calulus dummy like me, is just inserting an algebraic equation for the middle n in the Sum notation.
$\sum \limits_{n=0}^\infty~n$

So that like any other algebra equation that doesn't include a dot for multiplication it's assumed and in this case it's for the entire fraction. So for an dummy like me if it had been written
$\sum\limits_{n=0}^\infty~\dfrac{(2n)!}{2^{2n}(n!)^2(2n+1)} * x^{2n+1}$

I might have understood it more, or maybe not given my naive level of calculus depictions.

Or even I presume also as,
$\sum\limits_{n=0}^\infty~[ \dfrac{(2n)!}{2^{2n}(n!)^2(2n+1)} ]x^{2n+1}$

And lastly when I attempted to plug
$\sum \limits_{n=0}^\infty~\dfrac{(2n)!}{2^{2n}(n!)^2(2n+1)}x^{2n+1}$

into an online equation calculator it gave this,
$[ \sum \limits_{n=0}^\infty~\dfrac{(2n)!}{2^{2n}(n!)^2(2n+1)} ]x^{2n+1}$

but (to me) would give an errant answer for any iterations of n = greater than 1, since it seems to separate the x^(2n+1) from the Sum. But maybe that calculator knows more than me (?) at this point.