Python is capable of handling files, objects, and creating different applications. We can use Python's extensions and packages to build and develop fully featured applications.Suppose you want to control the files in your system; then Python provides an OS Module which has system-enabled functionalities to allow you interact with the files in the operating system.Let us see how we can read multiple text files from a folder using the OS module in Python.Import the OS module in your notebook.Define a path where the text files are located in your system.Create a list of files and iterate over to find if ... Read More
Thevenin’s Theorem is used, where it is desired to determine the current through or voltage across any one circuit element without going through the complex method of solving a set of network equations.Statement of Thevenin’s TheoremAny two terminal bilateral linear dc circuit can be replaced by an equivalent circuit consisting of voltage source in series with a resistance, the voltage source being the open circuited voltage across the open circuited load terminals and the resistance being the internal resistance of the source network looking through the open circuited load terminals.Explanation of Thevenin’s TheoremStep 1 – Remove the load resistor (RL) ... Read More
A practical voltage source consists of an ideal voltage source in series with an internal resistance (for an ideal voltage source, this internal resistance being zero, so that the output voltage becomes independent of the load current) While a practical current source consists of an ideal current source in parallel with an internal resistance (for an ideal current source, this parallel resistance is infinity).The practical voltage and current sources are mutually transferable i.e. a practical voltage source can be converted into a practical current source and vice-versa.Voltage to Current Source TransformationConsider a practical voltage of V volts having a series ... Read More
Consider the circuit consisting of R, L and C connected in series across a supply voltage of V (RMS) volts. The resulting current I (RMS) is flowing in the circuit. Since the R, L and C are connected in series, thus current is same through all the three elements. For the convenience of the analysis, the current can be taken as reference phasor. Therefore, $$\mathrm{Voltage\:acorss\:\mathit{R}, \mathit{V}_{R}=\mathit{IR}}$$$$\mathrm{Voltage\:acorss\:\mathit{L}, \mathit{V}_{L}=\mathit{IX}_{L}}$$$$\mathrm{Voltage\:acorss\:\mathit{C}, \mathit{V}_{C}=\mathit{IX}_{c}}$$Where, XL = jωL = Inductive Reactince, Xc = 1/jωC = Capacitive reactance. VR is in phase with I. VL is leading the current I by 90°. VC is lagging the I by 90°.The total voltage ... Read More
A series-parallel circuitis a combination of series and parallel circuits. In this circuit some of the elements are connected in series fashion and some are in parallel.In the circuit shown below, we can see that resistors R2 and R3 are connected in parallel with each other and that both are connected in series with R1.To solve such circuits, first reduce the parallel branches to an equivalent series branch and then solve the circuit as a simple series circuit.Here, RP is equivalent resistance of parallel combination given by, $$\mathrm{\mathit{R}_{p}=\frac{\mathit{R}_{2}\mathit{R}_{3}}{\mathit{R}_{2}+\mathit{R}_{3}}}$$Total circuit resistance (RT) is given by, $$\mathrm{\mathit{R}_{r}=\mathit{R}_{1}+\mathit{R}_{p}=\mathit{R}_{1}+\frac{\mathit{R}_{2}\mathit{R}_{3}}{\mathit{R}_{2}+\mathit{R}_{3}}}$$Voltage across the parallel combination is ... Read More
The resistors are said to be connected in series, when they are joined end to end so that there is only one path for the current to flow.ExplanationLet the three pure resistors R1, R2 and R3 be connected in series against a DC voltage source V as shown in the circuit.Referring the circuit it can be written that$$\mathrm{\mathit{V}\:=\:\mathit{V}_{1}+\mathit{V}_{2}+\mathit{V}_{3}\:\:\:\:…(1)}$$Where V1, V2 and V3 being the voltage drops against individual resistors.Assuming I to be the total current in the circuit and R being the equivalent resistance of all the series resistors. Hence, the equation (1) can be written as$$\mathrm{\mathit{IR}=\mathit{IR}_{1}+\mathit{IR}_{2}+\mathit{IR}_{3}}$$$$\mathrm{\Rightarrow\:\mathit{R}=\mathit{R}_{1}+\mathit{R}_{2}+\mathit{R}_{3}\:\:\:\:…(2)}$$Thus, the equation (2) ... Read More
When one end of each resistor is joined to a common point and the other end of each resistor is joined to another common point so that there are as many paths for current flow as the number of resistors, it is called as a parallel circuit.The below circuit shows the connection of three resistors in parallel across a DC voltage source V. Let the circuit current be 𝐼 while the branch currents I1, I2 and I3 respectively. The voltage drop in each branch being same, so by Ohm’s law, we can write, $$\mathrm{\mathit{V}=\mathit{I}_{1}\mathit{R}_{1}=\mathit{I}_{2}\mathit{R}_{2}=\mathit{I}_{3}\mathit{R}_{3}}$$Also, by referring the circuit, $$\mathrm{\mathit{I}=\mathit{I}_{1}+\mathit{I}_{2}+\mathit{I}_{3}}$$$$\mathrm{\Rightarrow\frac{\mathit{V}}{\mathit{R}_{p}}=\frac{\mathit{V}}{\mathit{R}_{1}}+\frac{\mathit{V}}{\mathit{R}_{2}}+\frac{\mathit{V}}{\mathit{R}_{3}}}$$Where, RP ... Read More
When the resistances are connected with each other such that one end of each resistance is joined to a common point and the other end of each resistance is joined to another common point so that the number paths for the current flow is equal to the number of resistances, it is called a parallel circuit.ExplanationConsider three resistors R1, R2 and R3 connected across a source of voltage V as shown in the circuit diagram. The total current (I) divides in three parts – I1 flowing through R1, I2 flowing through R2 and I3 flowing through R3. As, it can ... Read More
To plot an area in a Pandas dataframe in Matplotlib Python, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a Pandas dataframe, i.e., a two-dimensional, size-mutable, potentially heterogeneous tabular data.Return the area between the graph plots.To display the figure, use show() method.Exampleimport pandas as pd import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True df = pd.DataFrame(np.random.rand(10, 4), columns=["a", "b", "c", "d"]) df.plot.area() plt.show()Output
To show the same Matplotlib figure several times in a single iPython notebook, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a figure and a set of subplots.Plot the data points on that axes.To show the current figure again, use fig.show() method.ExampleIn [1]: %matplotlib auto Using matplotlib backend: Qt5Agg In [2]: import matplotlib.pyplot as plt In [3]: plt.rcParams["figure.figsize"] = [7.50, 3.50] ...: plt.rcParams["figure.autolayout"] = True In [4]: fig, ax = plt.subplots() In [5]: ax.plot([2, 4, 7, 5, 4, 1]) Out[5]: [] In [6]: fig.show()Output
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP