SE4X03 Scientific Computing --- TA materials (2016 Winter)

Review session: 1pm--3pm, April 21, Thursday, ITB 139


My TA webpage: http://tgn3000.com/4x03.html

Email: tgnteach@gmail.com

View my OneNote: https://onedrive.live.com/redir?resid=6A19ABF8F53BC4DD!76381&authkey=!AGsdMHpHt2c6Hag&ithint=onenote%2c


Week 1. Matlab fundamentals


Week 2. Heath's book is a good reference. Find his lecture notes in the below link.

Michael Heath, SCIENTIFIC COMPUTING: AN INTRODUCTORY SURVEY

http://web.engr.illinois.edu/~heath/scicomp/notes/index.html


Week 4. Vectorized code for Assignment 1, Problem 9 

A1_original.zip, A1_vectorized.zip

You may want to diff the code and learn some Matlab tricks :-)

https://www.diffnow.com/?report=wjz5c

https://www.diffnow.com/?report=gzfrm

https://www.diffnow.com/?report=vm93p​​​


Week 5. My NOTES for two examples today  

SVN: Windows users use Tortoise SVN GUI (very handy);

Linux/OSX users are referred to http://www.cas.mcmaster.ca/~tang4/SE3F03/Week4.html


Week 7. Assignment 2, Problem 5, Matlab code: A2P5.m 

Marking Schemes for Midterm and A2


Week 8. Assignment 3. TUTORIAL NOTES

Please DO run this MarkingScript.m in your directory before and after your submit your code in SVN.

You can learn how the function fprintf prints text on screen or in files.


CORRECTION!!! The WEIGHTs used in the Simpson's rule should be: 1/6 for both end points, and 2/3 for the midpoint.

That is, I = ( f(a) + 4f((a+b)/2) + f(b) ) / 6​​


Week 12. Assignment 3 marking scheme

Hint of A4Q4: Write f(x)=(x-r)^2 * g(x), then plug f(x)/f'(x) in Newton iteration

x_{n+1} = x_n - f(x_n)/f'(x_n)

Then minus r on both hand sides, and notice the error terms are x_{n+1}-r=e_{n+1} and x_n-r=e_n.

Here you should be able to see something like

e_{n+1} = [e_n*g(x_n) + ......] / [2*g(x_n) + ......] 


Partial RK4 code I did in my tutorial:

f = @(t,y) [y(2), -y(1)];

​for i=1:NumberOfSteps

    k1 = f(told, yold);
    k2 = f(told, yold + h*k1/2);
    k3 = f(told, yold + h*k2/2);
    k4 = f(told, yold + h*k3);

    tnew = told+h;
    ynew = yold + h*(k1+2*k2+2*k3+k4)/6;
    T = [T; tnew];
    Y = [Y; ynew];

    told = tnew;

    yold = ynew;
end

© Gary Guangning Tan, 2015