User:Kieff/Square sine and cosine functions

From Wikipedia, the free encyclopedia

The square sine along with the common sine
Enlarge
The square sine along with the common sine

The square sine and square cosine functions are akin to their trigonometric counterparts, but instead of defining an unit circle, they define a square of "radius" 1 (that is, side 2). I'm not sure if such functions are already properly defined in the mathematical community, but I never heard of them. I doubt I'm the first to toy with this concept, though.

The square sine ("sinsk") can be written as:

\mbox{sinsq}(x) = \tan(x) \sgn(\cos(x)) \ \frac{\sgn(\cos(2x))+1}{2} \ + \ \sgn(\sin(x)) \ \frac{\sgn(-\cos(2x))+1}{2}

Where sgn is the very useful sign function. The signal function works here as a very useful inline hack for a piecewise function construction. There's probably a better way to do all this, but hey, it works so far!

The square cosine ("cosk") is defined as:

cossq(x) = sinsq(x + π / 2)

[edit] Approximations

An interesting approximation can be done by using iterated trigonometric functions:

Define a function ts such as:

ts0(x) = x
ts1(x) = tan(sin(x))
tsn(x) = tan(sin(tsn − 1(x)))

The square sine can then be approximated by:

\mbox{sinsq}(x) \approx \frac{2}{\pi} \mbox{ts}_7(x)

Which gives a smooth curve that differs no more than 0.1082300356377... from the square sine. I wonder if there's a better approximation...