# What function satisfies this table?

• B
Gold Member
2022 Award
We are still talking past each other, perhaps due to differing terminology. Anyway, enough. It is what it is, WHATEVER that is

PhDeezNutz and Bystander
Homework Helper
Gold Member
We are still talking past each other, perhaps due to differing terminology. Anyway, enough. It is what it is, WHATEVER that is
No it is not differing terminology, the problem is that ## y=10(1+\operatorname{floor}(\operatorname{abs}(2.5-x))) ## does not look like you think it looks like, it looks like this: https://www.desmos.com/calculator/xausftxwn4

The function that looks like what you have in your head is ## y=10(0.5+(\operatorname{abs}(2.5-x))) ##.

Edit: two half-lines may seem like the simplest interpolation, however the OP is very insistent that a correct interpolation must be periodic. That leaves the cosine interpolation as probably the simplest.

jbriggs444
Gold Member
2022 Award
The function that looks like what you have in your head is ## y=10(0.5+(\operatorname{abs}(2.5-x))) ##.
ACK ! You are obviously right. My use of the floor function DID make it different than what I had in my head and your correction of my equation is excellent. Thanks.

PhDeezNutz, dlgoff and jbriggs444
MevsEinstein
f(x) = 10 * (1 + floor(abs(2.5-x)))
Thanks but I wanted it to be periodic, like the portion that I showed in the data is a period.

Homework Helper
Thanks but I wanted it to be periodic, like the portion that I showed in the data is a period.
So if we were to extend the table, row 6 would be a repeat of row 0, right? The cosine solution hits that nicely.
I was thinking I could use cosine because its maximum is at x=0.
The periodic data actually has a maximum at x=-0.5 (midway between -1 and 0) and a minimum at x=2.5 (midway between 2 and 3).

MevsEinstein
So if we were to extend the table, row 6 would be a repeat of row 0, right? The cosine solution hits that nicely.

The periodic data actually has a maximum at x=-0.5 (midway between -1 and 0) and a minimum at x=2.5 (midway between 2 and 3).
Yes. I tried using the triangle wave, but I couldn't get the numbers to be exact.

Homework Helper
Gold Member
Thanks but I wanted it to be periodic, like the portion that I showed in the data is a period.
The periodic version of the piecewise linear fit is a triangle wave. These have the general form
$$y(x)={\frac {4a}{p}}\left|\left(\left(x-\phi\right){\bmod {p}}\right)-{\frac {p}{2}}\right|-c$$
You can see this plotted with appropriate constants here: https://www.desmos.com/calculator/f5ki6smfan

Edit: in the equation above, ## a ## is the amplitude which as @berkman showed is 15 and ## p ## is the period which again we know is 6. The phase ## \varphi ## and constant offset ## c ## can be determined by trial and error.

There is an important lesson here: given a set of points it is possible to fit functions of many forms, so the question "what function generated these points" has many answers. If you want to fit a function to data, first you have to work out what sort of function you want, then you can find the parameters that achieve the best fit.

jbriggs444
MevsEinstein
the period which again we know is 6.
That's why I can't find the correct one, I thought the period was 5 Thanks for the function!

Homework Helper
That's why I can't find the correct one, I thought the period was 5 Thanks for the function!
To be fair, the period for the given data could be 5. The triangle wave would have a lower maximum, the same slope and the same minimum.

Fiddling around without much of a plan, I got: ##y\ =\ \frac{\left(4\cdot12.5\right)}{5}\operatorname{abs}\left(\operatorname{mod}\left(\left(x\right),\ 5\right)\ -\ \frac{5}{2}\right)+5##

Last edited:
Homework Helper
The plot is only a portion of the whole function.
As I said, you still know more than we do.

from my own analysis
What do the data represent ?
You sure it is exactly one period ?
And what is the remaining portion, exactly ?

##\ ##

jbriggs444
MevsEinstein
What do the data represent ?
I'll give in. The data represents the change from one composite number that has a unit digit of 7 to another one.

Take a look:
7,17,(27),37,47,(57)...
The change between 27 and 57 is 30.

I finally got the answer! It is ##10|x\mod 5 - \frac{5}{2}|+5##

