Git Product home page Git Product logo

foundations-of-applied-mathematics / labs Goto Github PK

View Code? Open in Web Editor NEW
210.0 26.0 67.0 205.86 MB

Labs for the Foundations of Applied Mathematics curriculum.

Home Page: https://foundations-of-applied-mathematics.github.io/

TeX 99.85% Shell 0.08% Makefile 0.01% Python 0.06%
applied-mathematics applied-mathematics-curriculum computational-mathematics python linear-algebra algorithms data-science curriculum

labs's Introduction

About

Foundations of Applied Mathematics is a series of four textbooks developed for Brigham Young University’s Applied and Computational Mathematics degree program for beginning graduate and advanced undergraduate students. These are as follows:

The textbooks are being published by the Society for Industrial and Applied Mathematics. Volume 1 and Volume 2 are available now, and the remaining volumes are in development.

This repository contains a collection of Python labs that go in tandem with the textbooks. These expose students to applications and numerical computation and reinforce the theoretical ideas taught in the text. The text and labs combine to make students technically proficient and to answer the age-old question, "When am I going to use this?"

The Python Essentials labs introduce Python and its scientific computing tools. The Data Science Essentials labs introduce common tools for gathering, cleaning, organizing, and presenting data in Python. The Volume 1 and Volume 2 labs are also currently available; labs for the other volumes are forthcoming.

Visit foundations-of-applied-mathematics.github.io/ or the releases page to download the lab manual PDFs directly.

Build Instructions

If you would rather build the PDFs locally, fork this repository and clone your fork. Each volume can then be built separately using the LaTeX files listed below.

  • Python Essentials: PythonEssentials.tex
  • Data Science Essentials: DataScienceEssentials.tex
  • Volume 1, Mathematical Analysis: Volume1.tex
  • Volume 2, Algorithm Design and Optimization: Volume2.tex
  • Volume 3, Modeling with Uncertainty and Data: Volume3.tex
  • Volume 4, Modeling with Dynamics and Control: Volume4.tex

Compile the files using TeXShop or a similar program, or via the command line:

# Create docs/Volume1.pdf with latexmk (see Makefile).
$ make Volume1.pdf

# Equivalently, use latexmk directly.
$ latexmk -pdf -outdir=docs Volume1.tex

These commands create a PDF in the docs/ folder called, for example, docs/Volume1.pdf.

Contributing

To report bugs in the provided materials, typos or inaccuracies in the labs, or any other problems, submit an issue on Github. Please contact us at [email protected] if you have specific questions or feedback, or if you would like to be more involved with developing the labs.

Authors

Managing Editors

Jeffrey Humpherys and Tyler J. Jarvis
Department of Mathematics
Brigham Young University
Email: [email protected]

Faculty Contributors

  • E. Evans, Brigham Young University
  • R. Evans, University of Chicago
  • J. Grout, Drake University
  • J. Whitehead, Brigham Young University

Editors

R. Jones, S. McQuarrie, M. Cook, A. Zaitzeff, A. Henriksen, R. Murray

Student Contributors

J. Adams, J. Bejarano, Z. Boyd, M. Brown, A. Carr, T. Christensen, M. Cook, B. Ehlert, M. Fabiano, A. Frandsen, K. Finlinson, J. Fisher, R. Fuhriman, S. Giddens, C. Gigena, C. Glover, M. Graham, F. Glines, M. Goodwin, R. Grout, J. Hendricks, A. Henriksen, I. Henriksen, M. Hepner, C. Hettinger, S. Horst, K. Jacobson, R. Jones, J. Leete, J. Lytle, R. McMurray, S. McQuarrie, D. Miller, J. Morrise, M. Morrise, A. Morrow, R. Murray, J. Nelson, E. Parkinson, M. Probst, M. Proudfoot, D. Reber, C. Robertson, M. Russell, R. Sandberg, C. Sawyer, J. Stewart, S. Suggs, A. Tate, T. Thompson, M. Victors, J. Webb, R. Webb, J. West, and A. Zaitzeff.

License

