Subtracting functions on specified domains

Click For Summary
The discussion focuses on subtracting functions f(x) and g(x) defined on specific domains, [b,c] and [a,d], respectively. The main goal is to disregard values outside these domains when performing the subtraction. A suggested solution involves defining new functions, F and G, that take the value of f(x) and g(x) within their respective domains and are zero elsewhere. The conversation also highlights the variability of the domains and concludes that the programming approach aligns with the mathematical solution. Ultimately, the user feels confident in their understanding and approach to the problem.
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.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K