# Analytic Solution: Hertzian Dipole Gaussian Pulse Source

The analytical solution to the Hertzian Dipole (with a Gaussian pulse source) problem for comparison with the FDTD simulation.

With open source code.

## Analytical Solution

 A Hertzian Dipole consisting of two points of charge +q and -q centered around the origin and separated by distance d and observed at a point r (r >> d). From Griffiths pp. 444-448

The Formula for a Hertzian Dipole with a Gaussian Pulse stimulus is:

 Eqn:8.1
 Eqn:8.2

### Maxima Input

The Analytical solution was calculated by Maxima.
The formulas given to Maxima are as follows:
(See Analytic Hertzian Dipole – Continuous Sine Wave Source for derivation of the formulas.)

```/* analytical solution, gaussian pulse */

display2d:false;

gp(x) := %e^(-((t - t0 - x/c)/td)^2);

rp: r * (1 - d/(2 * r) * cos(theta));
rm: r * (1 + d/(2 * r) * cos(theta));
rpd: (1/r) * (1 + d/(2 * r) * cos(theta));
rmd: (1/r) * (1 - d/(2 * r) * cos(theta));

vp: gp(rp) * rpd;
vm: gp(rm) * rmd;

mu0: (1 / (epsilon0 * c^2 ));

a: (mu0 * q0  * d / (4 * %pi * r)) * (-2*(t-t0 -r/c)*%e^-((t-t0 -r/c)^2/td^2)/td^2);
daz: diff (a, t);

dvpr: diff(vp,r);
dvmr: diff(vm,r);
dvr: q0/(4 * %pi * epsilon0) * (dvpr - dvmr) ;

dvpth: diff(vp,theta);
dvmth: diff(vm,theta);
dvth: q0/(4 * %pi * epsilon0 * r) * (dvpth - dvmth) ;

ex: -((dvr * sin(theta) * cos(phi)) + (dvth * cos(theta) * cos(phi))) ;
ey: -((dvr * sin(theta) * sin(phi)) + (dvth * cos(theta) * sin(phi))) ;
ez: -((dvr * cos(theta)) - (dvth * sin(theta)) + daz) ;

kill(all);
```

### Maxima Output

The results of Maxima calculations (raw Maxima output converted to C):

```// gaussian pulse
ez = (q0 * sin( theta ) * (d * (1 - d * cos( theta ) / (2 * r)
)  * (-r * (d * cos( theta ) / (2 * r)
+ 1)  / c
- t0 + t)  * exp((-(pow((-r * (d * cos( theta ) / (2 * r)
+ 1)  / c
- t0 + t)  , (2) )  / pow(td , (2) )
) ) )  * sin( theta ) / (c * r * pow(td , (2) ) )
- d * exp((-(pow((-r * (d * cos( theta ) / (2 * r)
+ 1)  / c
- t0 + t)  , (2) )  / pow(td , (2) )
) ) )  * sin( theta ) / (2 * pow(r , (2) ) )
+ d * (d * cos( theta ) / (2 * r)
+ 1)  * (-r * (1 - d * cos( theta ) / (2 * r)
)  / c
- t0 + t)  * exp((-(pow((-r * (1 - d * cos( theta ) / (2 * r)
)  / c
- t0 + t)  , (2) )  / pow(td , (2) )
) ) )  * sin( theta ) / (c * r * pow(td , (2) ) )
- d * exp((-(pow((-r * (1 - d * cos( theta ) / (2 * r)
)  / c
- t0 + t)  , (2) )  / pow(td , (2) )
) ) )  * sin( theta ) / (2 * pow(r , (2) ) )
)  / (4 * pi * epsilon0 * r)
- q0 * cos( theta ) * (2 * (1 - d * cos( theta ) / (2 * r)
)  * (d * cos( theta ) / (2 * c * r)
- (d * cos( theta ) / (2 * r)
+ 1)  / c
)  * (-r * (d * cos( theta ) / (2 * r)
+ 1)  / c
- t0 + t)  * exp((-(pow((-r * (d * cos( theta ) / (2 * r)
+ 1)  / c
- t0 + t)  , (2) )  / pow(td , (2) )
) ) )  / (r * pow(td , (2) ) )
+ (1 - d * cos( theta ) / (2 * r)
)  * exp((-(pow((-r * (d * cos( theta ) / (2 * r)
+ 1)  / c
- t0 + t)  , (2) )  / pow(td , (2) )
) ) )  / pow(r , (2) )
- d * cos( theta ) * exp((-(pow((-r * (d * cos( theta ) / (2 * r)
+ 1)  / c
- t0 + t)  , (2) )  / pow(td , (2) )
) ) )  / (2 * pow(r , (3) ) )
- 2 * (d * cos( theta ) / (2 * r)
+ 1)  * (-(1 - d * cos( theta ) / (2 * r)
)  / c
- d * cos( theta ) / (2 * c * r)
)  * (-r * (1 - d * cos( theta ) / (2 * r)
)  / c
- t0 + t)  * exp((-(pow((-r * (1 - d * cos( theta ) / (2 * r)
)  / c
- t0 + t)  , (2) )  / pow(td , (2) )
) ) )  / (r * pow(td , (2) ) )
- (d * cos( theta ) / (2 * r)
+ 1)  * exp((-(pow((-r * (1 - d * cos( theta ) / (2 * r)
)  / c
- t0 + t)  , (2) )  / pow(td , (2) )
) ) )  / pow(r , (2) )
- d * cos( theta ) * exp((-(pow((-r * (1 - d * cos( theta ) / (2 * r)
)  / c
- t0 + t)  , (2) )  / pow(td , (2) )
) ) )  / (2 * pow(r , (3) ) )
)  / (4 * pi * epsilon0)
+ d * q0 * exp((-(pow((-t0 + t - r / c
)  , (2) )  / pow(td , (2) )
) ) )  / (2 * pi * pow(c , (2) )  * epsilon0 * r * pow(td , (2) ) )
- d * q0 * pow((-t0 + t - r / c
)  , (2) )  * exp((-(pow((-t0 + t - r / c
)  , (2) )  / pow(td , (2) )
) ) )  / (pi * pow(c , (2) )  * epsilon0 * r * pow(td , (4) ) )
)  ; /*  0  */
```

## Open Source Software

• analysis.cpp .cpp file (analytical solution, courtesy of Maxima)