I found a similar one,log(1+1/x)=rel_entr(x,x+1)+rel_entr(x+1,x),but I’m a green hand,I’m not sure I can do that
How to represent code log(1+A/x),A is a constant
log(1+A/x) = log(1 + 1/(x/A)) , the RHS of which is in the form of the “similar one”.
So replace x by x/A in the “similar one”. I.e.,
log(1+A/x) = rel_entr(x/A,x/A+1)+rel_entr(x/A+1,x/A)
Note: Credit for the 'similar one" to @Michal_Adamaszek
I substituted the exact values into the two expressions and found that the results were a little different. Is that normal?