Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm looking for a mathematical function that would have the following attributes:

  • Reasonably smooth -- continuous to the second or third derivative, say, for values greater than zero.
  • Given two values 1.0 and 1.0 it produces 1.0
  • Given two values less than 1.0 (but greater than 0), such as 0.5 and 0.5 it produces a number less than either number but greater than the product of the two numbers (eg, 0.4).
  • Similarly, for two values greater than 1.0 it produces a number greater than either but less than their products (less important).
  • ADDED: Given one value 1.0 and another not, should produce the second value -- f(1.0, N) = N.
  • Ideally (not a hard requirement), the function is associative and commutative.
  • Ideally (not a hard requirement), there is a "knob" one can turn to adjust the "strength" of the function, in terms of, eg, whether f(0.5,0.5) = 0.4 or instead 0.3.

Eg, I could simply use multiplication, where 0.5 $\cdot$ 0.5 = 0.25, but that results in a number (to be used as a weighting factor) that is too small.

After some experimentation (in a "toy" Java test program):

Math.exp(-Math.pow(Math.pow(Math.abs(Math.log(A)), fudge) + Math.pow(Math.abs(Math.log(B)), fudge), 1.0/fudge));

$$f(A,B)=\exp(-((|\ln A|^{\text{fudge}}+|\ln B|^{\text{fudge}})^{(1/{\text{fudge})}}))$$

comes pretty close, where "fudge" is roughly 2.0, and the inputs are <= 1. However, it obviously doesn't work right for values of A and B > 1.0, and my crude attempts to extend it didn't produce a very smooth function. [I found out later that the function was reasonably smooth, only Excel was plotting it strangely due to the way I generated the input file.]

(exp, pow, abs, and log are all the mathematical functions you'd expect from their names.)

So: Is there an obvious mathematical formula that provides the desired characteristics?

Background:

This function is used to combine "adjustment factors" used to correct for the interdependence of observations in a Bayesian inference. In each step of the Bayesian calculations, a multiplier consisting of the conditional probability divided by the marginal probability is generated. That multiplier is "adjusted" by raising it to the power of the combined (using the sought-after formula) "adjustment factors" reaching it from previous terms in the equation.

(I'm not here to have this adjustment scheme critiqued or debated, I'm just giving this for background.)

Didier Piau's function

I plotted, in Excel, the results (for fudge = 2.0, alpha = 1.0) from Didier Piau's scheme, close as I could understand it. (Sorry, Didier, if it's not correct.) It came out looking the same as the kludge I had cooked up earlier, though that earlier version occupied about 3 times as much code.

Since I don't understand Excel plotting very well the X axis is screwed up -- it represents B values times 10. The Y axis is the function value. (The curve fitting may be wrong in spots -- it's Excel's default.)

It certainly looks a bit peculiar, but I can't see anything specific that's wrong with it.

Musing: It kinda seems to me like there would be a name for this sort of function. It's kind of a "mean", or maybe a "product". I tried looking up "logarithmic mean", but that turned out to be something else.

share|improve this question
    
I am curious what do you want for f(0.5, 1.5)? when one argument is lower than 1 and the other one higher than 1? –  Alice Aug 9 '11 at 16:58
    
@Alice -- Generally I'd expect a value between the two input values in that case. –  Daniel R Hicks Aug 9 '11 at 17:07
    
Taking the absolute values of the logs of A and B means your output will be the same for A and 1/A. –  Ross Millikan Aug 9 '11 at 17:28
    
@Ross Millikan -- Correct, which is why it doesn't extend nicely above 1.0. –  Daniel R Hicks Aug 9 '11 at 17:51
1  
@Daniel, nice simulations (and nice question, by the way). –  Did Aug 10 '11 at 1:28

2 Answers 2

up vote 5 down vote accepted

A solution is to fix a positive parameter $a$ and to define $x*y$ for every positive $x$ and $y$, as the unique positive number $z$ such that $$ \log(z)|\log(z)|^a=\log(x)|\log(x)|^a+\log(y)|\log(y)|^a. $$ One sees that:

    Commutativity, associativity, the fact that $1*x=x*1=x$ for every $x$ are obvious. Furthermore, for every $y>1$, $x*y>x$ and for every $y<1$, $x*y<x$, and $(1/x)*(1/y)=1/(x*y)$, hence all there remains to check is that $x*y<xy$ for $x$ and $y$ greater than $1$. This reads as the fact that for every $x>1$ and $y>1$, $$ \log(x)|\log(x)|^a+\log(y)|\log(y)|^a<\log(xy)|\log(xy)|^a. $$ But $$ \log(xy)|\log(xy)|^a=\log(x)|\log(xy)|^a+\log(y)|\log(xy)|^a, $$ and $$ |\log(x)|^a<|\log(xy)|^a,\qquad |\log(y)|^a<|\log(xy)|^a, $$ and the logarithms are positive, hence the inequality holds.

Note that $x*x=x^b$ for every $x$, with $b=2^{1/(1+a)}$, hence $b$ may be any exponent between $1$ and $2$, for example, if $a=.7$, $b=1.5034$ and $.5*.5=.3527$.

More generally, one could define $z$ as the unique solution of the equation $u(z)=u(x)u(y)$ for a given increasing positive function $u$ such that $u(1/x)=1/u(x)$ for every positive $x$, and such that $u(x)u(y)<u(xy)$ for every $x$ and $y$ greater than $1$.

share|improve this answer
    
This is a very nice solution! However, it has infinite gradient at the points $xy = 1$, because the right-hand side of your first equation crosses zero and you have to take the $(1+a)$th root of that to get $\log z$. –  Rahul Aug 9 '11 at 20:32
    
@Rahul: yes, as may be guessed from the Excel plot the OP added to the question. –  Did Aug 17 '11 at 21:59
1  
I later realized that one can easily get rid of that issue by replacing $\log x \lvert \log x \rvert^a$ by some other increasing function of $\log x$ that has positive slope everywhere. Now I'd call it unconditionally a very nice solution :) –  Rahul Aug 17 '11 at 22:28

How about $f(a,b)=(ab)^p$, where $p$ is chosen less than $1$ for the strength you want. Maybe $3/4$ would suit your needs.

share|improve this answer
1  
Not associative. (In case it's relevant.) –  anon Aug 9 '11 at 17:14
    
Darn -- left out the requirement that f(1.0, N) = N. (I've added that above -- sorry.) –  Daniel R Hicks Aug 9 '11 at 17:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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