<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">AJCM</journal-id><journal-title-group><journal-title>American Journal of Computational Mathematics</journal-title></journal-title-group><issn pub-type="epub">2161-1203</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/ajcm.2023.131003</article-id><article-id pub-id-type="publisher-id">AJCM-123414</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Physics&amp;Mathematics</subject></subj-group></article-categories><title-group><article-title>
 
 
  Analyzing Electric Circuits with Computer Algebra
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Haiduke</surname><given-names>Sarafian</given-names></name><xref ref-type="aff" rid="aff1"><sub>1</sub></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib></contrib-group><aff id="aff1"><label>1</label><addr-line>The Pennsylvania State University, University College, York, USA</addr-line></aff><pub-date pub-type="epub"><day>09</day><month>01</month><year>2023</year></pub-date><volume>13</volume><issue>01</issue><fpage>91</fpage><lpage>98</lpage><history><date date-type="received"><day>26,</day>	<month>December</month>	<year>2022</year></date><date date-type="rev-recd"><day>25,</day>	<month>February</month>	<year>2023</year>	</date><date date-type="accepted"><day>28,</day>	<month>February</month>	<year>2023</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  This report shows how starting from classic electric circuits embodying co
  mmonly electric components we have reached semi-complicated circuits embodying the same components that analyzing the signal characteristics requires a Computer Algebra System. Our approach distinguishes itself from the electrical engineers’ (EE) approach that relies on utilizing commercially available software. Our approach step-by-step shows how Kirchhoff’s rules are applied conducive to the needed circuit information. It is shown for the case at hand the characteristic information is a set of coupled differential equations and that with the help of Mathematica numeric solutions are sought. Our report paves the research road for unlimited creative similar circuits with any degree of complications. Occasionally, by tweaking the circuits we have addressed the “what if” scenarios widening the scope of the investigation. Justification of the accuracy of our analysis for the generalized circuits is cross-checked by arranging the components symmetrizing the circuit leading to an intuitively predictable reasonable result. Mathematica codes are embedded assisting the interested reader in producing and extending our results.
 
