here is function to approximate log10(x+1), (x+1) < ~1.2
a = 1.097
b = 0.085
c = 2.31
ans = 1 / (a - b*x + c/x)
so it should look like that
it works by adjusting harmonic mean to match log10
but the problem is in values of abc
the question is how to get just right a, b and c
and how to make better approximation
i made this code that can give you pretty good approx for a, b, c
but my code wasnt able to make it any better
here is my code:
import numpy as np
a = 1
b = 0.01
c = 2
def mlg(t):
x = t
if t == 0:
x = 0.00000001
x2 = x*x
o = a - (b * x) + (c / x)
return 1/o
def mlg0(t):
x = t
if t == 0:
x = 0.00000001
x2 = x*x
o = a - (b * x) + (c / x)
return o
for i in range(9000):
n1 = np.random.uniform(0,1.19,1000)
for i in range(1000):
n = n1[i]
o = np.log10(n+1)
u = mlg(n) - o
e = u ** 2
de_da = 0 - 2 * (u) / (mlg0(n) ** 2)
de_db = de_da * n
de_dc = de_da / n
a -= de_da * 0.00001
b -= de_db * 0.00001
c -= de_dc * 0.00001
print(a,b,c)
so do u guys have any ideas of how to generate better values?
i`ve used method alike back propagation in NN but it could not give me values any better
You need to sign in to view this answers