# Secant, Cosecant, and Cotangent Do Not Work with Conditionals?

I was trying to make a watchface that animates a small dog using a sprite sheet. I really wanted to use a sawtooth equation to quickly and easily check the value of the sawtooth, but also easily adjust the period of the sawtooth depending on the number of frames or the frame rate of the animation (for future animations).

I was able to animate the Y position of a circle shape and it changed position correctly. When I went to check the value of the equation, the conditional didn’t like it. Turns out it was the Cotangent being used in the formula (which was really juse 1/tan(…) because Facer doesn’t have Cotangent). I tested it with a simple 1/sin(#DWFSS#) and it wasn’t having it (it displays no value). Why would this be? Is cotangent, cosecant, etc not supported? Is there a way around this?

Hey @Blocky999! Sorry to hear you’re having some issues with it. Could you paste in the full expression? We’ll take a look at it.

Just btw, I have resolved my issue by transforming the problem from using conditionals to not by using a sawtooth wave (with an amplitude of 2 and a period of 1) math’d into a triangle wave by taking the absolute value of the sawtooth, then multiplying by a factor, rounding, and dividing by that same factor. This created increments by which I could transform the sprite sheet. I could have done this method without needing to transform it to a triangle wave, but the rounding method on a sawtooth wave results in ticks with unequal lengths at the beginning and end of each period.

But back to the real issue:

Here is the equation as found on wikipedia:

Here, a and p represent the amplitude and period, respectively.

The following is the formula I used to make a shape element move vertically:
(160+200*(atan(1/tan((#Dsm#*pi)))/pi))
(I put this into the Y Position box)

I chose an amplitude of 100 and period of 1 second, then simplified. Works fine for just the calculation of the position, not for any conditionals. Removing the “1/” from inside the arctangent results in a working conditional. This leads me to believe that 1/tan or 1/sin or the rest (I haven’t tested the 1/hyperbolic or 1/inverse trig functions) do not work with conditionals.

1 Like

Hi @Blocky999! A fix we pushed today should fix the issues you were having with “1/” in conditionals.

1 Like

Blocky, it seemed to me that you were using a tag for the smooth rotation of the second hand, which is in degrees. You need to use the rad() function to convert this into radians for the cos() function. This is probably unrelated to the issue you had, but would make the resulting wave a higher frequency than expected.

This was a while, so my memory may not be correct, but at the time, I was unaware of the rad() function, so I just converted to radians via the pi/180 conversion and simplified.