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

Subtracting the overlap of functions

  1. Nov 26, 2014 #1
    I have a fun project I'm trying to do and it's been a good number of years since I did any math higher than algebra. As such, I don't know how to approach this and would like some pointers.

    I am trying to understand how I can subtract one function from another ONLY where the two functions overlap. The first part is easy enough (algebra), but the caveat is challenging to my grey matter. Can anyone advise me on how to approach this?

    Thank you,

    2thumbs
     
  2. jcsd
  3. Nov 26, 2014 #2

    ShayanJ

    User Avatar
    Gold Member

    If two functions overlap in some region, it means they're both non-zero in that region. And in the regions where there is no overlap between them, it means at least one of them is zero in that region.So when you write [itex] f(x)-g(x) [/itex], it only changes the value of the functions in the regions that they have overlap and so you don't have to do anything special, just subtract them!
     
  4. Nov 26, 2014 #3
    I didn't think it would be that simple... let me just do that and see what I come up with. Thanks!
     
  5. Nov 26, 2014 #4

    ShayanJ

    User Avatar
    Gold Member

    Just one more point. If you write [itex] f(x)-g(x) [/itex], and then calculate it in a region where f(x)=0, although there is no overlap, g(x) will change because it gets multiplied by a minus sign. So a little modification to a simple subtraction is needed.
     
  6. Nov 26, 2014 #5
    OK, I find it to be desirable where f(x) >= 0 and g(x) >= 0, so how can I restrict the function to that range before performing the subtraction? Or is it specific to the function?

    EDIT

    Here are the graphs I came up with to evaluate your statement:

    Graph 1 ( f(x) )
    http://www.wolframalpha.com/input/?i=-x^4+3x

    Graph 2 ( g(x) )
    http://www.wolframalpha.com/input/?i=-x^2+4x

    Graph 3 ( g(x) - f(x) )

    You can see on graph 3 the function at the right goes happily off to infinity on the y axis. Obviously this is because f(x) goes off to negative infinity faster than g(x) goes to negative infinity, so when inverted, f(x) wins. But if I stop them at zero before the subtraction, then I get my tidy little graph... I think
     
    Last edited: Nov 26, 2014
  7. Jan 17, 2015 #6

    Svein

    User Avatar
    Science Advisor

    It depends on what you are trying to do when they do not overlap. A sketch: Let A be the region where they overlap, define XA as 1 on A and 0 outside A. Then define f1 = f* XA and g1=g*XA. Now f1-g1 = f-g on A and 0 outside A.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Subtracting the overlap of functions
Loading...