# Thread: Converting time into a repeating sequence.

1. ## 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.

2. Hello Rob

Welcome to Math Help Forum!
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.

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: $\displaystyle \lfloor x \rfloor$, and the function I've used to produce the attached graph is:
$\displaystyle 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'.

3. ## Sawtooth Solution

Thanks! The sawtooth did indeed convert the time input into a resetting sequence . Training for Vue is very basic and it is near on impossible to find good resources to aid in understanding the function. From my limited maths knowledge (GCSE) I can see the program is very powerful. The entire underlying process is mathmatical yet all tutorials work on the UI.

Solving the time issue has shown me that my image map has to be altered to get the effect I am looking for (something like the pulsing in the vista progress bar) I will post a link to a short video of the result as an additional thank you.

I come up with issues like this all the time so I will put them to you if you are up to the challenge!

Thanks again.

Rob.