This work is licensed under the Creative Commons Attribution 3.0 United States License. To view a copy of this license please visit http://creativecommons.org/licenses/by/3.0/us/.

This project is funded in part by the National Science Foundation, grant no. TUES Phase II DUE-1323785.

labs's People

Contributors

cnoorda2 avatar halexus avatar jhumpherys avatar montu-byu avatar rdorff avatar shanemcq18 avatar socialsalt avatar tylerjarvis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

labs's Issues

Exceptions and File IO

The statement " The comma after the print command suppresses the automatic newline character, keeping the output of each individual print statement on the same line" is no longer correct, and does not reflect the code as it is in the lab currently.

PythonAndNumpy2 - pdf

Clarify in the problem where you add "hunter" to the last element of the string that they know it should read "bearhunter" not "bear hunter"

Suggestion: Move labs to Jupyter Book format

Suggestion for @jhumpherys @tylerjarvis. I wanted to make a suggestion for the labs that would really give them more legs and accessibility. The Jupyter people have now come up with a format (Jupyter Book) that really marries the PDF concept with the html concept with the executable code concept in a way that can be version controlled. Here is the workflow.

  1. Write content as markdown file (.md) along with some Jupyter configuration files and version control those in a GitHub repository.
  2. Jupyter book sofware allows you to compile an html version of the book locally (for testing)
  3. Set up GitHub Action on book source repository to push changes to a GitHub Pages site of the book upon commits to master.
  4. The html site for the Jupyter Book labs would be very accessible, LaTeX- and BibTex-like links and math rendering, and with a click of a button, the page will open as a local Jupyter notebook or Jupyter Lab hosted notebook or a CoLab hosted notebook with executable code and with a specified code environment.

I think this is the sweet spot. We've moved all the documentation for a number of our open source projects over to Jupyter Books. The two following examples are still under development, but they are far enough along to show a lot of the functionality of the medium.

  • The Tax-Calculator project's documentation is shown in the associated GitHub page in the upper-right corner. All the source code for that documentation is version controlled in the Tax-Calculator/docs/ folder. Whenever a pull-request is merged that has commits to the files in that folder, a GitHub Action deploys the updated version of the documentation to the GitHub page.
  • Another example is the OG-USA model. The Jupyter Book documentation is at the GitHub page associated with the repo, and the source for the documentation is in the OG-USA/docs/ folder.

Linear Transformation - pdf

