What function satisfies this table?

  • #36
phinds
Science Advisor
Insights Author
Gold Member
2022 Award
18,205
11,216
We are still talking past each other, perhaps due to differing terminology. Anyway, enough. It is what it is, WHATEVER that is :smile:
 
  • Like
Likes PhDeezNutz and Bystander
  • #37
pbuk
Science Advisor
Homework Helper
Gold Member
4,084
2,410
We are still talking past each other, perhaps due to differing terminology. Anyway, enough. It is what it is, WHATEVER that is :smile:
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.
 
  • #38
phinds
Science Advisor
Insights Author
Gold Member
2022 Award
18,205
11,216
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.
 
  • Like
Likes PhDeezNutz, dlgoff and jbriggs444
  • #39
MevsEinstein
124
33
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.
 
  • #40
jbriggs444
Science Advisor
Homework Helper
11,680
6,364
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).
 
  • #41
MevsEinstein
124
33
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.
 
  • #42
pbuk
Science Advisor
Homework Helper
Gold Member
4,084
2,410
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.
 
  • #43
MevsEinstein
124
33
the period which again we know is 6.
That's why I can't find the correct one, I thought the period was 5 :frown: Thanks for the function!
 
  • #44
jbriggs444
Science Advisor
Homework Helper
11,680
6,364
That's why I can't find the correct one, I thought the period was 5 :frown: 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:
  • #45
BvU
Science Advisor
Homework Helper
15,360
4,337
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 ?

##\ ##
 
  • #46
MevsEinstein
124
33
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##
 
  • #47
jbriggs444
Science Advisor
Homework Helper
11,680
6,364
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:
  • Like
Likes Vanadium 50, BvU and mfb
  • #48
MevsEinstein
124
33
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:frown:
 
  • #49
SammyS
Staff Emeritus
Science Advisor
Homework Helper
Gold Member
11,740
1,324
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\,}}## .
 
  • #50
pbuk
Science Advisor
Homework Helper
Gold Member
4,084
2,410
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).
 
  • #51
Frabjous
Gold Member
1,044
1,173
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?
 
  • #52
36,854
8,888
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.
 

Suggested for: What function satisfies this table?

  • Last Post
Replies
10
Views
127
Replies
13
Views
538
Replies
1
Views
577
  • Last Post
Replies
5
Views
542
Replies
38
Views
2K
  • Last Post
Replies
3
Views
486
Replies
17
Views
846
Replies
15
Views
658
Top