What function satisfies this table?

In summary, @BvU found an approximation for the cosine function that is better than the one I found. @BvU got the variables he needed from wolfram alpha.
  • #36
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
Mathematics news on Phys.org
  • #37
phinds said:
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.
 
  • Like
Likes jbriggs444
  • #38
pbuk said:
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
phinds said:
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
MevsEinstein said:
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.
MevsEinstein said:
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
jbriggs444 said:
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
MevsEinstein said:
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.
 
  • Like
Likes jbriggs444
  • #43
pbuk said:
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
MevsEinstein said:
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
MevsEinstein said:
The plot is only a portion of the whole function.
As I said, you still know more than we do.

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

##\ ##
 
  • Love
Likes jbriggs444
  • #46
BvU said:
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
MevsEinstein said:
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
jbriggs444 said:
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:
 
  • Skeptical
Likes mfb
  • #49
phinds said:
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
MevsEinstein said:
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.

jbriggs444 said:
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.

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

jbriggs444 said:
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.

jbriggs444 said:
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).
 
  • Like
Likes jbriggs444
  • #51
jbriggs444 said:
One would expect this sequence to converge to ... 30, 30, 30, 30, ... with a few 20, 10 and 10, 20 subsequences scattered therein.

pbuk said:
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
phinds said:
Your table is linear.
Strictly speaking, the data suggest a piecewise linear graph, which is somewhat different.
phinds said:
Of course, but the data does not support a pure straight line.
Right.
 

Similar threads

  • General Math
Replies
11
Views
1K
Replies
5
Views
901
  • General Math
Replies
15
Views
3K
Replies
17
Views
2K
Replies
6
Views
1K
Replies
2
Views
932
Replies
1
Views
848
  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
725
Replies
3
Views
762
Replies
2
Views
749
Back
Top