User Tools

Site Tools


gibson:teaching:spring-2016:math445:finaltopics

====== Differences ====== This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gibson:teaching:spring-2016:math445:finaltopics [2016/05/13 10:09]
gibson [Evaluating expressions]
gibson:teaching:spring-2016:math445:finaltopics [2016/05/16 06:45] (current)
gibson [Plotting]
Line 1: Line 1:
 ====== Math 445 final exam topics ====== ====== Math 445 final exam topics ======
  
 +The Math 445 final exam will be comprehensive,​ covering all material presented in lecture and lab (except for the derivation of differential equations from physics presented in lecture). Below is a broad overview but not exhaustive of topics that might be covered on the exam. 
  
 +----
 +===== Matlab syntax =====
  
 ====Vectors and matrices==== ====Vectors and matrices====
Line 19: Line 22:
   * ''​* \ + - =''​   * ''​* \ + - =''​
  
 +----
 ====Linear algebra versus elementwise operations=== ====Linear algebra versus elementwise operations===
  
 You should know the difference between linear algebra and elementwise operations on matrices and vectors. For example, given two 2 x 2 matrices ''​A''​ and ''​B'',​ you should be able to compute ''​A * B''​ and ''​A .* B''​ by hand. You should also know in what circumstances it's appropriate to use linear algebra operations or elementwise operations. ​ You should know the difference between linear algebra and elementwise operations on matrices and vectors. For example, given two 2 x 2 matrices ''​A''​ and ''​B'',​ you should be able to compute ''​A * B''​ and ''​A .* B''​ by hand. You should also know in what circumstances it's appropriate to use linear algebra operations or elementwise operations. ​
  
 +----
 ==== Solving systems of equations ==== ==== Solving systems of equations ====
  
Line 47: Line 51:
 </​code>​ </​code>​
  
 +----
 ==== Plotting ==== ==== Plotting ====
  
 You should know  You should know 
   * how to make $xy$-plots of given functions $y=f(x)$ using **linspace**,​ elementwise operations on vectors, **plot**, **semilogx**,​ **semilogy**,​ and **loglog**.   * how to make $xy$-plots of given functions $y=f(x)$ using **linspace**,​ elementwise operations on vectors, **plot**, **semilogx**,​ **semilogy**,​ and **loglog**.
-  * how to make 2D contour ​plots with **linspace**,​ **meshgrid**,​ elementwise matrix operationsand **contour** or **contourf** +  * how to make 2D color plots with **pcolor**, using **linspace**,​ **meshgrid**,​ elementwise matrix operations ​as well 
-  * how to make 3D surface ​plots with **linspace**,​ **meshgrid**, elementwise matrix operations, and **surf**+  * how to make 2D contour plots with **contourf** ​and **linspace****meshgrid** etc.  
 +  * how to make 2D quiver ​plots with **quiver** and **linspace**,​ **meshgrid** ​etc. 
 +  * how to make 3D surface plots with **surf** ​and **linspace**,​ **meshgrid**,​ etc. 
   * how to load data from a file and plot it   * how to load data from a file and plot it
   * how to label axes, title a plot, color the lines, show markers on data points, display a coordinate grid, show a colorbar, etc.    * how to label axes, title a plot, color the lines, show markers on data points, display a coordinate grid, show a colorbar, etc. 
  
-==== Log-linear relations ==== +----
- +
-You should know how to infer a functional relation $y=f(x)$ given a logarithmic or linear plot +
-, and which of **plot**, **semilogx**,​ **semilogy**,​ and **loglog** is best for a given relation $y=f(x)$.+
  
 ==== Evaluating expressions ==== ==== Evaluating expressions ====
Line 78: Line 82:
 </​code>​ </​code>​
  
 +----
 ==== Functions ==== ==== Functions ====
  
