Smith Sphere

The smith chart is a nomogram used frequently in RF/Microwave Engineering. Since its inception it has been recognised that projecting the chart onto the reimen sphere [1].

[1]H. . Wheeler, “Reflection Charts Relating to Impedance Matching,” IEEE Transactions on Microwave Theory and Techniques, vol. 32, no. 9, pp. 1008–1021, Sep. 1984.


In [1]:
#from IPython.display import SVG
#SVG('pics/smith_sphere.svg')
from printer import Format, Fmt

In [2]:
from ga import Ga
from mv import Mv
from sympy import *
Format()

(ga,er,ex,es) = Ga.build('e_r e_x e_s',g=[1,1,1])
(gaz,zr,zx) = Ga.build('z_r z_x',g=[1,1])

Bz = er^ex # impedance plance 
Bs = es^ex # reflection coefficient plane
Bx = er^es
I = ga.I()

def down(p, N):
    '''
    stereographically project a vector in G3 downto the bivector N
    '''
    n= -1*N.dual()
    return -(n^p)*(n-n*(n|p)).inv() 

def up(p):
    '''
    stereographically project a vector in G2 upto the space G3
    '''
    if (p^Bz).obj == 0:
        N = Bz
    elif  (p^Bs).obj == 0:
        N = Bs
        
    n = -N.dual()
    
    return   n + 2*(p*p + 1).inv()*(p-n)
    
a,b,c,z,s,n = [ga.mv(k,'vector') for k in ['a','b','c','z','s' ,'n']]

Starting with an impedance vector $z$, defined by a vector in the impedance plane $B_z$, this vector has two scalar components ( $z^r$, $z^x$) known as resistance and reactance


In [3]:
Bz.dual()


Out[3]:
\begin{equation*} - e_{s} \end{equation*}

In [4]:
Bz.is_zero()


Out[4]:
False

In [5]:
z = z.proj([er,ex])
z


Out[5]:
\begin{equation*} z^{r} e_{r} + z^{x} e_{x} \end{equation*}

stereographically up-projecting this onto the sphere to point $p$,


In [6]:
p = up(z)
p


Out[6]:
\begin{equation*} \frac{2 z^{r}}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} e_{r} + \frac{2 z^{x}}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} e_{x} + \frac{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} - 1}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} e_{s} \end{equation*}

In [7]:
#Mv(p.norm2(),'scalar',ga=ga)
p.norm2().simplify()


Out[7]:
1

If we stereo-project this back onto the impedance plane


In [8]:
down(p, Bz)


Out[8]:
\begin{equation*} z^{r} e_{r} + z^{x} e_{x} \end{equation*}

In [9]:
down(p,Bs).simplify()


Out[9]:
\begin{equation*} \frac{2 z^{x}}{{\left ( z^{r} \right )}^{2} + 2 z^{r} + {\left ( z^{x} \right )}^{2} + 1} e_{x} + \frac{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} - 1}{{\left ( z^{r} \right )}^{2} + 2 z^{r} + {\left ( z^{x} \right )}^{2} + 1} e_{s} \end{equation*}

In [10]:
(z-er)*(z+er).inv()


Out[10]:
\begin{equation*} \frac{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} - 1}{{\left ( z^{r} \right )}^{2} + 2 z^{r} + {\left ( z^{x} \right )}^{2} + 1} - \frac{2 z^{x}}{{\left ( z^{r} \right )}^{2} + 2 z^{r} + {\left ( z^{x} \right )}^{2} + 1} e_{r}\wedge e_{x} \end{equation*}

In [11]:
p


Out[11]:
\begin{equation*} \frac{2 z^{r}}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} e_{r} + \frac{2 z^{x}}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} e_{x} + \frac{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} - 1}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} e_{s} \end{equation*}

In [12]:
R=((-pi/4)*Bx).exp()
R


Out[12]:
\begin{equation*} \frac{\sqrt{2}}{2} - \frac{\sqrt{2}}{2} e_{r}\wedge e_{s} \end{equation*}

In [13]:
R*p*R.rev()


Out[13]:
\begin{equation*} \frac{- {\left ( z^{r} \right )}^{2} - {\left ( z^{x} \right )}^{2} + 1}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} e_{r} + \frac{2 z^{x}}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} e_{x} + \frac{2 z^{r}}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} e_{s} \end{equation*}

In [14]:
down(R*p*R.rev(),Bz)


Out[14]:
\begin{equation*} \frac{- {\left ( z^{r} \right )}^{2} - {\left ( z^{x} \right )}^{2} + 1}{{\left ( z^{r} \right )}^{2} - 2 z^{r} + {\left ( z^{x} \right )}^{2} + 1} e_{r} + \frac{2 z^{x}}{{\left ( z^{r} \right )}^{2} - 2 z^{r} + {\left ( z^{x} \right )}^{2} + 1} e_{x} \end{equation*}

In [15]:
Fmt([R,R])


Out[15]:
\begin{equation*} \begin{array}{c} \left [ \frac{\sqrt{2}}{2} - \frac{\sqrt{2}}{2} e_{r}\wedge e_{s}, \right. \\ \left. \frac{\sqrt{2}}{2} - \frac{\sqrt{2}}{2} e_{r}\wedge e_{s}\right ] \\ \end{array}\end{equation*}

In [16]:
Fmt((R,p))


Out[16]:
\begin{equation*} \begin{array}{c} \left ( \frac{\sqrt{2}}{2} - \frac{\sqrt{2}}{2} e_{r}\wedge e_{s}, \right. \\ \left. \frac{2 z^{r}}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} e_{r} + \frac{2 z^{x}}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} e_{x} + \frac{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} - 1}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} e_{s}\right ) \\ \end{array}\end{equation*}

In [16]: