Office hours are 12pm-1pm MTF. Or schedule an appointment.

Grades are posted into the web grades book. Make sure that posted grades coincide with their paper one.

For the first time login use your WM official email as “login” and hit the reset password button. You will get a password shortly via email.

If you have any suggestions or comments, please, let me know.

- Class goals and structure
- Computers introduction
- Programming languages overview
- Discretization - the main weakness of computers
- Binary representation

presentation and handouts

- Matlab as a fancy calculator
- Efficient editing
- Help related commands
- Operators precedence
- Matrices
- Colon (:) operator
- Plotting
- Array element-wise arithmetic operators

presentation and handouts

- Boolean algebra
- Comparison operators
- Conditional statements
- Loops
- Series

presentation and handouts

- Scripts
- Functions
- Saving and loading variables

presentation and handouts

Complimentary code

- find hypotenuse of right angle triangle hypotenuse.m
- homemade factorial script myfactorial.m
- find sin via Taylor’s series expansion mysin.m

- Goodness of the fit
- Parameter uncertainty estimations
- Homemade implementation of the fitter
- Matlab built-ins

presentation and handouts

Complimentary code

- Very general fitter function fitter.m
- Fitter check function fit_check.m
- Fitter function usage example fitter_usage_example.m
- Built in fit demo builtin_fitter_usage_example.m
- Built in fit check builtin_fit_check.m
- Data file for the above examples data_to_fit.dat

presentation and handouts

Complimentary code

- The main analysis script day_temp_analysis_session.m. To execute it in step wise fashion use:

`echodemo day_temp_analysis_session`

- Outside temperature data file yearly_outside_temperatures.dat
- Helper functions

- Data file to fit in class: data_for_sloppy_two_peak.dat

- Root finding problem
- Bisection method
- False position method
- Solution convergence

presentation and handouts

Complimentary code

- Simple bisection code bisection.m

- Secant method
- Newton-Raphson method
- Numerical derivative of a function
- Ridders method
- Root finding algorithms gotchas
- Root finding algorithms summary

presentation and handouts

- Rough implementation of the Newton-Raphson algorithm.
- How to use it with analytical and numerical derivatives.

- Danger of very small step in the numerical derivative calculation.

- Integration problem statement
- The Rectangle method
- Trapezoidal method
- Simpson method

presentation and handouts

- Monte Carlo Integration
- Numerical Integration methods error estimates
- Multidimensional integration
- Matlab functions for integration

presentation and handouts

Complimentary code

- very primitive 1d integration without checks integrate_in_1d.m
- very primitive 2d integration without checks integrate_in_2d.m
- sample function for 2d integration func2d.m

- Scientist toolbox
- Free software
- Version control software
- Final remarks

presentation and handouts

- Dimension definition
- Fractals
- Affine transformations
- Coastline length problem

presentation and handouts

Complimentary code

- Statistic and probability intro
- Random number generators

presentation and handouts

Complimentary code

- pegboard.m
- home made LCG generator lcgrand.m
- simple check script for the period of LCG check_lcgrand.m

- Coin flipping bets
- Matlab arrayfun
- The Monty Hall Paradox
- 1D disease spread

presentation and handouts

Complimentary code

- Introduction to optimization
- 1D minimization with the Matlab’s built-in: fminbnd
- 1D optimization - golden section search

presentation and handouts

Complimentary code

- calculation of black body radiation black_body_radiation.m
- a company profit vs. investment distribution profit.m

- Multi-D optimization
- Matlab built in Multi-D minimization - fminsearch
- Sample problems

presentation and handouts

Complimentary code

- Simple function which makes a 3D plot of a function of 2 variables plot3dForXY.m
- Usage example plot_sinc_3d.m of above function which plots the sample function z=-sinc(r) where r=sqrt(x
*x+y*y) fsample_sinc.m - Merit function for the suspended weights problem EconstrainedSuspendedWeights.m
- Merit function for the potential well problem merit_psi.m
- Complete example of the potential well problem potential_well_example.m

- Introduction to the combinatorial problem
- Backpack problem - brute force approach
- Traveling salesman problem
- Permutation generating algorithm

presentation and handouts

Complimentary code

- Simulated annealing/Metropolis algorithm
- Genetic algorithm

presentation and handouts

Complimentary code

- ODE - ordinary differential equations
- Cauchy boundary conditions
- Euler’s method

presentation and handouts

Complimentary code

- Euler’s method ODE solver odeeuler.m
- Example of the free fall numerical solution with Euler’s method ode_free_fall_example.m
- free fall forces calculation code free_fall_forces.m

- Example of stability issues in the ODE solvers ode_unstable_example.m

- The second-order Runge-Kutta method (RK2)
- The forth-order Runge-Kutta method (RK4)
- Matlab functions for ODEs

presentation and handouts

Complimentary code

- parachute jumper model (time dependent force) ode_parachute_jump_model.m
- projectile motion with air drag ode_projectile_with_air_drag_model.m
- predator and prey model shows oscillations ode_predator_prey_model.m
- Lorenz attractor model ode_lorenz_attractor.m

- Matlab solvers

