0
$\begingroup$

I want to devise a function $f(x)$ such that $f(4) = 160, f(16)=80, f(28)=40$ and $f(40)=20$, as well as all the other values in between $4-40$. As in, the numbers between $4-12$ have a proportional value between $160-80$. Numbers between $28-40$ have a proportional value between $40-20$ etc.

The values on the left go up linearly and the values on the right go down exponentially.

I hope this makes sense. But would appreciate any help. Thanks

$\endgroup$
8
  • 1
    $\begingroup$ Are you sure the numbers on the left are correct? Because you say they go up linearly, but as you've written them they do not. $\endgroup$
    – DMcMor
    Dec 7, 2020 at 19:30
  • $\begingroup$ Sorry, linearly was maybe the wrong term. I was just picturing a graph with the numbers right logarithmically proportional to the numbers on the left $\endgroup$ Dec 7, 2020 at 20:15
  • $\begingroup$ But the numbers on the left do not go up linearly. $4 +\color{blue}8 = 12; 12 + \color{red}{16}=28; 28+\color{green}{12}= 40$. $8, 16, 12$ are different numbers. $\endgroup$
    – fleablood
    Dec 7, 2020 at 20:16
  • 1
    $\begingroup$ ah sorry. That was daft. It's meant to be 16 not 12. I just changed it there. Yeah so they do go up linearly each time by a step of 12 $\endgroup$ Dec 7, 2020 at 20:18
  • 1
    $\begingroup$ Ah.... now we are talking! $\endgroup$
    – fleablood
    Dec 7, 2020 at 20:20

3 Answers 3

2
$\begingroup$

Since your $x$-values are spaced linearly and your $y$-values are spaced exponentially, we can find an exponential function based solely on the first two points and it will hold for all of them. Let $f(x) = a(b)^x$ for unknown $a,b$. Based on your first two points, we have \begin{align} 160 &= a(b)^{4}\\ 80 &= a(b)^{16}. \end{align} Dividing the first equation by the second lets us eliminate $a$: $$2 = b^{-12} \implies b = 2^{-1/12}.$$

Plugging this back in to either equation (I'll use the second): $$80 = a(2^{-1/12})^16) = a(2)^{-16/12} = a(2^{-4/3}) \implies a = 80(2)^{4/3}.$$

Putting it all together gives us $$f(x) = 80(2)^{4/3}(2^{-1/12})^{x},$$ which if we want we can rewrite as $$f(x) = 80(2)^{\frac{4}{3} - \frac{x}{12}} = 80(2)^{\frac{16-x}{12}}.$$

If for some reason you wanted to use base $e$ instead this would become $$\ f(x) = 80\left(2\right)^{\frac{4}{3}}e^{\ln\left(2^{-\frac{1}{12}}\right)x}.$$

$\endgroup$
2
  • $\begingroup$ Damn that's good. I wish I could do that. I mean I get it! But I couldn't have worked it out myself. Thanks a lot. I'll put this to good use! $\endgroup$ Dec 7, 2020 at 20:32
  • $\begingroup$ It's not all that bad, just takes some practice. $\endgroup$
    – DMcMor
    Dec 7, 2020 at 20:33
1
$\begingroup$

So $Left = 4 + 12(t-1)$ or $-8 + 12t$. And $Right = 160\cdot (\frac 12)^{t-1}$ or $320\cdot (0.5)^t$.

It's probably easiest to leave it as that $x(t) = Left = 12t -8$ while $y(t) = Right = 360\cdot (0.5)^{t}$.

But if you must have $Right(Left) = $some function in terms of $Left$ then:

Solve $t$ in terms of $Left$ and plug it into the formula for $Right$.

$Left = -8 + 12t$

$12t = Left +8$

$t = \frac {Left + 8}{12}$

$Right = 360\cdot (0.5)^{t}= 360\cdot (0.5)^{\frac {Left+8}{12}}$

If you like you can shift the offset:

$0.5^{\frac {Left+8}{12} } = 0.5^{\frac {Left}{12}+\frac 23}=[\frac 12]^{\frac 23}0.5^{\frac {Left}{12}}$ s

$Right = [\frac {360}{2^{\frac 23}}]\cdot (0.5)^{\frac {Left}{12}}$

$\endgroup$
1
  • $\begingroup$ Ah interesting! Probably a little trickier to grasp than the other solution but think I think I get it. Really appreciate the response! $\endgroup$ Dec 7, 2020 at 20:36
0
$\begingroup$

Take the logarithm of the values on the right column and plot them vs. the values on the left column.

You should obtain quite a straight line.
in any case draw the line that best approximate the graph and you have the parameters of the exponential function you are looking for.

$\endgroup$
1
  • $\begingroup$ Okay, I need it in the form of a function for a max/msp patch i'm creating. As in a algebraic function so I can put multiple values through it $\endgroup$ Dec 7, 2020 at 20:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .