Repository: Qiskit/qiskit

Issue:
GaussianSquare curve description has incorrect mean
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues -->

### Information

- **Qiskit Terra version**: whatever the documentation is using (not sure how to tell)
- **Python version**: 3
- **Operating system**: any

### What is the current behavior?
The description in the source code and documentation of the GaussianSquare class has

```
"risefall = (duration - width) / 2

        0 <= x < risefall

        f(x) = amp * exp( -(1/2) * (x - risefall/2)^2 / sigma^2) )

        risefall <= x < risefall + width

        f(x) = amp

        risefall + width <= x < duration

        f(x) = amp * exp( -(1/2) * (x - (risefall + width)/2)^2 / sigma^2) )"
```

as part of the description of the curve shape. 


### Steps to reproduce the problem
Look at the documentation at https://qiskit.org/documentation/stubs/qiskit.pulse.GaussianSquare.html?highlight=gaussiansquare#qiskit.pulse.GaussianSquare or find the GaussianSquare source code at https://qiskit.org/documentation/_modules/qiskit/pulse/library/parametric_pulses.html#GaussianSquare or on github or a local qiskit installation.


### What is the expected behavior?
According to the gaussian_square and gaussian definitions and code at https://github.com/Qiskit/qiskit-terra/blob/main/qiskit/pulse/library/continuous.py , we want the mean of the starting gaussian to be the point at which the curve becomes constant which is at 
`risefall = (duration - width) / 2`. 
This makes sense because if the curve reaches its peak at `risefall` and then becomes constant for `width` and then decreases again, this will take 
`(duration - width) / 2 + width + (duration - width) / 2 = duration`, 
and we want the pulse to last for `duration` so this is consistent.
However in the code, we set the mean as` risefall / 2`, which divides `(duration - width)` by 2 twice. The code itself is correct but the documentation is incorrect.


### Suggested solutions

Replace the curve description with

```
"risefall = (duration - width) / 2

        0 <= x < risefall

        f(x) = amp * exp( -(1/2) * (x - risefall)^2 / sigma^2) )

        risefall <= x < risefall + width

        f(x) = amp

        risefall + width <= x < duration

        f(x) = amp * exp( -(1/2) * (x - (risefall + width))^2 / sigma^2) )"
```

GaussianSquare curve description has incorrect mean
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues -->

### Information

- **Qiskit Terra version**: whatever the documentation is using (not sure how to tell)
- **Python version**: 3
- **Operating system**: any

### What is the current behavior?
The description in the source code and documentation of the GaussianSquare class has

```
"risefall = (duration - width) / 2

        0 <= x < risefall

        f(x) = amp * exp( -(1/2) * (x - risefall/2)^2 / sigma^2) )

        risefall <= x < risefall + width

        f(x) = amp

        risefall + width <= x < duration

        f(x) = amp * exp( -(1/2) * (x - (risefall + width)/2)^2 / sigma^2) )"
```

as part of the description of the curve shape. 


### Steps to reproduce the problem
Look at the documentation at https://qiskit.org/documentation/stubs/qiskit.pulse.GaussianSquare.html?highlight=gaussiansquare#qiskit.pulse.GaussianSquare or find the GaussianSquare source code at https://qiskit.org/documentation/_modules/qiskit/pulse/library/parametric_pulses.html#GaussianSquare or on github or a local qiskit installation.


### What is the expected behavior?
According to the gaussian_square and gaussian definitions and code at https://github.com/Qiskit/qiskit-terra/blob/main/qiskit/pulse/library/continuous.py , we want the mean of the starting gaussian to be the point at which the curve becomes constant which is at 
`risefall = (duration - width) / 2`. 
This makes sense because if the curve reaches its peak at `risefall` and then becomes constant for `width` and then decreases again, this will take 
`(duration - width) / 2 + width + (duration - width) / 2 = duration`, 
and we want the pulse to last for `duration` so this is consistent.
However in the code, we set the mean as` risefall / 2`, which divides `(duration - width)` by 2 twice. The code itself is correct but the documentation is incorrect.


### Suggested solutions

Replace the curve description with

```
"risefall = (duration - width) / 2

        0 <= x < risefall

        f(x) = amp * exp( -(1/2) * (x - risefall)^2 / sigma^2) )

        risefall <= x < risefall + width

        f(x) = amp

        risefall + width <= x < duration

        f(x) = amp * exp( -(1/2) * (x - (risefall + width))^2 / sigma^2) )"
```



Discussion:
If still available, I would like to pick this up as my first contribution to qiskit.
Thanks! It seems to be still available. I'm not sure where exactly someone needs to go to change the value but all the links I can find are in the original comment.
Assigned @apcarrik 😄 . Please let me know if you have questions or need help.
> Assigned @apcarrik 😄 . Please let me know if you have questions or need help.

Great, thanks!
If still available, I would like to pick this up as my first contribution to qiskit.
Thanks! It seems to be still available. I'm not sure where exactly someone needs to go to change the value but all the links I can find are in the original comment.
Assigned @apcarrik 😄 . Please let me know if you have questions or need help.
> Assigned @apcarrik 😄 . Please let me know if you have questions or need help.

Great, thanks!

Resolving patch:
diff --git a/qiskit/pulse/library/parametric_pulses.py b/qiskit/pulse/library/parametric_pulses.py
--- a/qiskit/pulse/library/parametric_pulses.py
+++ b/qiskit/pulse/library/parametric_pulses.py
@@ -132,7 +132,7 @@ class Gaussian(ParametricPulse):
 
     .. math::
 
-        f(x) = amp * exp( -(1/2) * (x - duration/2)^2 / sigma^2) )  ,  0 <= x < duration
+        f(x) = amp * exp( -(1/2) * (x - duration/2)^2 / sigma^2 )  ,  0 <= x < duration
     """
 
     def __init__(
@@ -215,7 +215,7 @@ class GaussianSquare(ParametricPulse):
 
         0 <= x < risefall
 
-        f(x) = amp * exp( -(1/2) * (x - risefall/2)^2 / sigma^2) )
+        f(x) = amp * exp( -(1/2) * (x - risefall)^2 / sigma^2 )
 
         risefall <= x < risefall + width
 
@@ -223,8 +223,7 @@ class GaussianSquare(ParametricPulse):
 
         risefall + width <= x < duration
 
-        f(x) = amp * exp( -(1/2) * (x - (risefall + width)/2)^2 / sigma^2) )
-
+        f(x) = amp * exp( -(1/2) * (x - (risefall + width))^2 / sigma^2 )
     """
 
     def __init__(
@@ -356,7 +355,7 @@ class Drag(ParametricPulse):
 
     .. math::
 
-        Gaussian(x, amp, sigma) = amp * exp( -(1/2) * (x - duration/2)^2 / sigma^2) )
+        Gaussian(x, amp, sigma) = amp * exp( -(1/2) * (x - duration/2)^2 / sigma^2 )
 
     References:
         1. |citation1|_


Test patch: