Value of x that maximises the integral in a numerical integrator

Click For Summary

Discussion Overview

The discussion revolves around the possibility of determining a value of ##x \in [a,b]## that maximizes the product of two functions, ##f(x)g(x)##, within the context of a numerical integration framework, specifically using the GSL adaptive integrator gsl_qags in C++. Participants explore the relationship between maximizing an integrand and the process of integration.

Discussion Character

  • Debate/contested
  • Technical explanation
  • Conceptual clarification

Main Points Raised

  • Some participants suggest that using a numerical integrator to find the maximum of ##f(x)g(x)## may not be the best approach and recommend using optimization tools instead.
  • Others propose printing out sampled values of the integrand during integration to visually inspect for the maximum.
  • There is a contention regarding whether it makes sense to ask for a value of ##x## that maximizes an integral over a range, with some arguing that this is conceptually flawed.
  • Some participants discuss the possibility of splitting the integral at a point ##m## that maximizes the integrand, but raise concerns about the potential for multiple maxima in certain cases.
  • One participant mentions that if the maximum of ##f(x)g(x)## exists, it will occur at the roots of its derivative, while others clarify that maximizing an indefinite integral is not applicable.
  • Clarifications about terminology arise, particularly regarding the distinction between definite and indefinite integrals and the concept of antiderivatives.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the original question, with multiple competing views on the relationship between maximizing an integrand and the process of integration. The discussion remains unresolved as the original poster has not clarified their intent.

Contextual Notes

There are limitations in understanding the original question due to the ambiguity in the terms used by the original poster, particularly regarding the distinction between definite and indefinite integrals and the concept of maximizing integrals versus functions.

CAF123
Gold Member
Messages
2,918
Reaction score
87
Consider an integral of form $$\int_a^b dx f(x) g(x).$$ Is it possible to tell a numerical integrator to spit out the value of ##x \in [a,b]## that maximises the value of ##f(x)g(x)##? I'm mostly interested in incorporating this into some code I have for adaptive integrator gsl_qags in C++.

Thanks!
 
Technology news on Phys.org
This link directs me simply to google -> in any case I suppose the gsl_qags will use some stepwise increment over the integration domain. Is it maybe simpler to print out the values sampled in the integration domain together with the value of the integrand? Then I can see the maximum by inspection. Thanks.
 
  • Like
Likes   Reactions: pbuk
@DrClaude Thanks, sorry I see I was not careful with my expression, I meant the value of the integral in my above post.
 
Sorry, but I don't understand. Let's start from the beginning: what function do you want to maximise, and with respect to what parameter/variable?
 
  • Like
Likes   Reactions: pbuk
CAF123 said:
I meant the value of the integral in my above post.

That doesn't make sense. You originally asked:

CAF123 said:
Is it possible to tell a numerical integrator to spit out the value of ##x \in [a,b]## that maximises the value of ##f(x)g(x)##?

If you meant maximizes the integral, then you would be asking for a particular value of ##x## that maximizes an integral over a range of values of ##x##. That doesn't make sense.
 
PeterDonis said:
That doesn't make sense. You originally asked:
If you meant maximizes the integral, then you would be asking for a particular value of ##x## that maximizes an integral over a range of values of ##x##. That doesn't make sense.

I suppose it might make sense if he/she wants---for some unknown reason--- to spit up the integral as
$$\int_a^b f(x) g(x) \, dx = \int_a^m f(x) g(x) \, dx + \int_m^b f(x) g(x) \, dx,$$
where ##m = \text{arg max}_{x \in [a,b]} \, f(x) g(x).##

Even then the problem may be ill-posed, because for some nasty functions ##f,g## the integrand could have hundreds of values of ##m##--that is, hundreds of points that maximize the integrand.
 
Ray Vickson said:
I suppose

Rather than suppose, I would like the OP to give more information about what the actual problem is.
 
  • #10
If looking for a maximum x for f(x)g(x), and assuming that f(x)g(x) has a maximum, then the maximum value will occur at one of the roots of the derivative of f(x)g(x).

If looking for the maximum of the indefinite integral of f(x)g(x), and assuming that there is a maximum, then the maximum value will occur at one of the roots of f(x)g(x).

If looking for a maximum integral range, and if the entire range of the integral results in "positive" areas, then the maximum is the entire range. Otherwise you're looking for a range with a mix of "positive" and "negative" areas that has the maximum "positive" area, which seems complicated.
 
  • #11
rcgldr said:
If looking for the maximum of the indefinite integral of f(x)g(x), and assuming that there is a maximum, then the maximum value will occur at one of the roots of f(x)g(x).

This doesn't make sense. You don't maximize an integral over a range of values of ##x## by picking one value of ##x##. See my response to the OP in post #7.

And in fact, you can't maximize an indefinite integral at all since it's indefinite. You might mean maximize the function of ##x## that is the antiderivative of the function ##f(x) g(x)##, but that's not quite the same thing.
 
  • #12
PeterDonis said:
you can't maximize an indefinite integral at all since it's indefinite. You might mean maximize the function of ##x## that is the antiderivative of the function ##f(x) g(x)##, but that's not quite the same thing.
I meant antiderivative. "In calculus, an antiderivative, primitive function, primitive integral or indefinite integral ... "

https://en.wikipedia.org/wiki/Antiderivative
 
  • #13
rcgldr said:
I meant antiderivative. "In calculus, an antiderivative, primitive function, primitive integral or indefinite integral ... "

https://en.wikipedia.org/wiki/Antiderivative

The OP started this all by stating a definite integral ##\int_a^b f(x) g(x) \, dx.##
 
  • #14
I am closing this thread because there is no point in speculating about what the OP meant. The OP needs to tell us, and that hasn't happened.

@CAF123 if you want to clarify what you meant, please PM me; if I get sufficient clarification I can reopen the thread for discussion.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 15 ·
Replies
15
Views
4K
  • · Replies 31 ·
2
Replies
31
Views
5K
  • · Replies 50 ·
2
Replies
50
Views
6K
  • · Replies 21 ·
Replies
21
Views
4K
  • · Replies 19 ·
Replies
19
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
6K