
Introduction to Python and Spice for Electrical and Computer Engineers
- 1st Edition - October 4, 2024
- Imprint: Butterworth-Heinemann
- Authors: James C. Squire, Anthony E. English
- Language: English
- Paperback ISBN:9 7 8 - 0 - 4 4 3 - 1 9 0 0 7 - 0
- eBook ISBN:9 7 8 - 0 - 4 4 3 - 1 9 0 0 8 - 7
Introduction to Python and Spice for Electrical and Computer Engineers introduces freshman and sophomore engineering students to programming in Python and Spice through engage… Read more

Purchase options

Institutional subscription on ScienceDirect
Request a sales quoteIntroduction to Python and Spice for Electrical and Computer Engineers introduces freshman and sophomore engineering students to programming in Python and Spice through engaged, problem-based learning and dedicated Electrical and Computer Engineering content. This book draws its problems and examples specifically from Electrical and Computer Engineering, covering such topics as matrix algebra, complex exponentials and plotting using examples drawn from circuit analysis, signal processing, and filter design. It teaches relevant computation techniques in the context of solving common problems in Electrical and Computer Engineering.
This book is unique among Python textbooks for its dual focus on introductory-level learning and discipline-specific content in Electrical and Computer Engineering. No other textbook on the market currently targets this audience with the same attention to discipline-specific content and engaged learning practices. Although it is primarily an introduction to programming in Python, the book also has a chapter on circuit simulation using Spice. It also includes materials helpful for ABET-accreditation, such information on professional development, ethics, and lifelong learning.
This book is unique among Python textbooks for its dual focus on introductory-level learning and discipline-specific content in Electrical and Computer Engineering. No other textbook on the market currently targets this audience with the same attention to discipline-specific content and engaged learning practices. Although it is primarily an introduction to programming in Python, the book also has a chapter on circuit simulation using Spice. It also includes materials helpful for ABET-accreditation, such information on professional development, ethics, and lifelong learning.
- Introduces Electrical and Computer Engineering-specific topics, such as phasor analysis and complex exponentials, that are not covered in generic engineering Python texts
- Pedagogically appropriate for freshmen and sophomores with little or no prior programming experience
- Teaches both scripts and functions but emphasizes the use of functions since scripts with nonscoped variables are less-commonly encountered after introductory courses
- Covers graphics before more abstract programming, supporting early student confidence
- Introduces Python commands as needed to solve progressively more complex EE/ECE-specific problems, and includes over 100 embedded, in-chapter questions to check comprehension in stages
First and second year students taking an introductory Python course out of electrical or computer engineering
- Title of Book
- Cover image
- Title page
- Table of Contents
- Foreword
- Copyright
- Acknowledgments
- Introduction
- Purpose of this Text
- Software for Electrical Engineers
- Why Python and SPICE?
- Formatting Conventions
- Teacher and Student Resources
- 1. Introduction to Python
- 1.1 Objectives
- 1.2 Python Terminology
- 1.3 Installing Python and Anaconda Navigator
- 1.4 Starting Python From a Command Shell
- 1.5 Starting and Closing a Jupyter Notebook
- 1.6 Jupyter Notebook Annotated Code Creation
- 1.6.1 Code and Markdown Cells
- 1.6.2 Self-Documenting Jupyter Notebooks Using Markdown
- 1.7 Using Python as a Calculator
- Charge
- Current
- Charge and Constant Current
- 1.8 Variables
- 1.9 Naming and Inspecting Variables
- 1.10 Parenthesis and Implied Multiplication
- 1.11 Importing Modules and Packages
- 1.12 Special Symbols and Math Functions
- 1.13 Formatting Numbers
- 1.14 Scientific Notation
- 1.15 Exponents and Their Inverses: exp, ∗∗, sqrt, log, log10
- 1.16 Trig Functions and Their Inverses
- 1.17 Creating Arrays
- 1.18 Plotting Data
- 1.19 Getting Help
- 1.20 Saving and Loading Array Data
- 1.21 Python Command Window Keyboard Shortcuts
- 1.22 Exporting Your Notebook Results
- Python Command Review
- Command Shell Review
- Python Interpreter Command Review
- Jupyter Notebook Command Review
- Lab Problems
- 2. Python as a Calculator
- 2.1 Objectives
- 2.2 Built-In Python Data Types
- 2.3 Rounding and Separating Numbers
- 2.4 Creating Vector Arrays
- 2.4.1 Defining Components Explicitly
- 2.4.2 Filling With Duplicate Values
- 2.4.3 Filling with Linearly Spaced Values
- 2.4.4 Filling with Exponentially Spaced Values
- 2.4.5 Filling with Random Values
- 2.5 Working With Vectors
- 2.5.1 Viewing a Vector
- 2.5.2 Vector Length
- 2.5.3 Accessing and Changing Values in Vectors
- 2.5.4 Indexing Relative to the End
- 2.5.5 Removing Vector Array Elements
- 2.5.6 Building Vectors from Other Vectors
- 2.5.7 Inserting Elements in Vectors
- 2.6 Complex Numbers
- 2.6.1 Rectangular Notation
- 2.6.2 Polar Notation
- 2.6.3 Complex Exponential
- 2.6.4 Entering Complex Numbers in Python
- 2.6.5 Real and Imaginary Parts
- 2.6.6 Converting from Rectangular to Polar Form
- 2.6.7 Converting from Polar to Rectangular Form
- 2.6.8 Converting to and from Complex Exponential Form
- 2.7 Vector Mathematics
- 2.8 Strings
- 2.8.1 Converting Between String Representations of Numbers and the Actual Number
- 2.9 Matrices
- 2.9.1 Special Matrix Dimensions
- 2.10 Creating Two-Dimensional Matrix Arrays
- 2.10.1 Defining Components Explicitly
- 2.10.2 Filling with Duplicate Values
- 2.10.3 Filling with Vectors
- 2.10.4 Filling with Random Values
- 2.11 Changing Matrix Values
- 2.11.1 Accessing and Changing Matrix Values
- 2.11.2 Accessing and Changing Whole Rows and Columns
- 2.11.3 Removing Matrix Elements
- 2.12 Working With Matrices
- 2.12.1 Matrix Array Shape
- 2.12.2 Transpose
- 2.12.3 Matrix Mathematics
- 2.13 Solving Simultaneous Equations Using Matrices
- Command Review
- Lab Problems
- 3. Plotting in Python
- 3.1 Objectives
- 3.2 Types of Plots
- 3.2.1 Line Plots
- 3.2.2 Selecting Plot Line Colors
- 3.2.3 Selecting Plot Linestyles
- 3.2.4 Selecting Plot Line Thicknesses
- 3.2.5 Combining Plot Commands
- 3.2.6 Axis Labels and Titles
- 3.2.7 Axis Limits
- 3.2.8 Grids
- 3.2.9 Logarithmic Axis Scaling
- 3.3 Multiple-Line Plots
- 3.3.1 Two-Line Plots
- 3.3.2 Line Options
- 3.3.3 More Than Two-Line Plots
- 3.3.4 Adding Legends
- 3.4 Scatterplots
- 3.5 Scripts
- 3.6 Layering Plots
- 3.7 Bar Plots
- 3.8 Subplots
- 3.9 Text Annotations
- 3.10 Advanced Text Formatting
- 3.10.1 Greek Symbols
- 3.10.2 Super- and Subscripts
- 3.11 Three-Dimensional Plots
- 3.12 Saving Plots in Different File Formats
- Command Review
- Lab Problems
- 4. Python Programming
- 4.1 Objectives
- 4.2 Structured Python Programming
- 4.3 Writing and Running Python Scripts
- 4.4 Introduction to Functions
- 4.4.1 Function Definitions
- 4.4.2 Function Execution
- 4.5 Function Input Parameters
- 4.5.1 Zero Input Parameters
- 4.5.2 Assigning Input Parameters Using Required Positional Format
- 4.5.3 One or More Input Parameters Using Key Value Pairs
- 4.5.4 One or More Input Parameters Using Default Values
- 4.6 Function Return Objects
- 4.6.1 One Return Object
- 4.6.2 Two or More Return Objects
- 4.6.3 Returning the None Object
- 4.6.4 Input and Return Objects Can be Scalars or Arrays
- 4.6.5 Passing Immutable and Mutable Parameters
- 4.7 Creating and Importing Modules With Functions
- 4.7.1 Introduction
- 4.7.2 Writing Module Text Files
- 4.8 Creating Your Own Function Summary
- 4.9 Creating Help With Docstrings
- 4.10 More Complex Function Examples
- 4.10.1 Example: Converting a Complex Number From Polar Radian to Cartesian Form
- 4.10.2 Example: Low-Pass Filter Magnitude Bode Plot for a Given Cutoff Frequency
- 4.11 Sorting
- Master’s
- Doctorate
- 4.12 Relational Operators
- 4.13 Logical Operators
- 4.13.1 Logical Array Operations
- Determine if Any of the Logical Results Are True
- Determine if All of the Logical Results Are True
- Determine How Many Results Are True
- Replacing Array Values for Which a Given Relationship Is True with Another Number
- 4.14 Conditional Branching
- 4.14.1 if
- 4.14.2 if-else
- 4.14.3 if-elif-else
- 4.15 Creating Formatted Strings
- 4.15.1 Using the str() Function and the String Concatenation Operator +
- 4.15.2 String Formatting Methods
- Using the Formatted String Literal or f-Prefix
- Using the format() Function to Create Strings with Embedded Numbers
- Using the String Formatting or Interpolation Operator %
- Command Review
- Lab Problems
- 5. Programming II: Looping
- 5.1 Objectives
- 5.2 Looping in Python Programs
- 5.3 For Loop
- 5.3.1 For Loop Iteration over a List of Objects
- 5.3.2 For Loop Iteration Using the Built-in range() Function
- 5.3.3 For Loop Iteration Using the NumPy arange() Function
- 5.3.4 For Loop Iteration Using the General NumPy array Collections
- 5.4 For Loops Iterating Vector Arrays
- 5.5 Nested Loops
- 5.5.1 Using Nested Loops to Search for Exact Solutions
- 5.5.2 Using Nested Loops to Search for Best Solutions
- 5.6 Timing Code Execution
- 5.7 For Loops Using Else, Break, and Continue
- 5.7.1 The For Else Loop
- 5.7.2 The For Loop Break and Continue Statements
- 5.8 While Loop
- 5.8.1 Using a Counter in a While Loop
- 5.8.2 The While Else Loop
- 5.8.3 The While Loop Break and Continue Statements
- 5.8.4 Terminating an Infinite Loop
- 5.8.5 Infinite Series Approximations Using a While Loop
- 5.9 Growing Versus Preallocating Vector Arrays
- Command Review
- Lab Problems
- 6. Spice
- 6.1 Objectives
- 6.2 Circuit Simulation
- 6.3 Utility
- 6.4 Installing LTspice
- 6.5 Steps in Simulating
- 6.6 Schematic Editor
- 6.6.1 Starting a New Schematic
- 6.6.2 Selecting the Library
- 6.6.3 Defining Voltage and Current Sources
- 6.6.4 Other Common Components: Resistors, Capacitors, Inductors, Diodes, and Transistors
- 6.6.5 Manipulating Component Placement
- 6.6.6 Wire and Ground
- 6.6.7 Operational Amplifiers and other Integrated Circuits
- 6.6.8 Schematic Capture Summary
- 6.7 Types of Ltspice Simulations
- 6.7.1 DC Operating Point
- 6.7.2 Transient Analysis
- 6.7.3 AC Sweep
- 6.8 DC Simulation Walkthrough
- 6.8.1 Open a Blank Schematic
- 6.8.2 Add a 10 V Source
- 6.8.3 Add Two Resistors
- 6.8.4 Add the Ground and Wire Everything Together
- 6.8.5 Run the Analysis
- 6.9 Transient Simulation
- 6.9.1 Open a Blank Schematic
- 6.9.2 Add a Voltage Source
- 6.9.3 Add a 555 Integrated Circuit
- 6.9.4 Add Resistors, a Capacitor, an LED, and a Ground
- 6.9.5 Wire it Up
- 6.9.6 Run the Transient Simulation Analysis
- 6.10 AC Sweep Simulation
- 6.10.1 Open a Blank Schematic
- 6.10.2 Add Opamp Integrated Circuit
- 6.10.3 Add Voltage Sources
- 6.10.4 Add Resistors, Capacitors, and Ground
- 6.10.5 Wire it Up
- 6.10.6 Run the AC Sweep Analysis
- 6.11 Advanced Tip: Using Nets
- Command Review
- Lab Problems
- Index
- Edition: 1
- Published: October 4, 2024
- Imprint: Butterworth-Heinemann
- No. of pages: 350
- Language: English
- Paperback ISBN: 9780443190070
- eBook ISBN: 9780443190087
JS
James C. Squire
James Squire is the Jamison-Payne chaired Professor of Engineering at the Virginia Military Institute. Dr. Squire graduated from the US Military Academy and was awarded a Bronze Star in Desert Storm. He was awarded two patents while earning his doctorate from the Massachusetts Institute of Technology. He has been awarded the state-level Outstanding Faculty Award from Virginia and every major teaching award from the Virginia Military Institute. He has over 50 publications, 8 patents, 2 startup companies, an active consulting practice, and is an honorary member of the VMI Class of 2009.
Affiliations and expertise
Department of Electrical Engineering, Virginia Military Institute, Lexington, VA, USAAE
Anthony E. English
Anthony English earned his Doctorate from the Harvard-MIT Division of Health Sciences and Technology where he received a Raytheon Fellowship and a Rhone-Poulenc Rorer Fellowship. He is the recipient of a National Science Foundation CAREER Award, has over 70 publications, and holds patents related to novel bioreactor design and smart hydrogels. He has been actively involved in two startup companies, one of which he has serves as the vice president of research.
Affiliations and expertise
Department of Biomedical Engineering, Western New England University, Springfield, MA, USARead Introduction to Python and Spice for Electrical and Computer Engineers on ScienceDirect