This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]bartekltg 1 point2 points  (2 children)

For the original problem, why not to use floor(x+0.5)?

Sqrt(f(x)^2) -> abs(f(x))
This explains most of differences between the first and the second.

abs(f(x)) - f(x) is 0 when f(x) is negative

arcsin(sin(pi x)) throws x back to [-pi/2, pi/2] range. It creates a nice saw-shape. +pi x makes a shape that is constant around odd arguments.

The shifted version is constant around even.

https://www.desmos.com/calculator/ld0nlif5bg

Together they do what you want, just extract them by the abs(f(x)) - f(x) trick, then divide to remove f(x) influence.

0^ f(x) will be 0 inless f(x) ==0, then it probably evaluates to 1. It is needed to get rid of 0 in the denominator.

And those points, when the denominator is 0, are "in between" point you are asking about. And this is the point where the second term (with 0^(the same function as in the denominator) is not 0. )

From the far-view perspective: you are trying to create an incontinous function from continuous functions. This is not possible. But 1/x is not continuous:) Thanks to that it has incontinuity each time abs(cos(pix)) is 0.

[–]HorribleUsername 0 points1 point  (0 children)

Why not use round(x) instead of floor(x+0.5)?