1
$\begingroup$

Say I have an equation where the value is $m-4$ when $m \ge 5, n=3,4$; $n-4$ when $n \ge 5, m=3,4$; and $m+n-9$ when $m,n \ge 5$. How can I combine these all into one statement? How can I combine them with further ones, like $m-6$ where $m \ge 7, n \in [3,6]$, etc?

  • 0
    @ Eugene: The question will be clearer if you could give appropriate spacing.2010-11-14
  • 0
    is this a little clearer? I used semicolons instead.2010-11-14
  • 1
    So $f(m,n)=$ something? You could look into using the unit step function or Iverson brackets.2010-11-14
  • 0
    You can't combine them with that last one, because $m-6$ is not equal to $m-4$ and there is overlap with the condition for $m-4$. (And with the condition for $m+n-9$.)2010-11-14
  • 0
    well, I intend to add these cases all together in the end; if $m,n \ge 3$, then $f(m,n)=3m+3n-10$, but if either $m$, $n$, or both are $\ge 5$, then add on those things in the question, and similarly for 7, 9, etc.2010-11-14
  • 0
    @Eugene: I don't understand your comment. It sounds like you have contradictory definitions for some values. E.g., if both are greater than or equal to 5, then they are also greater than or equal to 3.2010-11-14
  • 0
    yes... I'm saying that if they are ALSO greater than or equal to 5, then add those things as well.2010-11-14

3 Answers 3

1

I think for the first statement the following formula should work with the given domain: $f(m,n)=(m-4)H[m-5]+(n-4)H[n-5]+H[m-5]H[n-5]$ where H is the heaviside step function.

I think the phrasing for the second part can be improved, judging from your comments above. From what I gather you can add terms such as $(m-6)H[m-7]$ for the later conditions.

2

For your first question, it turns out that on the values you've specified, $f(m,n) = \max(m-5,0)+\max(n-5,0) + 1$. In general, if you're trying to get a handle on a function of many variables, it's a good idea to see if it can be separated into a combination of functions of fewer variables.

For your second question, if what you mean is that you want to add $m - 6$ to the output if certain conditions are satisfied, and leave it alone otherwise, you could define $g(m,n) = f(m,n) + h(m,n)$, where $h(m,n)$ is either $m-6$ or zero depending on etc etc. Or you could just write out all the cases of $g(m,n)$, which is the systematic but mind-numbing way.

2

$$ f(n,m) = \begin{cases} m-4 & m \geq 5,\, n=3,4, \\ n-4 & n \geq 5,\, m=3,4, \\ m+ n - 9 & m,n \geq 5. \end{cases}$$