A collection of Jupyter Notebooks

Note

Last update: 28 Nov 2023
This page is a test of Quarto. The Jupyter notebooks are rough drafts. So far I like how Quarto renders JupyterLab notebooks to HTML.

Introduction

This site provides a place to host a few of my JupyterLab notebooks. The JupyterLab notebooks use the SymPy, NumPy, SciPy, Pandas and the Python programming language libraries to analyize various topics. Jupyter Notebooks are used for a varity of programming projects. The notebooks combine code and narrative in the same ducument. Within a jupyter notebook there are three types of cells, code cells, markdown cells and raw cells. The code cells contain the python code, the markdown cells contain text that can be formated with markdown. The combination of code cells mingled with mardown cells provides a convient and powerful way to build a report containtaining narrative and the results of calculations.

Electrical Engineering Problems

The following notebooks cover various topics in electrical engineering. Electrical engineering is an engineering discipline concerned with electricity, electronics and electromagnetism. My intrest is in circuits and systems, which covers theory, analysis, design, practical implementations of circuits and the application of circuit techniques to systems and to signal processing.

Circuit Analysis

Symbolic Modified Nodal Analysis

The Symbolic Modified Nodal Analysis uses the modified nodal analysis technique to derive a system of equations for the circuit’s node voltages and branch currents in terms the Laplace variable ‘s’ and the element’s symbol.

Two amplifier RIAA phono preamp

This notebook analyize the phono preamplifier circuit from the application note AN-346 High-Performance Audio Applications of the LM833. The schematic for the phono preamplifier was entered into LTSpice and the circuit netlist was generated. Modified Nodal Analysis was used to derive the circuit equations and Python libraries were used to solve the equations. The preamplifier transfer function was used to calculate the Bode, impuse and step response plots. The Python results were compared to those from LTSpice. Deviation from the RIAA response curve was also examined. Practical implementation considerations are discussed. The sensitivity, error budget and temperature analysis for the preamplifier circuit was performed. Alternate preamplifier circuits were analyized and evaluated. Finally, a new circuit was sythysized from the inverse RIAA tranfser function. The JupyterLab notebook showcases the use of python in electrical engineering and circuit analysis.

Source free series circuit

In this notebook, the Python modules SymPy and SciPy are used to solve for currents and voltages in a series R, L and C circuit from the characteristic differential equation. A source free series RLC circuit consists of a resistor, capacitor and inductor connected in series with some initial energy stored either in the inductor, capacitor or both. Since the circuit is a single loop, the current flowing around the loop is the same current in each component. Both parallel and series connected circuits are usually presented in electrical circuit analysis classes. The two textbooks I used while in college presented the parallel connected circuit in some detail then kind of glossed over the series connect circuit since it is the dual of the other. The circuit to be analyzed is shown below and was drawn using EasyEDA, the link to the schematic is here.

SciPy analog filter design

This notebook describes the use of filter functions in the SciPy library which can be used to design analog filters. Filters are one of the basic building blocks of signal processing. In general terms, filters used for signal processing can be divided into two groups, analog and digital filters. Analog filters, the topic of this notebook, are filters which can be described with linear differential equations and implemented in circuits which operate on continuously varying signals. A digital filter is a system that performs operations on a sampled, discrete-time signal with numerical operations. The first part of this notebook uses SciPy functions to calculate analog filter polynomials based on the classical Butterworth, Chebyshev, Elliptic and Bessel filters. The last section of this notebook walks through a Butterworth filter design and Cauer synthesis of an LC ladder type filter.

Other notebooks to be converted from Blogger

  • Two port parameters
  • Coupled inductor circuits
  • Nodal analysis of a RLC circuit with controlled sources
  • Thevenin equivalent circuit
  • Symbolic node analysis

future topics

  • Bridge-T network analysis
  • Pi filter transfer function
  • Nullors, Gyrators, NICs, Current Conveyors
  • State variable filter: LP, HP, BP BR
  • Bi-Quad LP, HP, BP, BR
  • Sallen–Key active filter
  • Wien bridge oscillator
  • Chua’s circuit
  • Switched mode power supply
  • T-coil circuit
  • RLC, initial conditions and inverse Laplace transform

Electric Machines & Electromechanics

Overshot waterwheel hydroelectric power system analysis