presentation and handouts

Complimentary code

- the mobile problem mobile.m
- the Wheatstone bridge problem wheatstone_bridge.m

- Nearest neighbor interpolation
- Linear interpolation
- Polynomial fit
- Cubic spline interpolation
- Matlab built in interpolation
- Extrapolation

presentation and handouts

Complimentary code

- x,y data to interpolate data_for_interpolation1.m
- x,y parametric points for a circle data_for_interpolation2.m
- nearest neighbor interpolation interp_nearest.m
- linear interpolation interp_linear.m
- sample code comparing results of different interpolation algorithm sample_plots_for_inerpolation.m

- interpolation use example: what is the closest distance between two trajectories.
- help with the midterm project.

- Secure communication and encryption.

presentation and handouts

- Limits to computing speed and storage
- Parallel computing
- MATLAB’s parallel tools

presentation and handouts

Complimentary code

- for loop example for_script.m
- parfor loop example parfor_script.m

- help with the midterm project.

- Fourier series
- Discrete Fourier transform (DFT)
- Matlab implementation

presentation and handouts

Complimentary code

- Fourier series for |t| fourier_abs.m
- Fourier series for step function fourier_step.m

- Discrete Fourier transform
- Nyquist criteria
- DFT filters

presentation and handouts

Complimentary code

- filtersdemo.m
- fourier_frequencies.m
- freq_space_low_pass_filter.m
- voice_record.wav
- enlarge font size for plots niceplotset.m

- Voice FFT for different people. Use of
`audiorecorder`

from MATLAB. Musical notes singing analysis via time dependent spectrum in the separate SpectralView app. Delta function decomposition, i.e. a clapping sound fft.

- Speed of FFT
- Low-pass filter
- High-pass filter
- Band-pass filter
- Band-stop filter
- Brick wall filters artifacts
- Windowing
- Other DFT applications

presentation and handouts

Complimentary code

Voice filtering demo

- voice record with monochromatic noise voice_record_l27.wav
- voice filtering demo filter_voice_demo_l27.m
- fourier_frequencies.m
- filter application help function filter_application.m
- enlarge font size for plots niceplotset.m

Weather data analysis

- analysis demo weather_analysis_demo.m
- outside temperature data yearly_outside_temperatures.dat
- reduce_with_average.m

- Bubble sort method
- Quick sort method
- Heap sorting method
- The vector heap representation
- Matlab built ins ‘issorted’ adn ‘sort’

presentation and handouts

See what the president Obama (a senator at that time) has to say about the bubble sort method. Skip to the 34th second.

Complimentary code

Due date is on Monday at 1pm, unless specified otherwise. Make sure to add **phys256** to the subject line of your email submission.

Have a look at the sample homework report.

Visit W&M IT software support page and download Matlab from appropriate “Licensed Software >> Math & Statistics Software” section. They have several available versions. Either one is fine. Since we are learning Matlab, we will not have time to go to fancy toolboxes which Matlab provides/removes with new releases.

They do have versions for Macs and Linux but you might need to ask for it.

Complete an introductory survey.

See assignment in the hw01.pdf. Feel free to use hw01.tex for copy-pasting of the problem statements.

Assigned reading: scripts and functions chapter. Let me know if you spot typos, mistakes, or something strangely sounding. I will give bonus points for corrections and suggestions. Please, make sure that you are referring to the most up-to-date pdf, since I am fixing typos as soon as they are reported or spotted.

See assignment in the hw02.pdf. Feel free to use hw02.tex for copy-pasting of the problem statements.

data file hw02dataset.dat

Assigned reading: fitting chapter. Let me know if you spot typos, mistakes, or something strangely sounding. I will give bonus points for corrections and suggestions. Please, make sure that you are referring to the most up-to-date pdf, since I am fixing typos as soon as they are reported or spotted.

See assignment in the hw03.pdf. Feel free to use hw03.tex for copy-pasting of the problem statements.

Data files

- V (1st column) and I (2nd column) data hw02dataset.dat
- Data file with the Doppler radar measurements hw_fit_cos_problem.dat
- Gaussian beam data gaussian_beam.dat
- Data file data_to_fit_with_Lorenz.dat

Assigned reading: numerical derivatives chapter and root finding algorithms chapter. Let me know if you spot typos, mistakes, or something strangely sounding. I will give bonus points for corrections and suggestions. Please, make sure that you are referring to the most up-to-date pdf, since I am fixing typos as soon as they are reported or spotted.

See assignment in the hw04.pdf. Feel free to use hw04.tex for copy-pasting of the problem statements.

Assigned reading: numerical integration chapter. Let me know if you spot typos, mistakes, or something strangely sounding. I will give bonus points for corrections and suggestions. Please, make sure that you are referring to the most up-to-date pdf, since I am fixing typos as soon as they are reported or spotted.

See assignment in the hw05.pdf. Feel free to use hw05.tex for copy-pasting of the problem statements.

Due date Monday October 3rd of 2016 at 1pm.

See assignment in the midterm01.pdf. Feel free to use midterm01.tex for copy-pasting of the problem statements.

- measurements of the hull shape datafile

