Difference between revisions of "EGR 103/Fall 2018/Test 2"

From PrattWiki
Jump to navigation Jump to search
Line 2: Line 2:
  
 
Memorizing Chapra 4.2 is '''not''' required.
 
Memorizing Chapra 4.2 is '''not''' required.
 +
 +
== CS 101 Practice Tests ===
 +
The following parts of [https://www2.cs.duke.edu/courses/common/cps06tests.html CS 101 practice tests] have material relevant to our Test II; please note that before Spring 2018, CS 101 used Python 2 and so those tests are not references.
 +
* First Exams
 +
** Fall 2018: 3B, 5
 +
** Spring 2018: 2A, 2B, 5
 +
* Second Exams
 +
** Spring 2018: 1A (sets not on test but good to know), 1B,  2A, 2C, 3, 4A,
 +
** Spring 2018 Booster:
 +
 
== logical masks ==
 
== logical masks ==
 
* Parentheses are critical!
 
* Parentheses are critical!

Revision as of 22:56, 8 November 2018

The test is necessarily cumulative, so while the focus will be on material learned since Test 1, the items at EGR_103/Fall_2018/Test_1 is still in play.

Memorizing Chapra 4.2 is not required.

CS 101 Practice Tests =

The following parts of CS 101 practice tests have material relevant to our Test II; please note that before Spring 2018, CS 101 used Python 2 and so those tests are not references.

  • First Exams
    • Fall 2018: 3B, 5
    • Spring 2018: 2A, 2B, 5
  • Second Exams
    • Spring 2018: 1A (sets not on test but good to know), 1B, 2A, 2C, 3, 4A,
    • Spring 2018 Booster:

logical masks

dictionaries

  • Be able to start a dictionary from scratch with {}
  • Be able to add new key/value pairs to dictionaries
  • Be able to change values in dictionaries
  • Be able to check if a key exists without breaking Python if it doesn't
  • Be able to iterate over the keys, the values, or both at once

strings

  • Know how to use ord() and chr() and remember they can only convert one item at a time
  • If needed, the relevant parts of the ASCII table (all or some of the printable characters - [1]) will be given to you
  • Know how to use split() and join()

files

  • Be able to open a file for writing, write formatted text to it, and close it (i.e. use open, write, and close)
  • Be able to load rectangular arrays of data from a text file


linear algebra

  • Given a set of linear algebra equations, be able to rearrange and write in matrix form.
  • Be able to calculate by hand the determinant of matrices up to 3x3 and the inverses of matrices up to 2x2.
  • Be able to write Python code to take determinants and inverses of matrices.
  • Be able to set up and solve a systems of 2 equations with 2 unknowns by hand and without a calculator.
  • Be able to write Python code to set up and solve systems of N equations with N unknowns.
  • Be able to write Python code to set up and solve for the unknowns of an N-variable, N-equation system and sweep through when some part of the A or b matrix changes due to some parameter. Be able to extract the individual components of the solution vectors and store them in arrays. And plot one or more of them. Possibly using different line styles. In color.
  • Norms
    • Be able to calculate the 1, 2 / Euclidean, and infinity norm of a 1D array by hand or using efficient Python code
    • Be able to calculate the 1, Frobenius, and infinity norm of a 2D array by hand or using efficient Python code
    • Be able to calculate the 2 norm of a 2D array using efficient Python code
    • Understand that "efficient Python code" means using np.norm(ARRAY, TYPE)
  • Condition numbers
    • Be able to calculate the condition numbers for up to 2x2 matrices using 1, 2, or Frobenius norms
    • Be able to explain what a condition number means for a system - specifically, that the base-10 logarithm of the condition number gives an upper bound on how many digits of precision are lost because of the system.

surfaces

  • The imports will be given to you
  • You need to know how to properly create a figure and an axis for doing 3D projections
  • Know how np.meshgrid() works, what the arguments are, and what it returns
  • Know how ax.plot_wireframe() and ax.plot_surface() work, including the cmap and facecolors keyword arguments for plot_surface()
  • Know that the default with a cmap is that the first color in the map goes to the bottom of the surface and the last color in the map goes to the top
  • Remember that when using facecolors the argument of the colormap should have a domain of 0 to 1; anything less than 0 maps to 0 and anything greater than 1 maps to 1.
  • Know how to add a colorbar if a cmap is in place.
  • You will be given a list of colormaps.
  • Know how to use ax.set() for setting axis labels, axis limits, and axis tick locations.
  • For the test, the surfaces will be functions of x and y and will be plotted using Cartesian coordinates.

finding roots

  • You will only be required to find roots on continuous functions for which you will be given sufficient information to find a bracket.
  • You will only be required to understand how opt.brentq() works to find roots using a closed method.
  • Remember that a valid bracket consists of two independent values for which a function has opposite signs.
  • opt.brentq() can only find one root at a time; if you are finding multiple roots, you either need multiple commands or a loop

finding extrema

  • For 1D functions, you will only be required to find extrema on continuous functions for which you will be given sufficient information to decide boundaries - this means understanding how opt.fminbound() works to find bounded minima and what slight changes to make to find maxima.
  • For 2D functions, you will only be required to find extrema on continuous functions for which you will be given sufficient information to decide initial guesses - this means understanding how opt.fmin() works to find unbounded minima on surfaces, what slight changes to make to find maxima, and how to use * to have a function call split a list into component parts.
  • opt.fminbound() and opt.fmin() can only find one root at a time; if you are finding multiple roots, you either need multiple commands or a loop

other

  • Know how to use np.random.shuffle() on lists - remember that it changes the list!

not on test

  • Coordinate systems other than Cartesian
  • Psychedelic donuts