Subtracting functions on specified domains

Physics news on Phys.org
2thumbsGuy said:
What I've come to discover is that I want to understand how I can subtract f(x) on domain [b,c] from g(x) on domain [a,d].

Edit: I think I misread.
I need clarification. Do you mean f(x) is defined on more than [b,c], or f has domain [b,c]
 
both f(x) and g(x) have values outside of the defined domains, but I want to only consider the values within their respective defined domains.

I'll be using this in some software, so maybe it's best that I constrain the domains within the software instead of in the math, but I wanted to get all possible approaches before committing to a single answer.
 
2thumbsGuy said:
both f(x) and g(x) have values outside of the defined domains, but I want to only consider the values within their respective defined domains.

Okay that part is easy.
Define new functions F and G where
##F(x) = f(x)## if ##x \in [b,c]## and ##F(x) = 0## elsewhere.
Do the same with G.

Second question: do we know ##[b,c] \subset [a,d]##?
 
Thank you very much! This is familiar.

To your second question, the domains will vary according to circumstance. For this case we can use a = 1, b = 2, c = 3, d = 4. But they will change many, many times.
 
Actually, I think the programming solution would be the same as the math solution. As you say, f(x) if x∈[b,c] and F(x)=0 elsewhere, and the same for g(x). This is normal if/then scenario.

I know how I can do this! Thanks for helping me think through it.
 
Back
Top