This notebook examines the construction of a small hydroelectric system built by Michael Loftis, a YouTuber, real estate and insurance broker, who had a hydro system built for his off-grid cabin on 50 acres in the Ozark Mountains. The cabin and hydro system are unique and look really interesting. The cabin is available for rent as an AirBnB and is located in Thornfield, Missouri. The cabin is now advertised as having some solar panels with a gas powered generator to supplement the solar. Michael’s hydroelectric project looked really interesting and I was curious about the technical details. In the YouTube videos, Did we MAKE HYDRO POWER Using Our Waterwheel for Self Reliant Off Grid Living? and Possible Hydro Power Solutions for our Off Grid Cabin? A BIG THANKS TO YOU!!, he discusses the status of the system. I was disappointed to hear that his system wasn’t working, because at first glance it looked very impressive. I decided to learn a little about small hydroelectric systems and document in this notebook what I’ve learned.

  • Lake District Overshot Waterwheel Project - analysis
  • electric power, motors, magnetics
  • Inductor and transformer design
  • Electric propulsion

Heat transfer

  • Heat sink design: TPA6021A4 with 20-pin DIP anodized heat sink (Aavid Thermalloy 580400B00000, Digi-Key HS181-ND)

Radio and RF design

  • scikit-rf
  • signals and spectra, modulation and coding
  • topics in microwave engineering
  • Smith chart plots
  • antenna design
  • antenna temperature
  • receiver design, analog FE for SDR
  • Link Analysis
    • starlink example (LEO)
    • Direct to cellphone satellite service
  • Hydrogen line receiver
    • H1 line signal strength
    • basic design and feasibility
    • antenna design, horn, other
    • receiver design
    • filter design
    • mapping the sky

Computer and information security

Password card

This notebook describes the use of a password card and the Python code that generates the password card. The password card is a grid of random letters, numbers and special characters that provides a convenient aid to generate and remember long and complex passwords. A basic description of the password card and instructions are provided along with the Python code used to generate the password card. A security analysis and an analysis of alternatives is provided.

Other engineering topics

  • atmospheric water extraction
  • canaon ball balistics
  • thermal wall (what ever that’s called)

Discount Cash Flow Analysis of Equities

The following notebooks use discount cash flow analysis to determine if the stock of a company should be purchased. A discounted cash flow analysis requires making assumptions about a company’s sales growth, profit margins, depreation rate, investment rate, cost of capital, debt, dividends etc. Historical data is used to make these assumptions.

Here are two notebooks posted as a test.

Federal Realty (FRT)

Federal Realty is a recognized leader in the ownership, operation and redevelopment of high-quality retail-based properties located primarily in major coastal markets from Washington, D.C. to Boston as well as San Francisco and Los Angeles. The company specializes in the ownership, management, and redevelopment of high quality retail and mixed-use properties located primarily in densely populated and affluent communities in strategically selected metropolitan markets in the Northeast and Mid-Atlantic regions of the United States, as well as in California and South Florida. As of December 31, 2020, the company owned or had a majority interest in community and neighborhood shopping centers and mixed-use properties which are operated as 101 predominantly retail real estate projects comprising approximately 23.4 million square feet.

Norwegian Cruise Line Holdings (NCLH)

This notebook was developed to analyze the financial performance of NCLH. The analysis presented primarily uses financial data prior to fiscal year 2019. Most of which is irrelevant now, since NCLH’s consolidated financial sheets are dramatically different following the shock of the pandemic. From a financial perspective, it’s not really possible to compare the finances of post pandemic NCL to the pre pandemic NCL. On account of the large discontinuity in operations, the company’s pre and post pandemic financials need to be considered separately.

Hanesbrands Inc. (HBI)

This notebook presents analysis and commentary for HanesBrands (NYSE: HBI). The analysis presented is based on examination of the business fundamentals. A discount cash flow analysis is used to estimate the intrinsic value of the company. A second evaluation method based on earnings history and historical price to earnings ratio is calculated. Using some judgment calls, as explained in the analysis, an intrinsic stock value is calculated. Some shares of HBI were purchased based on dividend yield and the intrinsic stock value. As described in the analysis, HBI suspended the dividend in order to direct funds to pay down the debt. Since the company is not paying a dividend, does it make sense to hold the company as a value stock? The analysis concludes that there is some merit to think the company might be a value stock, but as a non-dividend paying stock, having HBI does not fit my investment goals of holding quality dividend paying stocks.

At the time of writing this report, some stock analysis were suggesting that HBI might be a value play, that is, buying this stock on the cheap and holding until the price recovers or the dividend is re-instated. See the articles here and here. My analysis shown below indicates that the even if NOP can be increased over time by 10%, the ratio of NOP to total liabilities remains above 7. (need to recalculate projected total liabilities and clean up the analysis). Historically the ratio was near 5 when HBI initiated their dividend.

Other notebooks to be converted from Blogger

  • U.S. Bancorp (USB)
  • Bristol-Myers Squibb Company (BMY)
  • International Paper Company (IP)

Equities Technical Analysis

A collection of notebooks analyzing the stockmarket statistical trends of price movement and volume.