The second output is the expression, EXP(-i*%phi/2)*0.7071067811865476+0.7071067811865475i
While the expression is ambiguous, a closer look reveals that it is structured correctly:
Mul(Function('EXP',Div(Mul((-0-1j),Parameter('phi')),2),<ufunc 'exp'>),(0.7071067811865476+0.7071067811865475j))
The exponential is multiplied by the complex number.
In the defgate, it's clear this is not the case. The expression is the exponential multiplied by the real part of the complex number, while the imaginary part is then added after the fact. Ie:
(a+bi)*exp(theta)
vs
a*exp(theta) + bi
A closer look at the matrix reveals this to be the case:
Code Snippet
Error Output
The first defgate outputs as expected.
The second output is the expression,
EXP(-i*%phi/2)*0.7071067811865476+0.7071067811865475i
While the expression is ambiguous, a closer look reveals that it is structured correctly:Mul(Function('EXP',Div(Mul((-0-1j),Parameter('phi')),2),<ufunc 'exp'>),(0.7071067811865476+0.7071067811865475j))
The exponential is multiplied by the complex number.In the defgate, it's clear this is not the case. The expression is the exponential multiplied by the real part of the complex number, while the imaginary part is then added after the fact. Ie:
(a+bi)*exp(theta)
vs
a*exp(theta) + bi
A closer look at the matrix reveals this to be the case:
Add(Mul(Function('EXP',Div(Mul((-0-1j),Parameter('phi')),(2+0j)),<ufunc 'exp'>),(0.7071067811865476+0j)),0.7071067811865475j)