I have found a solution for calculation ofcalculating the impedance of a RLC circuitscircuit using the luacomplex package. For example, I have given a solution for series RLC circuit.
% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{amsmath} % for 'align*' environment
\usepackage{siunitx} % for '\qty' macro
and '\unit' macros
\usepackage{luacomplex}
\usepackage[nomessages]{fp}%
\usepackage{circuitikz}
\ctikzset{bipoles/thickness=1.2}
\usepackage{enumitem}
\begin{document}
%\renewcommand{\imgUnit}{\mathrm{j}}
\def\R{10}
\def\L{0.1}
\def\C{0.0001}
\def\f{50}
\FPeval{\omega}{2*pi*\f}%
\cpxNew{R}{\R,0}
\cpxNew{X_L}{0,\omega*\L}
\FPeval{\xc}{1/(\omega*\C)}%
\cpxNew{X_C}{0,-\xc}
\cpxOp{Z}{R+X_L+X_C}
\section{Introduction}
This document calculates the impedance of a series and parallel R-L-C circuits with resistive, inductive, and capacitive components.
\section{Parameters}
\begin{itemize}[noitemsep]
\item Resistance $R = \qty{\R}{\ohm}$
\item Inductance $L = \qty{\L}{\henry}$
\item Capacitance $C = \qty{\C}{\farad}$
\item Frequency $f = \qty{\f}{\hertz}$
\end{itemize}
\subsection{Series R-L-C Circuit}
\begin{center}
\begin{figure}[h!]
\begin{circuitikz}
\centering
\begin{circuitikz}
\draw[line width=1]
(1,4) to [sinusoidal voltage source, l_=$V_S$, i=$I$] (1,1)
(1,4) to [resistor, l_=$R$] ++(6,0) to [inductor, l_=$L$] ++(0,-4) to [capacitor, l_=$C$] +(-6,0) to [short](1,0) to [short](1,1);
%\draw[help lines] (0,0) grid (10,10) ;
\end{circuitikz}
\end{figure}
\end{center}
In a series RLC circuit, the total impedance $Z$ can be calculated using the formula:
$$Z=R+j\[Z=R+j(X_L-X_C)$$
\]
Calculate Inductive Reactance ($X_L$):
$$X_L=2\pi\[X_L=2\pi f L$$
L\]
Calculate Capacitive Reactance ($X_C$ ):
$$X_C=\dfrac\[X_C=\frac{1}{2\pi f C}$$
\]
For the values given above, the results are obtained aswe follows.find:
\begin{align*}
R \noindent \(R=\cpxPrint{R}\)&= $\qty\qty{\R}{\ohm}$\\
\\
X_L &= \(X_L=\cpxPrint\cpxPrint{X_L}\) $\qty{}\,\unit{\ohm}$\\
\\
X_C &= \(X_C=\cpxPrint\cpxPrint{X_C}\) $\qty{}\,\unit{\ohm}$\\
\cpxOp{Z}{R+X_L+X_C}\\
Z &= \R+X_L+X_C=(Z=R+X_L+X_C=\cpxPrint\cpxPrint{Z}\) $\qty\,\unit{\ohm}\,.
\end{\ohmalign*}$
\subsection{Parallel R-L-C Circuit}
In a parallel RLC circuit, the total impedance $Z$ can be calculated using the formula:
$$\dfrac\[
\frac{1}{Z}=\dfrac=\frac{1}{R}+\dfrac+\frac{1}{jX_L}+\dfrac+\frac{1}{jX_C}$$\,.
\]
\end{document}


