Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352
Quiz 1 Solutions
Fall 2008
Note: You can check these results by entering the expressions into Matlab.
1.
> x = 0:1:1
x =
0
1
2.
> x = [0 2 4 6 8 10];
> y = x/max(x)
y =
0
0.2000
3.
0.4000
0.6000
0.8000
1.0000
> x = linspace(10,50,5);
> y = ( min(x)
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352
Quiz 1
16 October 2008
Your Name:
This exam booklet contains
1. This cover sheet.
2. A sheet with information on Matlab builtin functions.
3. Four short answer questions.
4. Two questions requiring an understanding of Matlab mle functions.
Do not
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352
Quiz 2
25 November 2008
Print Your Name:
Your Signature:
This exam booklet contains
1. This cover sheet.
2. Three multiplechoice questions.
3. Three short answer questions.
Do not open the exam booklet until you are instructed to do so.
You will h
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352
Midterm Exam Solution
Fall 2008
1. Let x = a and x = b be the brackets for a rootnding problem for a scalar function f (x). If
= b a is the size of the original bracket, the size of the interval containing the root after
four iterations of the bi
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352
Midterm Exam
4 November 2008
Print Your Name:
Your Signature:
This exam booklet contains
1. This cover sheet.
2. Nine questions ranging in value from 5 points to 30 points. The point value
increases with the number of the question. The maximum poss
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352
Final Exam
11 December 2008
Print Your Name: Your Signature:
This exam booklet contains 1. This cover sheet. 2. Multiple choice and true/false questions worth 5 points each. 3. Additional questions ranging in value from 10 points to 20 points. The
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352
Final Exam Solution
Fall 2008
1. Analysis of the eects of roundo on the numerical solution to a system of n equations in n
unknowns leads to the following expression
xx
x
(A)
r
b
where x is the numerical solution to Ax = b, (A) is the condition nu
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352
Quiz 2 Solution
Fall 2008
1. An n n matrix is illconditioned if two or more rows of the matrix are nearly linearly
dependent.
2. Consider two n element column vectors, u and v, and a small, positive scalar value, . A mathematical statement that th
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352
Problem Set 6
18 November 2008
Quick Questions
Refer to the details on each problem for the expectation of the solution.
1. (10 points) Textbook problem 7.5. Show at least one intermediate step for each part. For
example, here is my partial solutio
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352 Homework Format
Fall 2008
Homework assignments will consist of a mixture of problem types. Some
problems will ask you to perform a specic, short, task. Others will involve the
development of programs. This document provides instructions for complet
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352
Problem Set 5
due noon, 3 November 2008
This assignment is for extra credit only. Points earned on this assignment will be added to
your point total for all homework problems. The total number of points that can possibly
be earned will not increase
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352
Problem Set 1
due 2 October 2007
Quick Questions
1. (15 points) Use Matlab to evaluate the following formulas. Show the results of executing
the formulas in a Matlab session. For each formula use variables, not numerical values for
the constants gi
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352
Problem Set 1
due 7 October 2008
Quick Questions
Use Matlab to evaluate the following formulas. Show the results of executing the formulas in
a Matlab session. For each formula use variables, not numerical values for the constants given at
the star
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
ME 352
Problem Set 4
due 28 October 2008
Quick Questions
In the textbook problem 5.21, the following formula is given for the optimum damping ratio
of a springmassdamper system
cos 4
1 2 = 1 + 8 2 8 4
( )
1. (5 points) Rearrange Equation ( ) in at leas
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
CS 401: Applied Scientific
Computing with MATLAB
Andrew Pershing
3134 Snee Hall
[email protected]
2555552
Outline
Course Description
Details
Policies
Intro to CIS Tools Curriculum
Role of Computing in Science and
Engineering
Basic Concepts
Course Goals
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
This is
Course Business:
http:/www.cs.cornell.edu/Courses/cs401/2001fa
Contains syllabus, lecture notes, examples, homework
Office Hours
Monday & Tuesday, 111 in 3134 Snee (or by appointment)
Registration:
get my signature or CS Undergrad office (3
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
Matlab Fundamentals:
working
with
data
Outline
Errata & Homework I.
Matrix Multiplication
NDarrays
Loading, saving, and plotting data
Matlab History
Matlab stands for Matrix Laboratory
Developed by from LAPACKa series of
routines for numerical linear
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
Text Processing
Outline
Announcements:
Homework I: due Today. by 5, by email
Discuss on Friday.
Homework II: on web
Text
Matlab path
Survey
This isnt English!
Why do we need text?
Comments from functions
File names
Label plots
Interact with users
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
Improving perfomance
Matlabs a pig
Outline
Announcements:
Homework I: Solutions on web
Homework II: on webdue Wed.
Homework I
Performance Issues
Homework I
Grades & comments are waiting in your
mailboxes
PASSyou passed!
try to learn from your mi
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
Matlab Programming
a logical
approac
h
Outline
Announcements:
Homework I: due Wed. by 5, by email
Last day to add/drop or change credit/audit
Iteration
Conditionals and logic
Mfiles
Iteration
For loops in Matlab use indexnotation:
for j=st:step:
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
Input Output
Garbage In,
Garbage Out
Outline
Announcements:
Homework III: due Today. by 5, by email
Discuss on Friday.
Homework IV: on web, due following Friday
Linear Systems Example: AdvectionDiffusion
Advanced ASCII
Binary Basics
Key Points on
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
Ordinary Differential
Equations
Outline
Announcements:
Homework II: Solutions on web
Homework III: due Wed. by 5, by email
Homework II
Differential Equations
Numerical solution of ODEs
Matlabs ODE solvers
Homework II
Good job
Something I learned:
l
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
Stochastic Simulations
Six degrees of
Kevin Bacon
Outline
Announcements:
Homework II: due Today. by 5, by email
Discuss on Friday.
Homework III: on web
Random Numbers
ExampleSmall Worlds
Random Numbers
Computers are deterministic
Therefore, comp
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
Linear Systems
What is the
Matrix?
Outline
Announcements:
Homework III: due Wed. by 5, by email
Office Hours: Today & tomorrow, 111
Ideas for Friday?
Linear Systems Basics
Matlab and Linear Algebra
Ecology of Linear Systems
Linear Systems are fou
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
Statistics and Simple
Plots
Outline
Announcements:
Homework II: due Today. by 5, by email
Statistics
Simple plots
Statistics
Descriptive
summarize properties of data
Comparative
compare data sets
test hypotheses
Descriptive Stats
Most common de
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
CS 401: Applied Scientific
Scientific
Computing with MATLAB
Andrew Pershing
3134 Snee Hall
[email protected]
2555552
Outline
Course Description
Details
Policies
Intro to CIS Tools Curriculum
Role of Computing in Science and
Engineering
Basic Concepts
Cou
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
This is
is
Course Business:
http:/www.cs.cornell.edu/Courses/cs401/2001fa
Contains syllabus, lecture notes, examples, homework
Office Hours
Monday & Tuesday, 111 in 3134 Snee (or by
appointment)
Registration:
get my signature or CS Undergrad office
Birla Institute of Technology & Science, Pilani  Hyderabad
Applied scientific computing using MATLAB
CS 401

Spring 2013
Statistics and Simple Plots
Outline
Announcements:
Homework II: due Today. by 5, by email
Statistics
Simple plots
Statistics
Descriptive
summarize properties of data
Comparative
compare data sets
test hypotheses
1
Descriptive Stats
Most common