Overview
rfMaxima is a library of functions for the Maxima computer algebra system for the analysis of linear RF and microwave circuits. The network parameters of a circuit are derived symbolically from the solution of its Kirchhoff current and voltage law equations and are subsequently evaluated and plotted numerically. Definitions and conversion formulas follow [1]; stability and gain follow [2]. Expressions can be exported to TeX and HTML, and figures to EPS and PNG.
Two-port parameters
The ABCD, inverse ABCD, G, H, S, Y and Z representations are obtained from a solved equation
set in the port variables v_in, i_in, v_out and
i_out, and are converted into one another by the formulas of [1, Table 4.2]. Both
port currents are defined as flowing into the network; the ABCD matrix is defined with the output
current flowing out, and the inverse ABCD matrix is J·T−1·J
with J = diag(1, −1). Building blocks are provided for a series impedance, a shunt
admittance, an ideal transformer, a gyrator, a nullor, Π and T networks, and lossless and lossy
transmission lines. For a series impedance z, Solution2ABCD returns
[[1, z], [0, 1]].
Multiport and mixed-mode parameters
A three-port admittance matrix is converted to scattering parameters referred to independent real impedances Z1, Z2, Z3; for equal impedances the result equals (I − ZrefY)(I + ZrefY)−1. Standard four-port scattering parameters are transformed to mixed-mode parameters by M·S·MT [3], with ports 1–2 and 3–4 forming the two balanced pairs. For an ideal balanced through connection, the transformation yields Sdd21 = Scc21 = 1 and no mode conversion.
Stability and gain
The Rollett stability factor K = (1 − |S11|² − |S22|² + |Δ|²)/(2|S12S21|) [4], the geometric stability factors μ and μ′ [5], the maximum stable gain |S21/S12| and Mason’s unilateral power gain U [6] are computed symbolically or for a given matrix. The transit frequency is the solution of |h21| = 1 and the maximum frequency of oscillation the solution of U = 1. A lossless reciprocal two-port yields K = 1. For S11 = S22 = 0, S12 = 0.1 and S21 = 2, the library returns K = 2.6, a maximum stable gain of 20 (13.0 dB) and U = 5.64 (7.5 dB).
Noise
The output response of an internal noise source is referred to the input through the ABCD matrix, which yields the equivalent input noise voltage and current generators [7]; the noise factor follows from their variances. For passive networks in thermal equilibrium, the noise-wave correlation matrix C = kBT(I − SSH) is obtained from Bosma’s theorem [8]. A series resistance of 25 Ω in a 50 Ω system yields a noise factor of 1.5 (1.76 dB), equal to the inverse of its available gain; a matched 3 dB attenuator yields 2.
Transmission lines and waveguides
The propagation constant and the characteristic impedance are computed from the per-unit-length parameters, which in turn are recovered from γ and Z0, together with the phase velocity, the group velocity and the group-velocity dispersion β2 = d²β/dω². The waveguide example evaluates the conductor loss of the TE10 mode of a WR-10 guide fabricated in Ti6Al4V by selective laser melting [9]; for a smooth conductor, the attenuation is 24–34 dB/m between 75 and 110 GHz.
Smith chart
Reflection coefficients Γ = (z − 1)/(z + 1), with z normalised to Z0, are plotted on a grid of constant-resistance circles r = 0, 0.2, 0.5, 1, 2, 5 and constant-reactance arcs x = 0, ±0.2, ±0.5, ±1, ±2, ±5. The grid is parametrised by r = tan u and x = tan u, so that every curve closes at Γ = +1, and is drawn with equal axis scales. Traces are given as parametric expressions or as lists of numerically evaluated points.
Limitations. rfMaxima is a symbolic library, not a circuit simulator: the
circuit equations are written by the user, and no netlist import is provided. Symbolic
expressions can grow beyond practical evaluation; the real part of S11 of the
lossy waveguide section contains approximately 3 × 105 characters and is
therefore evaluated numerically before plotting. The noise-wave functions apply to passive
networks in thermal equilibrium only; Gamma_OPT and F_min are
experimental.
Download
20 files, 66 015 bytes.
SHA-256 f5d8221e2be432fa48455453417bcc122a87b0fa5b087c81513ca3ed34341558
rfMaxima.mac | Library; loaded with load("rfMaxima.mac") |
|---|---|
BUTTERWORTH.wxm … WAVEGUIDE.wxm | Fourteen example notebooks |
coma.mac | COntrol engineering with MAxima, version 1.64, by W. Haager; used by CONSTANT_K_SECTION.wxm; third-party code under the GNU GPL |
tools/wxm2html.pytools/render_tex.jstools/README.md | Generator of the example pages of this site |
CHANGELOG.md | Changes with respect to v0.2.4 |
Example (Maxima or wxMaxima), which returns K = 1 for a series resistance of 25 Ω in a 50 Ω system:
load("rfMaxima.mac")$ Z_0: 50$
K_Rollett(ABCD2S(ABCD_SeriesImpedance(25)));
Compatibility with v0.2.4. Several identifiers have changed:
F(S) is renamed F_Passive(S), GVD now returns
d²β/dω², S_MIXEDMODE is computed by MixedMode,
and the maximum frequency of oscillation is returned by MaxOscillationFrequency.
Seven functions of v0.2.4 returned incorrect results; results obtained with v0.2.4 or earlier
should be regenerated (see CHANGELOG.md).
Functions
Solution2Y, Solution2Z, Solution2H, Solution2G,Solution2ABCD, Solution2InverseABCD(Solution) |
Two-port matrix from a solved equation set in v_in, i_in,
v_out, i_out. |
|---|---|
TwoPortMatrices(Solution) |
Defines and prints ABCD(s), G(s), H(s),
InverseABCD(s), S(s), Y(s) and Z(s). |
ABCD2S, S2Y, Y2H, …(M) |
Conversions between all pairs of the ABCD, inverse ABCD, G, H, S, Y and Z representations. |
ABCD_SeriesImpedance(z), ABCD_ShuntAdmittance(y),ABCD_PiNetwork(y1, y2, y3), ABCD_TNetwork(z1, z2, z3),ABCD_LosslessTL(β, l, Z), ABCD_LossyTL(γ, l, Z),ABCD_Transformer(n), Z_Gyrator(r), ABCD_Nullor |
Building blocks. In the Π network, y3 is the series arm; in the T network, z3 is the shunt arm. |
Y3_2_S3(Y, Z_1, Z_2, Z_3) |
Three-port admittance matrix to scattering parameters. |
MixedMode(S4) |
Standard four-port scattering matrix to mixed-mode parameters, ordered [d1, d2, c1, c2]. |
SParameters(S) |
Defines magnitude, phase and group delay of each Sij, and
Z_IN, Z_OUT, R_IN, X_IN, R_OUT,
X_OUT; the port impedances apply with the opposite port terminated in
Z0. |
Stability(S) |
Δ, maximum stable gain, K, μ, μ′ and U as functions of ω. |
K_Rollett, mu_S, muprime_S, MSG_S, Delta_S, U_Mason(S) |
The same quantities for a single scattering matrix. |
TransitFrequency(H), MaxOscillationFrequency(S) |
Solutions of |h21| = 1 and U = 1. |
NoiseVoltage2EquivalentInputNoiseVoltage(ABCD, Solution) and three related functions |
Contribution of an internal noise source to an equivalent input generator; the open-circuit and short-circuit terms are summed. |
F(i², v²), NF(F), NoiseTemperature(F, T) |
Noise factor, noise figure in decibels and noise temperature. |
NoiseWaveCorrelationMatrix(S), F_Passive(S) |
Noise-wave correlation matrix and noise factor of a passive network [8]. |
%gamma_TL, Z_TL, R_TL, L_TL, G_TL, C_TL,v_p, v_g, GVD |
Transmission-line parameters, phase and group velocity, group-velocity dispersion. |
PlotSmithChart(P), PrintSmithChart(P, format, file) |
Smith chart on screen or to a file; P is a parametric or discrete trace or a list
of traces. |
AbsSymbolic, ArgSymbolic, GroupDelaySymbolic,PolesSymbolic, ZerosSymbolic |
Magnitude, phase, group delay, poles and zeros of a rational function of s or jω. |
Principal parameters
Z_0 | Reference impedance of the scattering parameters; must be assigned before a conversion to or from S. |
|---|---|
s, %omega | Complex frequency and angular frequency, s = jω. |
v_in, i_in, v_out, i_out | Port variables of the equation set; both currents flow into the network. |
v_noise, i_noise | Internal noise sources of a noise equation set. |
k_B, T, B | Boltzmann constant, temperature and noise bandwidth. |
Examples
The pages were generated by executing the notebooks of release 0.2.5 in Maxima 5.46.0 and recording their results; expressions are rendered as MathML, and plots are the output of the same run.
- ABCD and scattering matrix of a lossy transmission line —
LOSSY_TL.wxm - Smith chart plotting —
SMITH_CHART.wxm - Constant-k filter section —
CONSTANT_K_SECTION.wxm - Capacitively tuned lossy transformer —
LOSSY_TRANSFORMER.wxm - Conductor loss of the TE10 mode in a WR-10 waveguide —
WAVEGUIDE.wxm - Second-order Butterworth filter in Sallen–Key topology —
BUTTERWORTH.wxm - Efficiency of a class-D output stage —
CLASS_D_PA.wxmplain Maxima - Equivalent input noise generators of a bipolar transistor —
NOISE.wxm - Input-referred offset of a differential pair —
OFFSET.wxmplain Maxima - Curtice MESFET model —
MESFET.wxm - RF CMOS SPST switch —
RF_CMOS.wxm - Capacitive fixed-fixed beam RF MEMS switch —
RF_MEMS.wxm - AT-cut quartz resonator —
QUARTZ.wxm - Film bulk acoustic resonator —
FBAR.wxmplain Maxima
Requirements
Maxima [10], release 5.46 or later. The example notebooks are opened with wxMaxima [11]; the
library itself also runs in a terminal session of Maxima. Plots require gnuplot [12]. The page
generator in tools/ additionally requires Python 3 and Node.js with the
katex package.
Settings. rfMaxima.mac must reside in the directory of the
notebook or in a directory listed in file_search_maxima. Z_0 must be
assigned before any conversion to or from scattering parameters. Equation sets must define both
port currents as flowing into the network.
Verification. Release 0.2.5 was run with Maxima 5.46.0 and gnuplot under Linux.
Twenty symbolic assertions pass, including agreement with [1, Table 4.2], round trips through
all conversions and the stability and noise figures stated above, and all fourteen notebooks execute
from the extracted archive without error. wxMaxima, other Maxima releases and other operating systems
were not tested; Gamma_OPT and F_min were not verified against an independent
noise-parameter extraction.
Changelog
0.2.5 — 19 September 2026
Version 0.2.5 is a correctness release. Seven functions of v0.2.4 returned incorrect results without raising an error, among them the Rollett stability factor, which carried the wrong sign on |Δ|², the h-parameter and inverse ABCD conversions, the mixed-mode transformation, and the input and output impedances, which evaluated to Z0 for every network. Five further functions failed at run time, and the Smith chart functions did not execute on current Maxima releases and drew an elliptical grid. The example notebooks are corrected, among other items, in the neper-to-decibel factor of the waveguide example (8.868 instead of 8.686), in the mutual inductance of the transformer example and in the transient solution of the class-D example; the quartz and FBAR notebooks now execute to completion.
Several identifiers are renamed or redefined, and missing conversions, Mason’s unilateral
gain and the page generator are added; results obtained with v0.2.4 or earlier should be
regenerated. The complete record is given in CHANGELOG.md in the archive.
References
- D. M. Pozar, Microwave Engineering, 2nd ed. Wiley, 1998.
- G. Gonzalez, Microwave Transistor Amplifiers: Analysis and Design, 2nd ed. Prentice Hall, 1997.
- D. E. Bockelman and W. R. Eisenstadt, “Combined differential and common-mode scattering parameters: Theory and simulation,” IEEE Trans. Microw. Theory Techn., vol. 43, no. 7, pp. 1530–1539, Jul. 1995. [Online]. Available: https://
doi. org/ 10. 1109/ 22. 392911 - J. M. Rollett, “Stability and power-gain invariants of linear twoports,” IRE Trans. Circuit Theory, vol. CT-9, no. 1, pp. 29–32, Mar. 1962. [Online]. Available: https://
doi. org/ 10. 1109/ TCT. 1962. 1086854 - M. L. Edwards and J. H. Sinsky, “A new criterion for linear 2-port stability using a single geometrically derived parameter,” IEEE Trans. Microw. Theory Techn., vol. 40, no. 12, pp. 2303–2311, Dec. 1992. [Online]. Available: https://
doi. org/ 10. 1109/ 22. 179894 - S. J. Mason, “Power gain in feedback amplifier,” Trans. IRE Prof. Group Circuit Theory, vol. CT-1, no. 2, pp. 20–25, Jun. 1954. [Online]. Available: https://
doi. org/ 10. 1109/ TCT. 1954. 1083579 - P. R. Gray, P. J. Hurst, S. H. Lewis, and R. G. Meyer, Analysis and Design of Analog Integrated Circuits, 4th ed. Wiley, 2001.
- S. W. Wedge and D. B. Rutledge, “Noise waves and passive linear multiports,” IEEE Microw. Guided Wave Lett., vol. 1, no. 5, pp. 117–119, May 1991. [Online]. Available: https://
doi. org/ 10. 1109/ 75. 89082 - K. Van Caekenberghe et al., “A W-band waveguide fabricated using selective laser melting,” Microw. Opt. Technol. Lett., vol. 54, no. 11, pp. 2572–2575, Nov. 2012. [Online]. Available: https://
doi. org/ 10. 1002/ mop. 27121 - Maxima reference manual. [Online]. Available: https://
maxima. sourceforge. io/ docs/ manual/ index. html - wxMaxima. [Online]. Available: https://
wxmaxima-developers. github. io/ wxmaxima/ - gnuplot. [Online]. Available: https://
www. gnuplot. info/