EGR 103/Fall 2023/Lab 10

From PrattWiki
Jump to navigation Jump to search

Group Gradescope

Based on Chapra 8.9

In general, there are many (correct) ways to re-write the equations in matrix form. For this specific problem, to make the autograder happy, the unknowns need to be in the same order as presented in the lab handout.

Based on Chapra 8.10

In general, there are many (correct) ways to re-write the equations in matrix form. For this specific problem, to make the autograder happy, the equations need to be in the matrix in the same order presented in the problem and the unknowns need to be in the same order as presented in the lab handout. Also, given the signs of the constants on the right side of the equation (all positive), you can figure out where to move the unknowns in the equations. Note that for this problem the coefficient matrix will be the same every time since the geometry of the system does not change - your function will be returning two 2-D arrays: a 6x1 for the forces and a 6x6 for the coefficient matrix.

Connect

  • 8.2:
    • Matrix multiplication in Python 3 is done with the @ symbol
    • You can create an $$N\times N$$ identity matrix $$I$$ with np.eye(N)
    • You can get a transpose of an array by appending the array name with .T
  • 8.3:
    • Rearrange the equations so $$p$$ and $$r$$ are positive and $$q$$ is negative. Do not normalize. There are 8 different ways to arrange these equations based on which side you move things to alone, and really infinite solutions given other normalizations!
  • 8.4
    • Remember that the inner dimensions must match to be able to perform matrix multiplication.
  • 8.5
    • You can get imaginary numbers by putting an int of floating point number directly in front of the letter j; for example, 1j would be $$i$$ and 1.5-3.6j would be $$1.5-3.6i$$
  • 8.9
    • You will have written code that you can use to solve this as part of the Group Gradescope assignment this week. Use that.


Individual Gradescope

Based on Chapra 8.6

  • The autograder will not allow numpy (or anything else!) to be imported
  • Your solution will likely have a triple loop. Do some matrix multiplications by hand for small and then larger matrices and figure out what processes you are using. Code those.
  • Given that your solution will likely have a triple loop, be careful with your indentation!
  • As noted, trying to create an empty list of list of 0 can be problematic since the interior lists are actually pointing to the same information. To visualize the wrong and right ways to make a list of lists of 0, see Python Tutor with examples.

Individual Lab Report

Sweeps

Make sure you understand the examples at Python:Linear_Algebra#Sweeping_a_Parameter and Python:Linear_Algebra#Sweeping_Two_Parameters before starting these. You can ignore Python:Linear_Algebra#Multiple_solution_vectors_simultaneously.