# Converting time into a repeating sequence.

• Feb 14th 2010, 09:26 AM
Scifinity
Converting time into a repeating sequence.
Hi Guys,

The problem up front:

How to convert a steadily increasing number into a resetting, repeating sequence.

Background:

I am creating an animation in Vue 7. I have a grayscale image map in which black = -1 and white = 1. It can be attched to any output node to produce varying color, transparency etc.

It is possible to connect various nodes that have mathematical functions to alter the output from any given input. Time is a possible input variable and is measured in seconds using whole integers. i.e. after 100 seconds the time value will be 100.

I want to create a function that converts time into a progression from -1 through to 1, only to begin again at -1 and repeat indefininitely. So no matter how large the time input the output will always be between -1 and 1.

I hope this is not to much of an odd request and not in the wrong place! I'm not really a mathematician so was unsure exactly what this is classified as. (Worried)

• Feb 14th 2010, 10:44 PM
Hello Rob

Welcome to Math Help Forum!
Quote:

Originally Posted by Scifinity
Hi Guys,

The problem up front:

How to convert a steadily increasing number into a resetting, repeating sequence.

Background:

I am creating an animation in Vue 7. I have a grayscale image map in which black = -1 and white = 1. It can be attched to any output node to produce varying color, transparency etc.

It is possible to connect various nodes that have mathematical functions to alter the output from any given input. Time is a possible input variable and is measured in seconds using whole integers. i.e. after 100 seconds the time value will be 100.

I want to create a function that converts time into a progression from -1 through to 1, only to begin again at -1 and repeat indefininitely. So no matter how large the time input the output will always be between -1 and 1.

I hope this is not to much of an odd request and not in the wrong place! I'm not really a mathematician so was unsure exactly what this is classified as. (Worried)

It sounds as if you want some sort of 'saw-tooth' function such as the one in the diagram I've attached. If so, you'll need to investigate the use of the 'floor' function which returns the largest integer less than or equal to the number that's fed into it.

floor(x) is denoted like this: $\lfloor x \rfloor$, and the function I've used to produce the attached graph is:
$y = x-1-2\left\lfloor\frac{ x}{2} \right\rfloor$
I used Excel to produce this graph, where the INT function is the same as 'floor'.