</p></abstract><kwd-group><kwd>Characteristics of Electric Circuits</kwd><kwd> DC and AC Driven Circuits</kwd><kwd> Computer Algebra System</kwd><kwd> &lt;i&gt;Mathematica&lt;/i&gt;</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>Analyzing the characters of signals in classic electric circuits embodying components such as resistors, capacitors, and self-inductors or ultimately various combinations of these elements connected in series or parallel driven by DC or AC sources is a routine practice for electric engineers. In practice, they utilize commercial software such as [<xref ref-type="bibr" rid="scirp.123414-ref1">1</xref>] [<xref ref-type="bibr" rid="scirp.123414-ref2">2</xref>] . This approach mostly passes the analytic aspect of the circuit analysis generating the needed information. This approach although efficient in obtaining the needed information lacks analytic rigor. From a physicist’s point of view, we would rather start from the fundamental principles generating the needed information leading to controllable output conducive to the same knowledge.</p><p>With this objective, we craft this report that consists of three sections. In Sect 2, we depict a designed circuit that is more sophisticated than the routinely used above-mentioned elements. It consists of a multi-mesh, to be precise a double-loop circuit. In the first scenario, it is driven by DC power supplies. In a later scenario an AC, and two DC sources. This section includes the mathematical analysis including solutions to the coupled ODEs. At first, the circuit is designed symmetrically meaning certain adjustable parameters are used making the output intuitively predictable. This helps check the accuracy of the calculation, it bypasses the need to solve the coupled differential equations. In the follow-up scenario for a rigor analysis, the coupled ODEs have to be solved. This approves that our proposed circuit is a suitable example justifying why there is a need to learn how to solve the equations. As such, although the coupled ODEs are not analytically solvable, we apply a Computer Algebra System, such as Mathematica conducive to its numeric solution. We show the results graphically and we test their integrity by proposing “what if” scenarios. We supply the Mathematica codes, so that interested readers can practice the concept. Our approach to analyzing the designed circuit is universal, meaning, it paves the research road in analyzing limitless, similar circuits. Noticing, more complicated multi-loops circuits would generate a few more coupled ODEs underlying the need to apply a CAS. We complete the report in Sect 3, the Conclusions and Comments.</p></sec><sec id="s2"><title>2. Multi-Mesh Circuit Each Containing RCL-Series Elements</title><p>The left panel of <xref ref-type="fig" rid="fig1">Figure 1</xref> depicts a classic circuit containing an RCL-series circuit driven by a DC source. Applying Kirchhoff’s Loop law leads to a single linear differential equation. Its solution and implications have been discussed in texts such as [<xref ref-type="bibr" rid="scirp.123414-ref3">3</xref>] [<xref ref-type="bibr" rid="scirp.123414-ref4">4</xref>] . It has a straightforward solution that requires two initial conditions. There is no need to apply a CAS to solve the ODE, it can be solved without it. Although, one might decide to do so for the sake of practice getting prepared for upcoming challenging cases. The right panel of <xref ref-type="fig" rid="fig1">Figure 1</xref> is the “reflection” of the left circuit. It comes about by copying over the circuit of the left trice. The purpose of doing so is to create a multi-loot circuit. The loops are joined at the top and the bottom nodes. The solution of the quantities of interest is not as trivial as the aforementioned case. This circuit is the upgrade of the circuit that classic textbooks [<xref ref-type="bibr" rid="scirp.123414-ref3">3</xref>] [<xref ref-type="bibr" rid="scirp.123414-ref4">4</xref>] avoid analyzing them. Analysis of this circuit may be considered a mathematical exercise justifying the need to learn why the solution of a couple of differential equations is a must.</p><p>The values of the components in the circuit shown in <xref ref-type="fig" rid="fig1">Figure 1</xref> are irrelevant. Meaning, any reasonable values may be assigned to these elements. The analysis of the circuit is generic, it is independent of these values. However, for the reasons explained in the forthcoming sections, two different special sets of values are used. See for instance the bold entries values 2b, and values 2c under the subsections 2b and 2c, respectively.</p><sec id="s2_1"><title>2.1. Analysis</title><p>To analyze the circuit depicted on the right panel of <xref ref-type="fig" rid="fig1">Figure 1</xref>, we apply Kirchhoff’s loop law. According to the well-known Kirchhoff’s laws 1) the algebraic sum of the emfs in a single loop circuit equals the sum of the ohmic voltage drops across the resistors. And 2) In a multi-mesh circuit at any node, the algebraic sum of the currents adds to a zero. There are three such loops, two are selected. The two squares are the referenced shown by clockwise directions 1 and 2. Knowing the voltages across the capacitor with the capacitance C, the self-inductor with the inductance of L, and the obvious voltage loss across the</p><p>resistor R are subject to ( Δ V ) C = q C and ( Δ V ) L = L d d t i , and ( Δ V ) R = R i , respectively we advance to the next step. The loops contain additional emf’s, ϵ 1 , ϵ 2 , and ϵ 3 . Kirchhoff’s loop law applied to loop 1 yield,</p><p>ϵ 1 − ϵ 2 − 1 C 1 q 1 − L 1 d d t i 1 + L 2 d d t i 2 + 1 C 2 q 2 = R 1 i 1 − R 2 i 2 , (1)</p><p>Repeating the same principle to loop 2, we have</p><p>ϵ 2 − ϵ 3 − 1 C 2 q 2 − L 2 d d t i 2 + L 3 d d t i 3 + 1 C 3 q 3 = R 2 i 2 − R 3 i 3 , (2)</p><p>and applying Kirchhoff’s node law at node A, we have</p><p>i 1 + i 2 + i 3 = 0 , (3)</p><p>In these equations, we replace the currents with their derivatives concerning time, namely, i 1 = d q 1 d t , i 2 = d q 2 d t , and i 3 = d q 3 d t . Substituting these in (1), (2) and (3) yield,</p><p>ϵ 1 − ϵ 2 − 1 C 1 q 1 − L 1 q &#168; 1 + L 2 q &#168; 2 + 1 C 2 q 2 = R 1 q ˙ 1 − R 2 q ˙ 2 , (4)</p><p>ϵ 2 − ϵ 3 − 1 C 2 q 2 − L 2 q &#168; 2 + L 3 q &#168; 3 + 1 C 3 q 3 = R 2 q ˙ 2 − R 3 q ˙ 3 , (5)</p><p>q ˙ 1 + q ˙ 2 + q ˙ 3 = 0 , (6)</p><p>where the over dots stand for the derivative concerning time. The set of Equations, (4), (5), and (6) are three coupled linear second-order inhomogeneous differential equations with constant coefficients. With the initial conditions, q 1 ( 0 ) = q 2 ( 0 ) = q 3 ( 0 ) = 0 and q ˙ 1 ( 0 ) = q ˙ 2 ( 0 ) = q ˙ 3 ( 0 ) = 0 we seek solutions. We fail to solve them analytically, claiming this is a suitable example to utilize with a CAS. By selecting a reasonable set of parameters using NDSolve command of Mathematic [<xref ref-type="bibr" rid="scirp.123414-ref5">5</xref>] we solve them numerically. Before doing so we adopt a strategy. 1) we set the parameters such that the double-looped circuit becomes symmetric, i.e. the parameters associated with loop 1 are the same as the parameters of loop; 2) Then by assigning small values to the embodied components, R, C, L, and ϵ and stronger ϵ for the mid common branch we anticipate a symmetric signal characteristics output. Upon justifying our intuitive point by breaking the symmetry we consider nonsymmetric elements leading the general features of the circuit. The Mathematica [<xref ref-type="bibr" rid="scirp.123414-ref5">5</xref>] codes running these scenarios are as follows.</p></sec><sec id="s2_2"><title>2.2. Symmetric Loops, Signal Characteristics Generated with Three DC Power Supplies</title><p>For the symmetric case, we store the values of the components in values2b, units are SI. As mentioned, we assign small values to ϵ<sub>1</sub> and ϵ<sub>2</sub> and a stronger emf to the mid branch ϵ<sub>2</sub>.</p><p>values2b={ϵ1-&gt;5.,ϵ2-&gt;50.,ϵ3-&gt;5.,R1-&gt;2.,R2-&gt;5.,R3-&gt;2.,L1-&gt;3.,L2-&gt;5.,L3-&gt;3., C1-&gt;4.,C2-&gt;10.,C3-&gt;4.}</p><p>We write,</p><p>eq1=ϵ1-ϵ2-1/C1q1[t]-L1q1’’[t]+1/C2q2[t]+L2q2’’[t]==R1q1’[t]-R2q2’[t]/.values</p><p>eq2=ϵ2-ϵ3-1/C2q2[t]-L2q2’’[t]+1/C3q3[t]+L3q3’’[t]==R2q2’[t]-R3q3’[t]/.values</p><p>eq3=q1’[t]+q2’[t]+q3’[t]==0/.values</p><p>initialCond=q1[<xref ref-type="bibr" rid="scirp.123414-ref0">0</xref>]==q2[<xref ref-type="bibr" rid="scirp.123414-ref0">0</xref>]==q3[<xref ref-type="bibr" rid="scirp.123414-ref0">0</xref>]==q1’[<xref ref-type="bibr" rid="scirp.123414-ref0">0</xref>]==q2’[<xref ref-type="bibr" rid="scirp.123414-ref0">0</xref>]==q3’[<xref ref-type="bibr" rid="scirp.123414-ref0">0</xref>]==0</p><p>with these codes, we solve the equations numerically displaying the solutions. I.e. charge on the capacitors q(t), voltages across the capacitors, currents through the loops, and the voltages across the self-inductors vs. time, respectively. These are depicted in <xref ref-type="fig" rid="fig2">Figure 2</xref></p><p>solq=NDSolve [{eq1,eq2,eq3,initialCond}/.values,{q1[t],q2[t],q3[t]},{t,0,300}]</p><p>As mentioned in the figure caption, although each graph appears to contain only two signals in reality there are three. The thickened blue signals completely overlapped on the magenta acting as one signal as expected.</p><p>The interpretation of shown grouped signals of each plate is straightforward. The upper left graph is the charging characteristics of the capacitors. It follows the routine charging trends as pointed out initially they begin with no charge q ( t = 0 ) = 0 and gradually grow to their plateau saturation. The second plot on the first row is the scaled version of the first, this is because q ( t ) = ( Δ V ) C . It depicts the exponential growth of the voltage across the capacitors. The first and the second graphs of the second row are the classic current jumps and their exponential decay of the voltages across the current and the self-conductors, respectively.</p><p>With confidence in the accuracy of the crafted formulations and codes next we assign asymmetric values to the elements. These are stored in values2c, units are SI as well.</p></sec><sec id="s2_3"><title>2.3. Asymmetric Double Loops, Signal Characteristics Generated with Three DC Power Supplies</title><p>values2c={ϵ1→5.,ϵ2→50.,ϵ3→10.0,R1→2.,R2→5.,R3→5.0,L1-&gt;3.,L2-&gt;5.0,L3-&gt;5.0,C1-&gt;4.,C2-&gt;4.,C3-&gt;5.0};</p><p>We run the same mentioned code with the values2c. The description of the graphs depicted in <xref ref-type="fig" rid="fig3">Figure 3</xref> is the same as in <xref ref-type="fig" rid="fig2">Figure 2</xref>. The impact of the asymmetric parameters is evident. The blue of the magenta signals is separated as expected. For the signals displayed on the first row, we used the same period as we used in <xref ref-type="fig" rid="fig2">Figure 2</xref>. However, for the signals on the second row because of the values of the chosen elements, we used a shorter period enabling displaying the signal characters.</p><p>By comparing the signals displayed in <xref ref-type="fig" rid="fig2">Figure 2</xref> and <xref ref-type="fig" rid="fig3">Figure 3</xref> we realize the impact of the symmetric vs asymmetric parameters. Here again, the general behavior of the signals is what one expected. These are the mimics of the classic singles with no surprises.</p></sec><sec id="s2_4"><title>2.4. An Asymmetric Double Loop, Characteristics Signal Characteristics Generated with an AC and Double DC Power Supplies</title><p>Here we show how easily one may modify the circuit dramatically by replacing one of the DC power supplies with an AC driver. Although there are three DC sources as shown in <xref ref-type="fig" rid="fig1">Figure 1</xref>, here for the sake of demonstrating the procedure we replace only one driver, ϵ<sub>2</sub>. The interested reader may wish to try replacing ϵ<sub>1</sub> and/or ϵ<sub>3</sub> or ultimately all three. As mentioned, we have complete control over setting the parameters. Just for the sack of demonstration, we set the parameters as,</p><p>values2d={ϵ1-&gt;5.0,ϵ2-&gt;50.0 Sin[π t],ϵ3-&gt;5.0,R1-&gt;2.0,R2-&gt;5.0,R3-&gt;2.0,L1-&gt;3.0,L2-&gt;3.0,L3-&gt;3.0,C1-&gt;4.0,C2-&gt;4.0,C3-&gt;4.0}</p><p>The second driver is a sinusoidal source, ϵ<sub>2</sub>(t) = 50 sin[πt]. Its voltage amplitude is 50.0 V and its low frequency is f = 1/2 Hz. Replacing the ϵ<sub>2</sub> in (1) and (2) with the sinusoidal driver easily is accomplished via the driver’s character given in value2d. The circuit is shown in <xref ref-type="fig" rid="fig4">Figure 4</xref>.</p><p>Here the voltages of the left and the right loops as well as the values of the resistances, capacitances, and the self-inductors are set the same. The character of</p><p>the emf of the central branch is replaced with an AC source. The values of the other elements of the circuit are set differently as well. This procedure shows how easy it is to switch from DC to an AC source. As expected, the effective value of the power supply and its oscillating character dominates the time dependency behavior of the signals of interest. Eyeballed view of the characters of <xref ref-type="fig" rid="fig2">Figure 2</xref> and <xref ref-type="fig" rid="fig3">Figure 3</xref> reveals the impact of the DC vs AC sources, as shown in <xref ref-type="fig" rid="fig5">Figure 5</xref>. Utilizing the codes makes it easy to either place the source in the left and or right loop. Or even better design a fresh circuit either based on one’s curiosity and need.</p></sec></sec><sec id="s3"><title>3. Conclusion</title><p>One of the objectives of crafting this report was to demonstrate how by utilizing a Computer Algebra System (CAS) electric circuits are analyzed. This approach bypasses utilizing commercially available software that their application merely gets the character of the signals in a chosen circuit without showing the fundamental physics principle. Our approach is designed such that the user by applying the fundamentals principles constructs the essential equations. And irrespective of their challenging nature their solution leads to the desired output. To justify the made points three different circuits are analyzed, two using a DC and one using an AC source. CAS codes, specifically Mathematica codes are embedded so that the interested reader may duplicate and/or by tweaking adjust to the need. The interested reader may find [<xref ref-type="bibr" rid="scirp.123414-ref6">6</xref>] [<xref ref-type="bibr" rid="scirp.123414-ref7">7</xref>] resourceful.</p></sec><sec id="s4"><title>Acknowledgements</title><p>The author acknowledges the John T. and Page S. Smith Professorship funds for completing and publishing this work.</p></sec><sec id="s5"><title>Conflicts of Interest</title><p>The author declares no conflicts of interest regarding the publication of this paper.</p></sec><sec id="s6"><title>Cite this paper</title><p>Sarafian, H. (2023) Analyzing Electric Circuits with Computer Algebra. American Journal of Computational Mathematics, 13, 91-98. https://doi.org/10.4236/ajcm.2023.131003</p></sec></body><back><ref-list><title>References</title><ref id="scirp.123414-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">STSpice. https://www.analog.com/</mixed-citation></ref><ref id="scirp.123414-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">NI Multisim. https://www.ni.com/en-us/support/downloads/software-products/download.multisim.html#452133</mixed-citation></ref><ref id="scirp.123414-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Halliday, D., Resnick, R., and Walker, J. (2021) Fundamentals of Physics. 11th Edition, John Wiley &amp; Sons, Inc., New Jersey.</mixed-citation></ref><ref id="scirp.123414-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">Bauer W. and Westfall, G. (2011) University Physics with Modern Physics. McGraw Hill, New York.</mixed-citation></ref><ref id="scirp.123414-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Mathematica V12.3. https://www.Wolfram.com</mixed-citation></ref><ref id="scirp.123414-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">Wolfram, S. (1996) Mathematica Book. 3rd Edition, Cambridge University Press, Cambridge.</mixed-citation></ref><ref id="scirp.123414-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">Sarafian, H. (2019) Mathematica Graphics Examples. 2nd Edition, Scientific Research Publishing, Wuhan.</mixed-citation></ref></ref-list></back></article>