Wolfram.com
WolframAlpha.com
WolframCloud.com
Wolfram Language
Example Repository
Ready-to-use examples for the Wolfram Language
Primary Navigation
Categories
Astronomy
Audio Processing
Calculus
Cellular Automata
Chemistry
Complex Systems
Computer Science
Computer Vision
Control Systems
Creative Arts
Data Science
Engineering
Finance & Economics
Finite Element Method
Food & Nutrition
Geography
Geometry
Graphs & Networks
Image Processing
Life Sciences
Machine Learning
Mathematics
Optimization
Physics
Puzzles and Recreation
Quantum Computation
Signal Processing
Social Sciences
System Modeling
Text & Language Processing
Time-Related Computation
Video Processing
Visualization & Graphics
Alphabetical List
Submit a New Resource
Learn More about
Wolfram Language
Related Pages
Related Categories
Optimization
Computer Science
Physics
Quantum Computation
The Parameter-Shift Rule for Quantum Gates
Example Notebook
Open in Cloud
Download Notebook
T
h
e
e
x
p
e
c
t
e
d
v
a
l
u
e
o
f
a
c
i
r
c
u
i
t
i
n
r
e
l
a
t
i
o
n
t
o
a
m
e
a
s
u
r
e
m
e
n
t
o
p
e
r
a
t
o
r
A
v
a
r
i
e
s
s
m
o
o
t
h
l
y
w
i
t
h
t
h
e
c
i
r
c
u
i
t
'
s
g
a
t
e
p
a
r
a
m
e
t
e
r
s
θ
.
T
h
i
s
e
x
p
e
c
t
e
d
v
a
l
u
e
c
a
n
b
e
e
x
p
r
e
s
s
e
d
a
s
〈
A
(
θ
)
〉
.
T
h
i
s
i
m
p
l
i
e
s
t
h
a
t
t
h
e
d
e
r
i
v
a
t
i
v
e
s
∇
θ
〈
A
〉
a
r
e
w
e
l
l
–
d
e
f
i
n
e
d
,
a
l
l
o
w
i
n
g
f
o
r
t
h
e
a
p
p
l
i
c
a
t
i
o
n
o
f
g
r
a
d
i
e
n
t
d
e
s
c
e
n
t
.
A
n
y
u
n
i
t
a
r
y
g
a
t
e
c
a
n
b
e
c
a
s
t
i
n
t
h
e
f
o
r
m
U
=
i
θ
V
e
,
w
h
e
r
e
V
i
s
t
h
e
H
e
r
m
i
t
i
a
n
g
e
n
e
r
a
t
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p
l
e
x
E
x
p
a
n
d
/
/
S
i
m
p
l
i
f
y
O
u
t
[
3
]
=
C
o
s
[
θ
]
The gradient of
R
x
(
θ
)
is obtained with:
I
n
[
4
]
:
=
R
x
P
a
r
a
m
e
t
e
r
S
h
i
f
t
G
r
a
d
i
e
n
t
[
θ
_
]
=
1
2
(
R
x
E
x
p
e
c
t
e
d
V
a
l
u
e
[
θ
+
π
/
2
]
-
R
x
E
x
p
e
c
t
e
d
V
a
l
u
e
[
θ
-
π
/
2
]
)
/
/
S
i
m
p
l
i
f
y
O
u
t
[
4
]
=
-
S
i
n
[
θ
]
The parameter–shift rule
only
works for gates of the form
θ
G
where
2
G
=
1
. In other cases that do not fulfill these conditions, the
stochastic parameter–shift rule
must be used
.
External Links
QuantumCircuitOperator
QuantumMeasurementOperator
Source Metadata
Citation:
Killoran, N. (2020, May 24). The stochastic parameter-shift rule. PennyLane Demos.
See Also
Wolfram/QuantumFramework
Publisher Information
Contributed by:
Sebastián Rodríguez, César Guerra