# Equations for functions

Here are some equations I have come across over the years. Some are series equations for calculating trigonometric and numerous other types of functions. Hopefully your browser will not mess up these equations.
The term a for the following equations can be a real number or a complex number such as 2+3i. Have a look at my article on complex numbers too for alternate equations. They may also help you understand the results they give.
On Mathcad (and probably other programs like it), use (-1)r instead of -1r because -1r means raise 1 to the power of r and make it negative.
It is used to make alternate signs +2, -3, +4, -5 ... in series equations.

## Trigonometry

 sin(a) = ∞ ∑  r=0 (-1)r a2r+1 (2r+1)!
 cos(a) = ∞ ∑  r=0 (-1)r a2r (2r)!
 tan(a) = sin(a) cos(a)

 sin(a) = eai - e-ai 2i
 cos(a) = eai + e-ai 2
 tan(a) = i(1-e2ai) 1 + e2ai where i=√-1

## Inverse Trigonometric functions

Note that sin-1(a) = arcsin(a) = asin(a) etc. Not to be confused with sin2(a) = sin(a) • sin (a)
 arcsin(a) = arctan ( a ) √(1-a2)
 arcos(a) = (π/2) - arctan ( a ) √(1-a2)
 arctan(a) = ∞ ∑  r=0 (-1)r•a2r+1 where |a| ≤1 2r+1

 arcsin(a) = ∞ ∑  r=0 ( (2r)! ) a2r+1 22r(r!)2 2r+1 where |a| ≤ 1 which shows that it still can be a complex number
 arccos(a) = π - arcsin(a) 2
 arctan(a) = ∞ ∑  r=0 (-1)ra2r+1 where |a| ≤ 1 a ≠ i, -i because the arctangent of i or -i does not have a solution 2r + 1

Leonhard Euler found a more efficient series for the arctangent, which is:
 arctan(a) = a ∞ ∑  r=0 r ∏ k=1 2ka2 1+a2 (2k + 1)(1 + a2)
(Notice that the term in the sum for n= 0 is the empty product which is 1.)

Alternatively, this can be expressed:
 arctan(a) = ∞ ∑  r=0 22r(r!)2 a2r+1 (2r + 1)! (1 + a2)r+1
I tried it with some expressions like a = 0.3 - 0.5i on Mathcad and in 6 or so iterations, I got an accurate answer but there does appear to be some restriction in range when I used negative numbers and some larger numbers

arcsin(a) = -i•ln(ia + √(1-a2)
 arccos(a) =  -i•ln(a + i√(1-a2) = π - arcsin(a) 2
 arctan(a) = i (ln(1-ia) - ln(1+ia)) 2

There exists infinite series equations for arcsecant etc. and logarithmic forms too which I have omitted.

## Hyperbolia

 sinh(a) = ea - e-a 2
 cosh(a) = ea + e-a 2
 tanh(a) = e2a - 1 e2a + 1

 arcsinh(a) = ln (a + √(a2+1)) arccosh(a) = ln (a + √(a2-1))

 arctanh(a) = ln(1+a) - ln(1-a) = ln((1+a)/(1-a)) a ≠ 1, -1 2 2
 = ∞ ∑  r=0 a2r+1 |a| < 1 2r + 1
The series operator has this restriction: |a| <1 but you can calculate a result when |a| >1 by using the equation with ln() in it but you will also need an equation from the complex number article I have written. There exists no solution when a = ± 1.

## Secant, cosecant and cotangent

 sec(a) = 1 cos(a)
 cosec or csc(a) = 1 sin(a)
 cot(a) = 1 tan(a)
These too have infinite series equations to define them

## Logarithmic and exponential

 en := ∞ ∑  r=0 nr r!
 ln(n+1) := ∞ ∑  r=0 (-1)r•nr+1 r+1
 = ∞ ∑  r=1 (-1)r-1 nr r

For en, n≠0 but it can be a real number an imaginary number or even a complex number although for a complex number a + bi, you can use ea + bi = ea × ebi if you wish (although you are using more series equations). I have tested the series equation on Mathcad with complex numbers and it worked.
For ln(n+1),  -1 < n ≤ 1 so if you want ln(0.5) then set n = -0.5. This gives you a range for taking logarithms of a number greater than 0, up to <2 but for higher numbers, you can invert it and make the logarithm negative e.g. ln(10) = -ln(1/10).
If this is a little confusing, you can use a slightly modified form:
 ln(n) := ∞ ∑  r=1 (-1)r-1•(n-1)r r 0 < n ≤ 2
Although for small values of n, you need to calculate maybe a million iterations and for larger numbers, maybe just a thousand is enough.
You may think that taking a natural logarithm of a negative number is not possible because most calculators are not programmed to evaluate such things but in fact, you can and it gives a complex number as a result:
if n < 0 then ln(n) = ln|n| +  i•π and if you wish to use this, or other functions with complex numbers, I have written a page on this subject.
I have tried this also with complex numbers and it worked for a + bi = 1 + i but I have not worked out the range of numbers:
 ln(a+bi) := ∞ ∑  r=1 (-1)r-1•(a-1+bi)r r
but by using ln(n) = ln|n| +  i•π then you do not need to use complex numbers in the series equation. I just present it to you out of interest.

## Combinations and permutations

 nCr = n! nPr = n! r!(n-r)! (n-r)!

## Miscellaneous equations that interest me

 cosh(a) ± sinh(a) = e ±2a

 π = ∞ Π r=0 4r2 + 8r + 4 = ∞ Π r=0 (2r +2)2 2 4r2 + 8r +3 (2r + 1)(2r+3)

 π = 4•tan-1(1) = 4× ∞ ∑  r=0 (-1)r 2r +1

e= cos θ +i•sin θ (Euler's formula)
eπi= -1 (Euler's identity)

 n! ∼ √(2πn)• ( n ) n e Stirling's formula
 e = lim n→∞ (1 + n-1)n
 Modify an equation above (which converges quickly) gives e = ∞ ∑  r=0 1 r!

sin-1(n)= π/2 + i•cosh-1(n) where I thought n>1 but it works on Mathcad for 0.1 etc. I'll investigate sometime.

To get any Fibonacci number, first calculate f given n where n≥0 (or more formally n ∈ 0)
 f= 1 ( 1+√5 ) n √5 2

Now take ⌊f⌉ = ||f|| = nint(f) = Round(f) = a rounded up integer
or you can also use int(f + 0.5) on a computer or some calculators which rounds up a positive number.
You can also use:
 f= 1 (( 1+√5 ) n - ( 1-√5 ) n ) √5 2 2
(expect a few rounding errors on a computer)

These produce:
n ⌈ f ⌉
0 0
1 1
2 1
3 2
4 3
5 5
6 8
7 13
8 21
... ...