1 / 8

12.010 Computational Methods of Scientific Programming

12.010 Computational Methods of Scientific Programming. Lecturers Thomas A Herring, Room 54-618, tah@mit.edu Chris Hill, Room 54-1511, cnh@gulf.mit.edu Web page http://www-gpsg.mit.edu/~tah/12.010. Overview Today. Review some aspects of Homework 4 (Mathematica).

iain
Download Presentation

12.010 Computational Methods of Scientific Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 12.010 Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room 54-618, tah@mit.edu Chris Hill, Room 54-1511, cnh@gulf.mit.edu Web page http://www-gpsg.mit.edu/~tah/12.010

  2. Overview Today • Review some aspects of Homework 4 (Mathematica). • Look at formatting of question 1 • Look at Energy calculation for Question 3. • Final Project and homework solution: Solution using odeXX differential equation solver in Matlab • End by looking at some graphics packages 12.010 Lec 24

  3. Mathematica Homework • Question 1: Formatting output was tricky:The notebook 12.010_Lec24_Mathematica.nb gives examples for some problems that developed • Question 2: OK • Question 3: NDSolve was the way to solve this problem along with FindRoot. • Energy calculation: Most integrated (including my solution) but energy could have been added to differential equation. (Example in notebook above) • Nearly everyone neglected that drag and rider force depends on total velocity not just the horizontal velocity. 12.010 Lec 24

  4. Graphics real-time output in Matlab • In Matlab: we can consider “real time” out put the results • When a plot is made you can set an “EraseMode” • Options are: • none — leaves all points on the screen • background — paints old points with background color. Erases old points but also erases any other information such as grid lines and text • xor — Exclusive or. Erases just the previously plotted points, leaves the background intact 12.010 Lec 24

  5. Generating animated sequence with Matlab • Basic mode of use: • Plot first point keeping the graphics handle • p = plot3(x,y,z,’.’, ‘EraseMode’,’xor’); • Set the axis limits: (Need to think of values to use here. • axis([-100 100 -100 100 -100 100]); • hold on • Now generate the sequence of points • Loop over time steps, compute new x y z • set(p,’Xdata’,x,’Ydata’,y,’Zdata’,z) • Drawnow • These ideas were demonstrated in Matlab M-file 12.010 Lec 24

  6. ODE Solvers • Use of ODE Solvers in Matlab (demonstrated in class) • Vector y is 2-d position and velocity (1:4). y0 = [0.0; 0.0; vx; vz]; [t,y,te,ye,ie] = ode23(@bacc,[0:1:tmax],y0,options); • The bacc routine computes accelerations. dy/dt is returned so that dy[1]=d(pos)/dt=y[3]; dy[2]=y[4]; and dy[3] and dy[4] are new accelerations function dy = bacc(t, y) % acc: Computes accelerations • Options sets ability to detect event such as hitting ground options = odeset('AbsTol',[terr 1 1 1],'Events','hit'); function [value,isterminal,direction] = hit(t,y) Value returns the height. • Look through Matlab help and use demo program 12.010 Lec 24

  7. Graphics Programs • Basic data plotting programs: • There a number of programs which fall into this basic category: • KaleidaGraph — commercial program runs on PC and Mac (~$150) (web http://www.synergy.com) • Tecplot — Available on Athena (Unix and PC) ($1300) (web http://www.amtec.com/) • Grace -- Similar to KaleidaGraph available free for Unix systems. The old version is called xmgr. (http://plasma-gate.weizmann.ac.il/Grace/ • Demo of basic features of these types of programs 12.010 Lec 24

  8. Summary • Looked at Mathematica homework solution • Example of 3-D Numerical integration Project • Graphics packages • Projects: • Presentations Thursday Dec 7. Each presentation and demonstration should 15 minutes. • Presentation should include brief description of project including role of each participant and a demonstration of project. • Final write-ups and code, due electronically Tues Dec 12. • We will also do class evaluations 12.010 Lec 24

More Related