HW is due on Wednesday 10/12. See assignment in the hw06.pdf. Feel free to use hw06.tex for copy-pasting of the problem statements.

Assigned reading: random number generators chapter. Let me know if you spot typos, mistakes, or something strangely sounding. I will give bonus points for corrections and suggestions. Please, make sure that you are referring to the most up-to-date pdf, since I am fixing typos as soon as they are reported or spotted.

See assignment in the hw07.pdf. Feel free to use hw07.tex for copy-pasting of the problem statements.

Assigned reading: optimization chapter. Let me know if you spot typos, mistakes, or something strangely sounding. I will give bonus points for corrections and suggestions. Please, make sure that you are referring to the most up-to-date pdf, since I am fixing typos as soon as they are reported or spotted.

Continue to read: optimization chapter. Let me know if you spot typos, mistakes, or something strangely sounding. I will give bonus points for corrections and suggestions. Please, make sure that you are referring to the most up-to-date pdf, since I am fixing typos as soon as they are reported or spotted.

See assignment in the hw08.pdf. Feel free to use hw08.tex for copy-pasting of the problem statements.

- data file cities_for_combinatorial_search.dat
- data file cities_for_metropolis_search.dat

Due date *Monday* October 31st of 2016 at 1pm.

See assignment in the midterm02.pdf. Feel free to use midterm02.tex for copy-pasting of the problem statements.

Notice apostrophes in the saving of the movie statement

`save('movie_file.mat', 'map_evolution_movie')`

See assignment in the hw09.pdf. Feel free to use hw09.tex for copy-pasting of the problem statements.

Assigned reading: ODEs chapter. Let me know if you spot typos, mistakes, or something strangely sounding. I will give bonus points for corrections and suggestions. Please, make sure that you are referring to the most up-to-date pdf, since I am fixing typos as soon as they are reported or spotted.

Due date *Monday* November 14th of 2016 at 1pm.

You can work in a group with the size of 1, 2, or 3 teammates. A team *must not* consist of any subset of students who have previously worked together on a midterm in this class.

See assignment in the midterm03.pdf. Feel free to use midterm03.tex for copy-pasting of the problem statements.

- data file solar_system_data.mat

You might find useful: ODEs chapter. Let me know if you spot typos, mistakes, or something strangely sounding. I will give bonus points for corrections and suggestions. Please, make sure that you are referring to the most up-to-date pdf, since I am fixing typos as soon as they are reported or spotted.

You might find useful: DFT chapter and Digital filters chapter Let me know if you spot typos, mistakes, or something strangely sounding. I will give bonus points for corrections and suggestions. Please, make sure that you are referring to the most up-to-date pdf, since I am fixing typos as soon as they are reported or spotted.

See assignment in the hw10.pdf. Feel free to use hw10.tex for copy-pasting of the problem statements.

Complimentary data file hw_data_for_filter.dat

You can work in a group with the size of 1, 2, or 3 teammates. No constrains on the team composition, but I advise you to find teammates with a similar to you schedule.

See assignment in the final_exam_2016.pdf. Feel free to use final_exam_2016.tex for copy-pasting of the problem statements.

The Electronic submission deadline for the report and listings is *2pm on December 6th*.

Data file for problems 1, 2, and 3 capsule_and_plane_problem_datafile1.mat.

Function templates

Voice messages for problem 4. Each group must decode only the one assigned to them.

- noisy_msg1.wav Danya, Jamie, and Dana
- noisy_msg2.wav Seamus, Charles, and Jessica
- noisy_msg3.wav Clara and Maggie
- noisy_msg4.wav August, Drew, and Chelsea
- noisy_msg5.wav Xuanlin
- noisy_msg6.wav Francis, Michael, and Rollin
- noisy_msg7.wav Cara and Adam
- noisy_msg8.wav Dillon, Stephanie, and Alicia
- noisy_msg9.wav Connor, Patrick, and Ravn
- noisy_msg10.wav Kalen, Christine, and Mark
- noisy_msg11.wav Austin, Daniel, and Ridge
- noisy_msg12.wav Mary
- noisy_msg13.wav Sonya, Colin, and Elinor
- noisy_msg14.wav TBA
- noisy_msg15.wav TBA

For problem 1

```
>> [time,x,y] = capsule_flight_simulator(300, 2, 500, .1, 2*pi/5 );
>> time(end)
ans =
42.8555
>> x(end)
ans =
1.6716e+03
>> y(end)
ans =
5.0681e-04
```

For problem 2

```
>> [MaxHeight, t_at_max, vx_at_max, x_at_max] = capsule_max_height_parameters(300, 2, 500, .1, 2*pi/5 )
MaxHeight =
2.2089e+03
t_at_max =
16.9071
vx_at_max =
38.2439
x_at_max =
1.0391e+03
```

For problem 3 which is run against file capsule_and_plane_problem_datafile2.mat.

```
>> [ElevationAngle, Vescape, Tlaunch] = capsule_launch_solution( 'capsule_and_plane_problem_datafile2.mat');
Vescape =
637.3440
ElevationAngle =
1.4033
Tlaunch =
7.1754
```