Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Dual-output Function?

  1. Nov 23, 2008 #1
    "Dual-output" Function?

    This isn't homework: I am experimenting with factorization.

    Does anyone know of a function f(x) which for some value of x returns one value for f(x), but for every other value of x returns some other value?

    Example: I'm trying to find a function f(x), where

    x = 0, f(x) = 1
    x != 0, f(x) = 0

    My function is only dealing with non-negative integers, if that helps.

    I've already derived a function that does this, but it uses absolute values, which is a nuisance.

    Anyone know of anything like this?

    For reference, here is my formula:

    [tex]f(x) =\frac{1-\frac{\left|2x-1\right|}{2x-1}}{2} = \frac{\left|4x-2\right| - 4x-2}{8x-4}[/tex]
     
    Last edited: Nov 23, 2008
  2. jcsd
  3. Nov 23, 2008 #2

    Vid

    User Avatar

  4. Nov 23, 2008 #3

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    Re: "Dual-output" Function?

    That's the characteristic function of zero (Sloane's A000007). But your post seemed to focus on giving it a closed form. Why?
     
  5. Nov 24, 2008 #4

    HallsofIvy

    User Avatar
    Staff Emeritus
    Science Advisor

    Re: "Dual-output" Function?

    What exactly do you want? When you say "f(0)= 1, f(x)= 0 if x is not 0" you have already defined a function. And if you want a closed form, why is absolute value a "nuisance"?
     
  6. Nov 24, 2008 #5
    Re: "Dual-output" Function?

    Thanks to those who have responded, you've helped a lot.

    @Vid: The link you supplied helped me solve another problme I was working with, so thanks.

    @CRGreathouse: That, too, is of great help. I wasn't sure if 0^0 would be considered defined, but that greatly simplifies my procedure.

    @HallsofIvy: Yes, that techincally defines a function, but I was looking for a mathematical equation which would supply that result. Two ways are the one I supplies in ym OP, and f(x) = 0^x.

    Also, I called absolute value a nuisance because I am build an equation and I need to then invert it. If there are absolute values, then things get very tricky, by which I mean impossible to solve.
     
  7. Nov 24, 2008 #6

    Office_Shredder

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Re: "Dual-output" Function?

    It's interesting you decided f(x)=0^x is an equation that gives this, since 0^x has to be defined at x=0 separately anyway, so you haven't really gained anything. And there's no way in hell you're going to invert this sucker
     
  8. Nov 24, 2008 #7

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    Re: "Dual-output" Function?

    This function (regardless of whether you view it as a closed-form equation or not) can't be inverted. f(9) = f(3) = 0, so what would f^-1(0) be?
     
  9. Nov 24, 2008 #8
    Re: "Dual-output" Function?

    Terribly sorry, I misspoke/posted. By "invert," I meant not the function, but the final equation that I'm working on.
     
  10. Nov 25, 2008 #9

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    Re: "Dual-output" Function?

    Yes, but inverting the final equation will involve inverting that special function.
     
  11. Nov 25, 2008 #10

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    Re: "Dual-output" Function?

    Actually, I've decided that using the characteristic function of 0 essentially allows you to build piecewise functions, so perhaps you can simply invert piecewise.
     
  12. Nov 25, 2008 #11

    Ben Niehoff

    User Avatar
    Science Advisor
    Gold Member

    Re: "Dual-output" Function?

    If your function only needs to be defined over the integers, you can try

    [tex]f(n) = \frac{\sin \pi n}{n}[/tex]
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?