What is rule of this function?

125 Views Asked by At

I have these values.these are inputs and outputs of a function.I want to find rule of function.input is N.

    N             f(N)
   512           0.000
   1024          0.001
   2048          0.003
   4096          0.011
   8192          0.042
   16348         0.154
   32768         0.572
   65536         2.134
   131072        7.864
   262144        29.190
   524288        108.301
   1048576       400.578
   2097152       1482.995
2

There are 2 best solutions below

2
On BEST ANSWER

I observe that the left column is obviously exponential, and the right column seemingly so. (Each item in the right column is somewhat more than three times the previous item.) So it makes sense to construct a log-log plot of the data:

log-log plot of data

The $x$-axis is the logarithm of the left-hand column, and the $y$-axis is the logarithm of the right-hand column.

At this point it is obvious that the relationship between the logarithms of $x$ and $y$ is linear, so $\log y = m\log x + b$ where $m$ and $b$ are the slope and $y$-intercept of the plotted line. Linear regression gives $m\approx 1.88$ and $b\approx -20.086$:

log-log plut with regression line

So we can write $$\begin{align}y & = e^{1.88\log x - 20.086}\\ & = \frac{x^{1.88}}{529108792}\end{align}$$

Checking $x=65536$ we get $y=2.145$ which is close to the $2.134$ in the table; had I rounded off the $1.88$ more carefully we might have gotten a more accurate result. The apparent zero value for $x=512$ is actually around $0.00023$.

For the linear regression I used a tiny program that I wrote in Perl a few years ago, but any handheld scientific or financial calculator will do it. I explained it in detail in this post.

2
On

you can use cftool in MatLab to interpolate, the function that you want.