0
$\begingroup$

I'm trying to interpolate a logarithmic function but it always reaches a singularity due to $\log(0)$ being $-\infty$

is there a correct way to interpolate logarithmic functions? (as in correct parameters)

What i'm currently going for is

$y=a+b \log(cx)$

with initial values

$a=0$, $b=1$, $c=0$

$\endgroup$
3
  • $\begingroup$ What do you mean by 'interpolate a logarithmic function"? Can you articulate the problem more precisely/clearly? What are the inputs, and what outputs would you like to receive from the algorithm? Maybe give an example of an example input to the algorithm, and what output you'd like the algorithm to produce? $\endgroup$ – D.W. May 21 '14 at 4:47
  • $\begingroup$ Welcome to Computer Science! Note that you can use LaTeX here to typeset mathematics in a more readable way. See here for a short introduction. $\endgroup$ – FrankW May 21 '14 at 5:14
  • $\begingroup$ D.W. I had a set of points that i knew would make a log function but i wasn't sure how to interpolate them since log functions have many variables and have singularity problems. The solution was to set c's initial value to 1 and add a constant inside the log (log(cx + d) ) to dislocate the function in the x axis so it fit the point set $\endgroup$ – Jean-Luc Nacif Coelho May 21 '14 at 18:08
0
$\begingroup$

The general fitting formula for pretty much any function is $F(x)=a*x+b$

so if you have a function inside a function it would be $F(G(x))=a*G(c*x+d)+b$ by virtue of substitution.

You made a tiny error. Instead of $y=a+b \log(cx)$ you probably want $y=a+b \log(cx + d)$

try to fit your function again. a multiplier should never equal to zero, because that would imply you don't have a function of $x$.

$\endgroup$
1
  • $\begingroup$ I eventually figured that out. Also, i was using initial value for C = 0, which made the log go to 0. Worked out pretty well. $\endgroup$ – Jean-Luc Nacif Coelho May 21 '14 at 18:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.