I want to integrate a function from 0 to +inf, figured as below.
It goes to 0 rapidly outside a small interval centered at x=1. The positions of the two maxima are unknown. The positions of the minima is known.
I want to integrate a function from 0 to +inf, figured as below.
It goes to 0 rapidly outside a small interval centered at x=1. The positions of the two maxima are unknown. The positions of the minima is known.
Copyright © 2021 Jogjafile Inc.

If you know the width of the pulse, but don't know its location you will have to scan your domain using steps 50% of the width.
You can get quad to this this for you using the
pointsargument. However, quad has also a limit of how many times to sample a function, so increase that accordingly.Here an example using a standard quad call and a call with the recommended parameters
The
r1[0]vanishes because quad don't realize that there those pulses exist,r1[0]decreases linearly with the width of the pulse, however the it becomes slower as the pulses becomes narrower.