Part1(Solved)
Is it possible to create a function that maps x to y as follows:
x 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...
y 0 1 2 3 4 5 4 3 2 1 0 1 2 3 4 5 ...
So far, this is what I have been able to come up with:
|5 sin ((1/10)pix)|
Which will give the following y's for x = 0 to 10:
0.00000
1.5451
2.9389
4.0451
4.7553
5.0000
4.7553
4.0451
2.9389
1.5451
0.00000
This sequence will repeat every 10 steps, with the peak (5) at step 5. This is getting close to what I want so all that is left is to somehow adjust the function so that the required integers appear (1,2,3,4), but I don't know how.
Since the function is cycling through a series of numbers over and over, I figured that it might be possible to write the function in terms of a periodic function and not piece by piece.
Please comment.
Part2
How would I go about writing a function that produce the following plot:(x is an integer >=0 , the pattern repeats after x = 8)
Can this plot be expressed using a single formula or must it be defined piecewise? Thank you.