-You should be able to write simple Matlab functions to perform specified computations. For example,if asked to write a Matlab function that 5+You should be able to write simple Matlab functions to perform specified computations. For example, if asked to write a Matlab function that, given a value of $N$, evaluates  
 + 
 +\begin{eqnarray*} 
 +\sum_{n=1}^{N} \frac{n}{(n+1)^2} 
 +\end{eqnarray*} 
 + 
 +you should respond with  
 + 
 +<code matlab>​ 
 +function s = f(N) 
 +  n=1:N; 
 +  s = sum(n./​(n+2).^2) 
 +end 
 +</​code>​ 
 + 
 +---- 
 +====for loops==== 
 + 
 +You should know how to use ''​for''​ loops to perform repeated computations. For example, if asked to write a function that computes the above sum using a ''​for''​ loop (instead of using the ''​sum''​ function), you would write 
 + 
 +<code matlab>​ 
 +function s = f(N) 
 +  s = 0; 
 +  for n = 1:N 
 +    s = s + n/(n+2)^2 
 +  end 
 +end 
 +</​code>​ 
 + 
 +---- 
 +==== random numbers ==== 
 + 
 +You should know how to get random numbers of various kinds 
 + 
 +  * **rand**: a random floating-point number between 0 and 1.  
 +  * **randi(max)**:​ a random integer between 1 and max. 
 +  * **randn**: a random number in a Gaussian distribution with mean 0 and standard deviation 1. 
 + 
 +Each of these random number generators has a matrix version, as well. E.g. 
 +  * **rand(m,​n)**:​ an m x n matrix of random floating-point numbers between 0 and 1. 
 +  * **randi(m,​n,​max)**:​ an m x n matrix of random integers between 1 and max. 
 +  * **randn(m,​n)**:​ an m x n matrix of a random numbers in a Gaussian distribution with mean 0 and standard deviation 1. 
 + 
 +==== if-else statements ==== 
 + 
 +You should know how to write simple ''​if-else''​ statements such as  
 + 
 +<code matlab>​ 
 +x = randn(); 
 +if x < 0  
 +  fprintf('​%d is negative\n',​ x) 
 +elseif x == 0 
 +  fprintf('​%d is zero\n',​ x) 
 +else 
 +  fprintf('​%d is positive\n',​ x) 
 +end 
 +</​code>​ 
 + 
 +---- 
 +===== Lab material ==== 
 + 
 +You should have a good grasp on the mathematics and Matlab programming of the lab material. For example, 
 + 
 +---- 
 +==== log-linear relations ==== 
 + 
 +You should know how to infer a functional relation $y=f(x)$ given a logarithmic or linear plot 
 +, and which of **plot**, **semilogx**,​ **semilogy**,​ and **loglog** is best for a given relation $y=f(x)$. 
 + 
 +---- 
 +==== writing functions ​ ===== 
 + 
 +You should know how to write Matlab functions that do basic computations,​ like matrix-vector multiplication. 
 + 
 +----  
 +==== hamster dynamics / Google Page Rank ==== 
 + 
 +Given a graph of nodes and one-way links between them, you should be able to write a system of equations that governs random walks through the network of links, and then write Matlab code that would calculate the steady-state distribution. 
 + 
 +---- 
 +==== nonlinear equations and Newton'​s method ====  
 + 
 +You should know the mathematics behind Newton'​s method for solving nonlinear equations, how to code it in Matlab, and how to use Matlab'​s built-in solver **fsolve** to solve nonlinear equations.  
 + 
 +---- 
 +==== differential equations ==== 
 + 
 + You should know now how to write an anonymous function for a system of first-order differential equations $d\vec{x}/​dt = \vec{f}(t, \vec{x})$, and how to solve that system of equations numerically using Matlab'​s **ode45**. And given a quiver plot of a 2-d differential equation, you should be able to draw an approximate solution of the equation starting from a given initial condition, by tracing out a curve that is everywhere tangent to the arrows. 
  
-  * **fprintf**:​ how to do basic formatted output with **fprintf**. 
-  * **function**:​ how to write your own functions. ​ 
-  * scripts: how to write scripts to perform a given sequence of commands. 
-  * hamster dynamics / Google Page Rank: how to translate a graph of nodes and links to a transition matrix and then calculate the steady-state distribution. 
gibson/teaching/spring-2016/math445/finaltopics.1463159373.txt.gz · Last modified: 2016/05/13 10:09 by gibson