From 098fb4a08ca946ed2c8aa234f1a7129abde9fde0 Mon Sep 17 00:00:00 2001 From: Christian Kolset Date: Tue, 29 Apr 2025 18:32:22 -0600 Subject: Updated Readme Admin section for meeting 2025-24-25 --- README.md | 9 +- admin/CourseOverview.png | Bin 516658 -> 496348 bytes admin/gantt.png | Bin 167215 -> 156660 bytes admin/meeting-notes/2025-04-25.md | 28 +--- book/module0/installing_anaconda.tex | 158 +++++++++++++++++++++++ book/module1/installing_anaconda.tex | 158 ----------------------- tutorials/module_2/intro_to_numerical_methods.md | 41 ------ tutorials/module_2/non_linear_eqn_solver.md | 117 +++++++++++++++++ tutorials/module_3/non_linear_eqn_solver.md | 117 ----------------- tutorials/module_3/numerical_methods.md | 41 ++++++ 10 files changed, 325 insertions(+), 344 deletions(-) create mode 100644 book/module0/installing_anaconda.tex delete mode 100644 book/module1/installing_anaconda.tex delete mode 100644 tutorials/module_2/intro_to_numerical_methods.md create mode 100644 tutorials/module_2/non_linear_eqn_solver.md delete mode 100644 tutorials/module_3/non_linear_eqn_solver.md create mode 100644 tutorials/module_3/numerical_methods.md diff --git a/README.md b/README.md index d7e304d..1628890 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Find meeting notes, course overview and Gantt charts in this directory. Below is ![Gantt Chart](admin/gantt.png) *Project Gantt Chart: version 2* [Enlarge](admin/gantt.png) -Updated: 2025-04-11 +Updated: 2025-04-29 Online [version](https://markwhen.com/ckolset/MECH305-Modules) @@ -34,16 +34,17 @@ See the tutorials under the /tutorials/ directory. - [Fundamentals of Computing](tutorials/module_1/fundamentals_of_programming.md) - [Open source software](tutorials/module_1/open_source_software.md) - [Computational Expense](tutorials/module_1/computational_expense.md) - - [Error](error.md) + #### Algorithm Developments for ME -- [Numerical Methods](tutorials/module_2/intro_to_numerical_methods.md) +- [Numerical Methods](tutorials/module_2/non_linear_eqn_solver.md) - [Version Control](tutorials/module_2/version_control.md) - [Problem Solving Strategies](tutorials/module_2/problem_solving_strategies.md) - [Code debugging](tutorials/module_2/debugging_code) -- Code Documentation +- [Code Documentation](tutorials/module_2/documentation) - Code libraries & resources - [AI assisted programming](tutorials/module_2/assisted_programming) - Verification and Validation +- [Error](error.md) #### Applications of Computational Mathematics in ME - Systems of Equations and LU Decomposition - Nonlinear Equation Solver diff --git a/admin/CourseOverview.png b/admin/CourseOverview.png index dd17f78..91b135d 100644 Binary files a/admin/CourseOverview.png and b/admin/CourseOverview.png differ diff --git a/admin/gantt.png b/admin/gantt.png index 4ade819..d94ba7e 100644 Binary files a/admin/gantt.png and b/admin/gantt.png differ diff --git a/admin/meeting-notes/2025-04-25.md b/admin/meeting-notes/2025-04-25.md index d1d3529..eb37d34 100644 --- a/admin/meeting-notes/2025-04-25.md +++ b/admin/meeting-notes/2025-04-25.md @@ -1,39 +1,19 @@ ## Updates - Worked on Jupyter Notebooks -- Brainstorming for applications of practical problems +- Tutorial Overview has changed: + - Mod 1 complete + - Mod 2 near completion + - Writing in .md -> convert to .ipynb & .tex --- ## Topics and questions -- Application of practical problems to real engineering problems - -> Started "material_research.md" - -- Course overview - -> Cleaned up module 1 - -> Re-arranged Module 2 - -> **Go through** together - -- Good Potential Textbook for Numerical methods - -> https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/Index.html --- ## Discussion -- Module 2 -> Learn how to use built in tools to solve problems such as fsolve, or other numerical methods -- Module 3 -> Learn the mathematics of the numerical methods. -- Module 1 -> Make the tutorials more interactive and set up problems for end of the tutorial problem. - -- Tutorial rough format: - - Introduction - - Interactive code cell - - Explanations - - Interactive code cell - - End of tutorial problem (could use data from previous code cells) - -- Make full & partial notebooks -> Work on full notebook and then remove content for a partial version at the end. -- Give students code for concepts in problems that students haven't learned yet. Adapt for each tutorial and make students do more themselves in later interactions. --- ## Actions diff --git a/book/module0/installing_anaconda.tex b/book/module0/installing_anaconda.tex new file mode 100644 index 0000000..0ff3d6f --- /dev/null +++ b/book/module0/installing_anaconda.tex @@ -0,0 +1,158 @@ +\section{Installing Anaconda}\label{installing-anaconda} + +This tutorial will cover the steps on how to install Anaconda. + +\emph{Note for Advanced users: For those who wish to have a lightweight +installation, can install miniconda or miniForge, however for this +course we will show you how to use Anaconda Navigator. If you've never +used the programs before then using Anaconda is recommended.} + +\subsubsection{What is Anaconda?}\label{what-is-anaconda} + +Anaconda Distribution is a popular open-source Python distribution +specifically designed for scientific computing, data science, machine +learning, and artificial intelligence applications. It simplifies the +set up and use of Python for data science, machine learning, and +scientific computing. It comes with all the important tools you need, +like NumPy, Pandas, and JupyterLab, so you don't have to install +everything separately. The Conda package manager helps you install and +update software without worrying about breaking other programs. It also +lets you create separate environments, so different projects don't +interfere with each other. Additionally, Anaconda includes programs like +JupyterLab for interactive coding, and Spyer a MATLAB-like IDE. + +\subsection{Instructions}\label{instructions} + +\begin{enumerate} +\def\labelenumi{\arabic{enumi}.} +\item + Find the latest version of Navigator from the official Anaconda + Inc.~website: \href{https://www.anaconda.com/download}{Download + Anaconda} +\item + Press the \emph{Download Now} button. +\item + Press the \emph{Skip registration} button below the submit button, + otherwise submit your email address to subscribe to the Anaconda email + list. +\item + Under Anaconda Installers press \emph{Download} or find the + appropriate version for your operating system below. +\end{enumerate} + +Proceed to next section for your respective operating system. + +\subsubsection{Windows}\label{windows} + +\begin{enumerate} +\def\labelenumi{\arabic{enumi}.} +\setcounter{enumi}{4} +\tightlist +\item + Once the download is complete, double click the executable (.exe) file + to start the installer. Proceed with the installation instructions. +\end{enumerate} + +\begin{figure} +\centering +\includegraphics{figures/installingAnaconda_windows_installer_01_welcome.png} +\caption{Welcome screen} +\end{figure} + +\begin{figure} +\centering +\includegraphics{figures/installingAnaconda_windows_installer_02_terms.png} +\caption{Terms and conditions} +\end{figure} + +\begin{enumerate} +\def\labelenumi{\arabic{enumi}.} +\setcounter{enumi}{5} +\tightlist +\item + Select the \emph{Just Me} recommended option. +\end{enumerate} + +\begin{figure} +\centering +\includegraphics{figures/installingAnaconda_windows_installer_03_for.png} +\caption{Install for} +\end{figure} + +\begin{enumerate} +\def\labelenumi{\arabic{enumi}.} +\setcounter{enumi}{6} +\tightlist +\item + You can leave the destination folder as is, just make sure you have a + minimum of \textasciitilde5 GB available storage space. Press + \emph{Next} to proceed. +\end{enumerate} + +\begin{figure} +\centering +\includegraphics{figures/installingAnaconda_windows_installer_04_destination.png} +\caption{Installation destination} +\end{figure} + +\begin{enumerate} +\def\labelenumi{\arabic{enumi}.} +\setcounter{enumi}{7} +\tightlist +\item + It is recommended to register Anaconda3 as the default python version + if you already have an instance of python installed. Otherwise, you + can leave the checkboxes as defaults. +\end{enumerate} + +\begin{figure} +\centering +\includegraphics{figures/installingAnaconda_windows_installer_05_advanced.png} +\caption{Avanced Options} +\end{figure} + +\begin{figure} +\centering +\includegraphics{figures/installingAnaconda_windows_installer_06_installing.png} +\caption{Installing} +\end{figure} + +\begin{figure} +\centering +\includegraphics{figures/installingAnaconda_windows_installer_07_installing2.png} +\caption{Installing 2} +\end{figure} + +\begin{figure} +\centering +\includegraphics{figures/installingAnaconda_windows_installer_08_installing_complete.png} +\caption{Complete} +\end{figure} + +\begin{figure} +\centering +\includegraphics{figures/installingAnaconda_windows_installer_09_cloud.png} +\caption{Cloud} +\end{figure} + +\begin{figure} +\centering +\includegraphics{figures/installingAnaconda_windows_installer_10_finish.png} +\caption{Finish} +\end{figure} + +\begin{enumerate} +\def\labelenumi{\arabic{enumi}.} +\setcounter{enumi}{8} +\tightlist +\item + You made it! Anaconda is now installed, you are ready for launch. + Assuming that you didn't add Anaconda to PATH environment variable you + will need to start navigator from the start menu. +\end{enumerate} + +\subsubsection{Mac/Linux}\label{maclinux} + +Anaconda provides installation documentation for Mac and Linux users, +please refer to the +\href{https://docs.anaconda.com/anaconda/install/}{documentation page}. diff --git a/book/module1/installing_anaconda.tex b/book/module1/installing_anaconda.tex deleted file mode 100644 index 0ff3d6f..0000000 --- a/book/module1/installing_anaconda.tex +++ /dev/null @@ -1,158 +0,0 @@ -\section{Installing Anaconda}\label{installing-anaconda} - -This tutorial will cover the steps on how to install Anaconda. - -\emph{Note for Advanced users: For those who wish to have a lightweight -installation, can install miniconda or miniForge, however for this -course we will show you how to use Anaconda Navigator. If you've never -used the programs before then using Anaconda is recommended.} - -\subsubsection{What is Anaconda?}\label{what-is-anaconda} - -Anaconda Distribution is a popular open-source Python distribution -specifically designed for scientific computing, data science, machine -learning, and artificial intelligence applications. It simplifies the -set up and use of Python for data science, machine learning, and -scientific computing. It comes with all the important tools you need, -like NumPy, Pandas, and JupyterLab, so you don't have to install -everything separately. The Conda package manager helps you install and -update software without worrying about breaking other programs. It also -lets you create separate environments, so different projects don't -interfere with each other. Additionally, Anaconda includes programs like -JupyterLab for interactive coding, and Spyer a MATLAB-like IDE. - -\subsection{Instructions}\label{instructions} - -\begin{enumerate} -\def\labelenumi{\arabic{enumi}.} -\item - Find the latest version of Navigator from the official Anaconda - Inc.~website: \href{https://www.anaconda.com/download}{Download - Anaconda} -\item - Press the \emph{Download Now} button. -\item - Press the \emph{Skip registration} button below the submit button, - otherwise submit your email address to subscribe to the Anaconda email - list. -\item - Under Anaconda Installers press \emph{Download} or find the - appropriate version for your operating system below. -\end{enumerate} - -Proceed to next section for your respective operating system. - -\subsubsection{Windows}\label{windows} - -\begin{enumerate} -\def\labelenumi{\arabic{enumi}.} -\setcounter{enumi}{4} -\tightlist -\item - Once the download is complete, double click the executable (.exe) file - to start the installer. Proceed with the installation instructions. -\end{enumerate} - -\begin{figure} -\centering -\includegraphics{figures/installingAnaconda_windows_installer_01_welcome.png} -\caption{Welcome screen} -\end{figure} - -\begin{figure} -\centering -\includegraphics{figures/installingAnaconda_windows_installer_02_terms.png} -\caption{Terms and conditions} -\end{figure} - -\begin{enumerate} -\def\labelenumi{\arabic{enumi}.} -\setcounter{enumi}{5} -\tightlist -\item - Select the \emph{Just Me} recommended option. -\end{enumerate} - -\begin{figure} -\centering -\includegraphics{figures/installingAnaconda_windows_installer_03_for.png} -\caption{Install for} -\end{figure} - -\begin{enumerate} -\def\labelenumi{\arabic{enumi}.} -\setcounter{enumi}{6} -\tightlist -\item - You can leave the destination folder as is, just make sure you have a - minimum of \textasciitilde5 GB available storage space. Press - \emph{Next} to proceed. -\end{enumerate} - -\begin{figure} -\centering -\includegraphics{figures/installingAnaconda_windows_installer_04_destination.png} -\caption{Installation destination} -\end{figure} - -\begin{enumerate} -\def\labelenumi{\arabic{enumi}.} -\setcounter{enumi}{7} -\tightlist -\item - It is recommended to register Anaconda3 as the default python version - if you already have an instance of python installed. Otherwise, you - can leave the checkboxes as defaults. -\end{enumerate} - -\begin{figure} -\centering -\includegraphics{figures/installingAnaconda_windows_installer_05_advanced.png} -\caption{Avanced Options} -\end{figure} - -\begin{figure} -\centering -\includegraphics{figures/installingAnaconda_windows_installer_06_installing.png} -\caption{Installing} -\end{figure} - -\begin{figure} -\centering -\includegraphics{figures/installingAnaconda_windows_installer_07_installing2.png} -\caption{Installing 2} -\end{figure} - -\begin{figure} -\centering -\includegraphics{figures/installingAnaconda_windows_installer_08_installing_complete.png} -\caption{Complete} -\end{figure} - -\begin{figure} -\centering -\includegraphics{figures/installingAnaconda_windows_installer_09_cloud.png} -\caption{Cloud} -\end{figure} - -\begin{figure} -\centering -\includegraphics{figures/installingAnaconda_windows_installer_10_finish.png} -\caption{Finish} -\end{figure} - -\begin{enumerate} -\def\labelenumi{\arabic{enumi}.} -\setcounter{enumi}{8} -\tightlist -\item - You made it! Anaconda is now installed, you are ready for launch. - Assuming that you didn't add Anaconda to PATH environment variable you - will need to start navigator from the start menu. -\end{enumerate} - -\subsubsection{Mac/Linux}\label{maclinux} - -Anaconda provides installation documentation for Mac and Linux users, -please refer to the -\href{https://docs.anaconda.com/anaconda/install/}{documentation page}. diff --git a/tutorials/module_2/intro_to_numerical_methods.md b/tutorials/module_2/intro_to_numerical_methods.md deleted file mode 100644 index 6791aff..0000000 --- a/tutorials/module_2/intro_to_numerical_methods.md +++ /dev/null @@ -1,41 +0,0 @@ -# Numerical Methods -Engineering - -## What is a numerical method? -Numerical methods are techniques that transform mathematical problems into forms that can be solved using arithmetic and logical operations. Because digital computers excel at these computations, numerical methods are often referred to as computer mathematics. - - -## Numerical Differentiation -Forwards difference -Backwards difference - -[Read More](https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/chapter20.00-Numerical-Differentiation.html) - -## Roots and Optimization -Incremental Search -Bisection -Modified Secant -Newton-Raphson - - -## Numerical Integration - -Trapezoidal - -Simpson's Rule - -[Read More](https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/chapter21.00-Numerical-Integration.html) - - -## Numerical Solutions of Ordinary Differential Equations - -Euler's Method -- Forward -- Backwards - -Runge-Kutta Method - -[Read More](https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/chapter22.00-ODE-Initial-Value-Problems.html) - - - diff --git a/tutorials/module_2/non_linear_eqn_solver.md b/tutorials/module_2/non_linear_eqn_solver.md new file mode 100644 index 0000000..6d1ded3 --- /dev/null +++ b/tutorials/module_2/non_linear_eqn_solver.md @@ -0,0 +1,117 @@ +# Solving non-linear equations + +## Introduction + + +## Prerequisites + +```python +import numpy +import scipy +import sympy +``` + + +## fsolve from SciPy + +```python +from scipy.optimize import fsolve + +def equations(vars): + x, y = vars + eq1 = x**2 + y**2 - 25 + eq2 = x**2 - y + return [eq1, eq2] + +initial_guess = [1, 1] +solution = fsolve(equations, initial_guess) +print("Solution:", solution) +``` + +## root from SciPy +```python +from scipy.optimize import root + +def equations(vars): + x, y = vars + eq1 = x**2 + y**2 - 25 + eq2 = x**2 - y + return [eq1, eq2] + +initial_guess = [1, 1] +solution = root(equations, initial_guess) +print("Solution:", solution.x) +``` + + +## minimize from SciPy +```python +from scipy.optimize import minimize + +# Define the equations +def equation1(x, y): + return x**2 + y**2 - 25 + +def equation2(x, y): + return x**2 - y + +# Define the objective function for optimization +def objective(xy): + x, y = xy + return equation1(x, y)**2 + equation2(x, y)**2 + +# Initial guess +initial_guess = [1, 1] + +# Perform optimization +result = minimize(objective, initial_guess) +solution_optimization = result.x + +print("Optimization Method Solution:", solution_optimization) + +``` + +## nsolve from SymPy +```python +from sympy import symbols, Eq, nsolve + +# Define the variables +x, y = symbols('x y') + +# Define the equations +eq1 = Eq(x**2 + y**2, 25) +eq2 = Eq(x - y, 0) + +# Initial guess for the solution +initial_guess = [1, 1] + +# Use nsolve to find the solution +solution = nsolve([eq1, eq2], [x, y], initial_guess) +print("Solution:", solution) +``` + +## newton_method from NumPy + +```python +import numpy as np + +def equations(vars): + x, y = vars + eq1 = x**2 + y**2 - 25 + eq2 = x**2 - y + return np.array([eq1, eq2]) + +def newton_method(initial_guess, tolerance=1e-6, max_iter=100): + vars = np.array(initial_guess, dtype=float) + for _ in range(max_iter): + J = np.array([[2 * vars[0], 2 * vars[1]], [2 * vars[0], -1]]) + F = equations(vars) + delta = np.linalg.solve(J, -F) + vars += delta + if np.linalg.norm(delta) < tolerance: + return vars + +initial_guess = [1, 1] +solution = newton_method(initial_guess) +print("Solution:", solution) +``` \ No newline at end of file diff --git a/tutorials/module_3/non_linear_eqn_solver.md b/tutorials/module_3/non_linear_eqn_solver.md deleted file mode 100644 index 6d1ded3..0000000 --- a/tutorials/module_3/non_linear_eqn_solver.md +++ /dev/null @@ -1,117 +0,0 @@ -# Solving non-linear equations - -## Introduction - - -## Prerequisites - -```python -import numpy -import scipy -import sympy -``` - - -## fsolve from SciPy - -```python -from scipy.optimize import fsolve - -def equations(vars): - x, y = vars - eq1 = x**2 + y**2 - 25 - eq2 = x**2 - y - return [eq1, eq2] - -initial_guess = [1, 1] -solution = fsolve(equations, initial_guess) -print("Solution:", solution) -``` - -## root from SciPy -```python -from scipy.optimize import root - -def equations(vars): - x, y = vars - eq1 = x**2 + y**2 - 25 - eq2 = x**2 - y - return [eq1, eq2] - -initial_guess = [1, 1] -solution = root(equations, initial_guess) -print("Solution:", solution.x) -``` - - -## minimize from SciPy -```python -from scipy.optimize import minimize - -# Define the equations -def equation1(x, y): - return x**2 + y**2 - 25 - -def equation2(x, y): - return x**2 - y - -# Define the objective function for optimization -def objective(xy): - x, y = xy - return equation1(x, y)**2 + equation2(x, y)**2 - -# Initial guess -initial_guess = [1, 1] - -# Perform optimization -result = minimize(objective, initial_guess) -solution_optimization = result.x - -print("Optimization Method Solution:", solution_optimization) - -``` - -## nsolve from SymPy -```python -from sympy import symbols, Eq, nsolve - -# Define the variables -x, y = symbols('x y') - -# Define the equations -eq1 = Eq(x**2 + y**2, 25) -eq2 = Eq(x - y, 0) - -# Initial guess for the solution -initial_guess = [1, 1] - -# Use nsolve to find the solution -solution = nsolve([eq1, eq2], [x, y], initial_guess) -print("Solution:", solution) -``` - -## newton_method from NumPy - -```python -import numpy as np - -def equations(vars): - x, y = vars - eq1 = x**2 + y**2 - 25 - eq2 = x**2 - y - return np.array([eq1, eq2]) - -def newton_method(initial_guess, tolerance=1e-6, max_iter=100): - vars = np.array(initial_guess, dtype=float) - for _ in range(max_iter): - J = np.array([[2 * vars[0], 2 * vars[1]], [2 * vars[0], -1]]) - F = equations(vars) - delta = np.linalg.solve(J, -F) - vars += delta - if np.linalg.norm(delta) < tolerance: - return vars - -initial_guess = [1, 1] -solution = newton_method(initial_guess) -print("Solution:", solution) -``` \ No newline at end of file diff --git a/tutorials/module_3/numerical_methods.md b/tutorials/module_3/numerical_methods.md new file mode 100644 index 0000000..6791aff --- /dev/null +++ b/tutorials/module_3/numerical_methods.md @@ -0,0 +1,41 @@ +# Numerical Methods +Engineering + +## What is a numerical method? +Numerical methods are techniques that transform mathematical problems into forms that can be solved using arithmetic and logical operations. Because digital computers excel at these computations, numerical methods are often referred to as computer mathematics. + + +## Numerical Differentiation +Forwards difference +Backwards difference + +[Read More](https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/chapter20.00-Numerical-Differentiation.html) + +## Roots and Optimization +Incremental Search +Bisection +Modified Secant +Newton-Raphson + + +## Numerical Integration + +Trapezoidal + +Simpson's Rule + +[Read More](https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/chapter21.00-Numerical-Integration.html) + + +## Numerical Solutions of Ordinary Differential Equations + +Euler's Method +- Forward +- Backwards + +Runge-Kutta Method + +[Read More](https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/chapter22.00-ODE-Initial-Value-Problems.html) + + + -- cgit v1.2.3