Writing a logarithmic equation given sets of points in an xyz coordinate plane

270 Views Asked by At

For a game I'm making, I'm trying to create a logarithmic equation between starting points I know. I've done a lot of research, but haven't found anything too helpful. The points are: ( 0, .9, 1) ( 25, 1, 1) (100, 2, 1) ( 0, .8, 2) ( 25, 1, 2) (100, 4, 2) ( 0, .7, 3) ( 25, 1, 3) (100, 6, 3) ( 0, .6, 4) ( 25, 1, 4) (100, 8, 4) ( 0, .5, 5) ( 25, 1, 5) (100, 10, 5)

where 0 <= x <= 100, .5 <= y <= 10, 1 <= z <= 5

If the inclusion of z is too difficult, I could write a separate equation for each value of z, but knowing how to write the equation (with exact coefficients) passing through all 3 of the values for each value of z is most important to me.

To clarify, as long as I know how to create a logarithmic equation in any format for, for example, ( 0, .9) ( 25, 1) (100, 2) my question will have been answered.

1

There are 1 best solutions below

10
On

Assume the form $$y = A\ln(x + B) + C$$

I am using base $e$ for the logarithm, but you could use any base. The only difference would be that the value of $A$ would change.

This gives us three unknowns $A, B, C$ to find. For each $z$, you have three points, which gives us three equations. For $z = 0$, these are:

$$0.9 = A\ln(B) + C\\1 = A\ln(25 + B) + C\\2 = A\ln(100 + B) + C$$

We can convert this to exponential equations. To simplify their form, let $u = e^{0.1/A}$ and $v = u^{-C}$.

$$B = vu^9\\B + 25 = vu^{10}\\B + 100 = vu^{20}$$

We can eliminate $B$ by taking differences: $$25 = vu^9(u - 1)\\75 = vu^{10}(u^{10}-1)$$Taking a ratio eliminates $v$. $$3 = \frac {u(u^{10}-1)}{u - 1}$$ or $$u^{11} - 4u + 3 = 0$$ Solving (try Newton's method) gives $u$, then $$v= \frac {25}{u(u^9 - 1)}\\B = vu^9\\C = -\log_u v = -\frac{\ln v}{\ln u}\\A = \frac {0.1}{\ln u}$$

Similar methods can find $A, B, C$ for your other values of $z$. It isn't pretty, but it should work.