Coder Social home page Coder Social logo

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

View Code? Open in Web Editor NEW
207.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 People

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

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.

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.

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}.

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: 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.

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

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

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)

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.

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

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.