Homework Helper
The data represents the change from one composite number that has a unit digit of 7 to another one.
Three problems.

1. No, the data in #1 is not consistent with this pattern. In particular, 97 is not composite.
2. The sequence you describe is not periodic.
3. Seriously, dude. When asked what you are really trying to do, an answer is appropriate. Not prolonged evasion. We are 47 posts deep into an irrelevant tangent based on a misunderstanding that could have been corrected if you'd been forthcoming in response to @BvU in post #9.
Code:
7 17 (27) 37 47 (57) 67 (77) (87) 97 107 (117) 127 137 (147) 157 167 (177) (187) 197 (207) (217) 227 (237)
xx         30      20   10           30            30            30    10        20    10       20
One would expect this sequence to converge to ... 30, 30, 30, 30, ... with a few 20, 10 and 10, 20 subsequences scattered therein.

Last edited:
Vanadium 50, BvU and mfb
MevsEinstein
Three problems.

1. No, the data in #1 is not consistent with this pattern. In particular, 97 is not composite.
2. The sequence you describe is not periodic.
3. Seriously, dude. When asked what you are really trying to do, an answer is appropriate. Not prolonged evasion. We are 47 posts deep into an irrelevant tangent based on a misunderstanding that could have been corrected if you'd been forthcoming in response to @BvU in post #9.
Code:
7 17 (27) 37 47 (57) 67 (77) (87) 97 107 (117) 127 137 (147) 157 167 (177) (187) 197 (207) (217) 227 (237)
xx         30      20   10           30            30            30    10        20    10       20
One would expect this sequence to converge to ... 30, 30, 30, 30, ... with a few 20, 10 and 10, 20 subsequences scattered therein.
I didn't know what @BvU meant until recently. That's why I answered him late. Sorry for the misconvenience

mfb
Staff Emeritus
Homework Helper
Gold Member
Oh. I did not realize that. I'm seeing things in this thread with long strings of digits in real numbers. I thought that those were rounded off and not exact.
One can get exact values for the cosine model given by @BvU, by inspection.

Using the function ##y=d\cos(ax+b)+c ## and the given data points:

One half a period is 3 units, so ##a=\dfrac{\pi}{3}## as @BvU indicated.

A minimum occurs at ##x=2.5## units, so there is a maximum at ##x=-0.5## units. Therefore, ##b= \dfrac{\pi}{6}## .

##c## should be the easiest of all parameters to get an exact value for. ##c=20## .

Finally, ##\dfrac{\sqrt{3\,}}{2}\, d =10## so that ##d=\dfrac{20}{\sqrt{3\,}}## .

Homework Helper
Gold Member
I'll give in. The data represents the change from one composite number that has a unit digit of 7 to another one.
This is very disappointing.

1. No, the data in #1 is not consistent with this pattern. In particular, 97 is not composite.
Absolutely, @MevsEinstein you need to take more care.

2. The sequence you describe is not periodic.
Absolutely, @MevsEinstein if you suspected a periodic relationship you should have calculated more values.

3. Seriously, dude. When asked what you are really trying to do, an answer is appropriate. Not prolonged evasion. We are 47 posts deep into an irrelevant tangent based on a misunderstanding that could have been corrected if you'd been forthcoming in response to @BvU in post #9.
Absolutely, @MevsEinstein I hope you have learned your lesson here.

One would expect this sequence to converge to ... 30, 30, 30, 30, ... with a few 20, 10 and 10, 20 subsequences scattered therein.
Er... actually it will converge to ... 10, 10, 10, ... with a few 20's and 30's scattered in (we are looking at intervals between composites which become increasingly dense).

jbriggs444
Gold Member
One would expect this sequence to converge to ... 30, 30, 30, 30, ... with a few 20, 10 and 10, 20 subsequences scattered therein.

Er... actually it will converge to ... 10, 10, 10, ... with a few 20's and 30's scattered in (we are looking at intervals between composites which become increasingly dense).
Doesn’t throwing in a few other numbers mean that the sequence does not converge?

Mentor
Your table is linear.
Strictly speaking, the data suggest a piecewise linear graph, which is somewhat different.
Of course, but the data does not support a pure straight line.
Right.