The transforms problem (#1) should say "return a transformation of the data" not "return the transformed data" because at least one student actually made his code transform the original data array, so that the data input for the next method was corrupted by the previous method. It's a subtle change in wording, but an important point for the students to learn.

Breadth First Search - PDF

I had two students who returned valid shortest path lists that did not match what the auto grader was expecting. Below you will find their code and feedback.

----------Student 1----------
CODE:
if source not in self.d.keys():
raise KeyError("source node not in graph")

    # initialize list
    V = [] 
    # initialize deque
    Q = deque(source)
    # initialize set
    M = set(source)


    #traverse through graph step

    while set(V) != set(self.d.keys()): # until traversed graph
        diff = self.d[source].difference(M)

        M = M.union(self.d[source]) # update
        for x in diff:

            Q.append(x)

        source = Q.popleft()

        V.append(source) #append visited nodes
    return V

FEEDBACK:
Problem 2 (10 points):
Graph.traverse('A') failed
Graph: {'A': {'C', 'B'}, 'B': {'D', 'E', 'A'}, 'C': {'F', 'G', 'A'}, 'D': {'H', 'I', 'B'}, 'E': {'K', 'J', 'B'}, 'F': {'M', 'L', 'C'}, 'G': {'N', 'O', 'C'}, 'H': {'D'}, 'I': {'D'}, 'J': {'E'}, 'K': {'E'}, 'L': {'F'}, 'M': {'F'}, 'N': {'G'}, 'O': {'G'}}
Correct response: "['A', 'C', 'B', 'F', 'G', 'D', 'E', 'M', 'L', 'N', 'O', 'H', 'I', 'K', 'J']"
Student response: "['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'J', 'M', 'L', 'N', 'O']"
Score += 8

----------Student 2----------
CODE:
#raise NotImplementedError("Problem 2 Incomplete")
V = [] # .append
Q = deque() #.append #pop(0)
M = set() #use .add

    M.add(source)                    #append the fist one
    Q.append(source)

    while len(Q) != 0:
        current_node = Q.popleft()          #pop the first one and call it current node
        V.append(current_node)           #append it to V
        for x in self.d[current_node]-M:       #for loop so we add each individually, and subtract M so we dont re-add stuff
            M.add(x)                                            #self.d[current_node] is the neighbors
            Q.append(x)

    return V

FEEDBACK:
Problem 2 (10 points):
Graph.traverse('A') failed
Graph: {'A': {'C', 'B'}, 'B': {'D', 'E', 'A'}, 'C': {'F', 'G', 'A'}, 'D': {'H', 'I', 'B'}, 'E': {'K', 'J', 'B'}, 'F': {'M', 'L', 'C'}, 'G': {'N', 'O', 'C'}, 'H': {'D'}, 'I': {'D'}, 'J': {'E'}, 'K': {'E'}, 'L': {'F'}, 'M': {'F'}, 'N': {'G'}, 'O': {'G'}}
Correct response: "['A', 'C', 'B', 'F', 'G', 'D', 'E', 'M', 'L', 'N', 'O', 'H', 'I', 'K', 'J']"
Student response: "['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'J', 'M', 'L', 'N', 'O']"
Score += 8

Exceptions and File IO - pdf

It has come to my attention that the Exceptions and File IO lab has a section on string manipulation. It mentions format strings, but never mentions f strings. These are a more readable, more concise, and less prone to error than other ways of formatting, and they are also faster.

Example: In the third-to-last code block of the lab, you have the following code:
print("Is today {} {}, {}?".format(day, month, year))
Which could be simplified to the following using an f-string:
print(f"Is today {day} {month}, {year}?")

ADD F STRINGS WHERE NEEDED!!!

Breadth First Search - pdf

On the first page of the Breadth First Search Lab, the D row of this adjacency dictionary should be D : {A, B, C}.

Typo in profiling exercise

There appears to be a typo in exercise 7 of Lab 08. In particular, there is a snippet of code which reads:

def matrix_power(A, n):
    """Compute A^n, the n-th power of the matrix A."""
    product = A.copy()
    temporary_array = np.empty_like(A[0])
    m = A.shape[0]
    for power in range(1, power):
        #...

I think that the for loop should be changed to:

     for power in range(1, n):

This can also be found on line 757 in the profiling.tex file

ObjectOriented - solutions file

For the string magic method of ComplexNumber there's a "# Or, more likely," after the return statement with a way that students would probably code it. For the case where the complex part is negative it returns sign + str(self.imag) but a negative number cast as a string already has a negative sign. So this would print two negative signs.

QR Decomposition - pdf

There is a typo in the Additional Material section regarding complex QR decomposition. As I was working to apply the changes, I think I found that the defined sign(x) function might be incorrect. I believe it should be sign = lambda x: x/np.abs(x) if x!=0 else 1 instead of sign = lambda x: 1 if np.real(x) >= 0 else -1.

Suggestion: Update Exceptions_FileIO lab

It has come to my attention that the Exceptions and File IO lab has a section on string manipulation. It mentions format strings, but never mentions f strings. These are a more readable, more concise, and less prone to error than other ways of formatting, and they are also faster.

Example: In the third-to-last code block of the lab, you have the following code:
print("Is today {} {}, {}?".format(day, month, year))
Which could be simplified to the following using an f-string:
print(f"Is today {day} {month}, {year}?")

In addition, the statement " The comma after the print command suppresses the automatic newline character, keeping the output of each individual print statement on the same line" is no longer correct, and does not reflect the code as it is in the lab currently.

Breadth First Search - test driver

In the test_driver.py file for breadth first search, two of the test graphs are directed, where students can only make undirected graphs on problem 2.
(see pictures file for more details)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.