# Mathematical function for four corelated attributes

I have $4$ attributes $A,B,C,D$ each of them takes value between $[0,1]$ The more $A$ and $B$, the more the function value is. The more $C$ and $D$, the less the function value is. if C or D equals "one" the function value is one.

How can I model this function. I tried: $|AB-CD|$ but did not work.

UPDATE: I want this function also to return value between [0,1]

-
how about $AB(1-C)(1-D)$ – Seyhmus Güngören Aug 25 '12 at 13:19
@SeyhmusGüngören if C is 1, then the whole function will be 0. – mathguy Aug 25 '12 at 13:21
@Sidd my function is $\infty$ at $C=1$? – Seyhmus Güngören Aug 25 '12 at 13:23
@SeyhmusGüngören Wait just to clarify, if C=1, then wouldn't your function do AB(1-C)(1-D) = AB(1-1)(1-D) AB(0)(1-D) = 0? – mathguy Aug 25 '12 at 13:24
ohhhhhh sorrrrryyy! I read completely mistakenly! I read as $0$ not $1$ you are right @Sidd – Seyhmus Güngören Aug 25 '12 at 13:26

$$f(A,B,C,D)=AB(1-C)(1-D)+1$$ is increasing in $A$ and $B$ and decreasing in $C$ and $D$ as well as it satifies $f(A,B,C,D)=1\,\, for\,\, C=1\, or D=1$.

EDIT: Of course there are infinitely many such functions satisfying your conditions. Above is probably one of the simplest one.

One other thing is that one can not define $f(A,B,C,D)\in[0,1]$ satisfying your conditions and still continuous. Here is the reason:

$f$ is decreasing in $C$ and $D$. Let $f$ be somewhere in $[0,1]$ for given $A,B$. As $f\leq1$, $f$ starts decreasing in $C$ and $D$ at most from $1$ and for $C$, $D$, or both very close to $1$ we have $f<1+\Delta$ where $\Delta$ is not arbitrarily close to $0$ when $C\rightarrow 1$ or $D\rightarrow 1$ indicating that $0\leq f(x+\Delta)-f(x)\leq \Delta$ can not be bounded by arbitrary $\Delta$ $\rightarrow$ discontinuity at $C=1$, $D=1$ or $C=1,D=1$

-
Oh wow..Very nice, I was playing around with exponents and couldnt figure it out. – mathguy Aug 25 '12 at 13:30
@Sidd )))) simple thinking sometimes helps – Seyhmus Güngören Aug 25 '12 at 13:32
Thanks for all of your answers , it was really helpful Now let us play with this more :) , If I want the f(a,b,c,d) to return value between [0,1] is it possible ?? – M.M Aug 25 '12 at 14:16
@Mohammed You cannot define such a continuous function. I will put it to EDIT. Meanwhile, have a look at this page: meta.math.stackexchange.com/questions/3399/… – Seyhmus Güngören Aug 25 '12 at 16:18
thanks for your update. but what about: f(a,b,c,d)= $$(a*b)^{(1/(c*d))}$$ – M.M Aug 25 '12 at 19:05