# Computing a logarithmic function

Possibly this is a very lame question for this site.

There is a function $f(n)=-\ln(a*n); \space \Bbb Z \to \Bbb R$, and I want to define $a$ for pairs of values. For example:

$f_1(n_1)=15; f_1(n_5)=1.157$

$f_2(n_1)=454; f_2(n_8)=1.0042$

and so on. How can I write a function that could calculate $a$ values from the starting values?

-
What are $n_1$, $n_5$, and $n_8$? Or what do you know about them, other than that they are the first, fifth, and eighth elements of a sequence? (I'm assuming) – David Z Sep 17 '12 at 20:09

## 1 Answer

I guess you want something like this, but not sure:

Solve[{-Log[a n] == x1, -Log[a (n + k)] == x2}, {a, n}]
(*
a -> (-E^-x1 + E^-x2)/k
*)


Edit

More generally, for any invertible function f:

Solve[{f[a n] == x1, f[a (n + k)] == x2}, {a, n}]


$\left\{\left\{a\to \frac{f^{(-1)}(\text{x2})-f^{(-1)}(\text{x1})}{k},n\to -\frac{k f^{(-1)}(\text{x1})}{f^{(-1)}(\text{x1})-f^{(-1)}(\text{x2})}\right\}\right\}$

-
+1 for a good guess (I was completely mystified, but this looks plausible). – Oleksandr R. Sep 17 '12 at 20:38