3 Pages

homework5

Course: CS 322, Spring 2003
School: Cornell
Rating:
 
 
 
 
 

Word Count: 1254

Document Preview

322: CS Problem Set 5 Due: Monday, July 29, 2002 (In Lecture) The policies for this homework assignment are as follows: You must work by yourself on Question 2. You may work with at most one other person on Questions 1 and 3. Consult the course website for the Academic Integrity rules. Problem sets will be weighted equally in determining your final grade. The number of questions or total number of points on a...

Register Now

Unformatted Document Excerpt

Coursehero >> New York >> Cornell >> CS 322

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
322: CS Problem Set 5 Due: Monday, July 29, 2002 (In Lecture) The policies for this homework assignment are as follows: You must work by yourself on Question 2. You may work with at most one other person on Questions 1 and 3. Consult the course website for the Academic Integrity rules. Problem sets will be weighted equally in determining your final grade. The number of questions or total number of points on a given problem set is irrelevant. Writing will be graded on content, as well as on grammar, spelling, punctuation, etc. Mathematical exercises will be graded on the overall set-up of the problem as well as correctness. Points will be deducted on the Matlab questions for poorly commented code and inefficient code/redundant computations. Submit your assignment in two different parts (Part 1 for Question 2 and Part 2 for Questions 1 and 3). Every student should submit Part 1. At the top of the first page for Part 1, write your name, the course number, the problem set number, Part 1, your e-mail address, your student ID number, and the date. Each team of up to two students should submit Part 2 jointly. The information at the top of Part 2 should be the same, except there should be up to two names at the top of the paper, and Part 1 should be replaced with Part 2. 1. (10 points) Least Squares Polynomials In lecture, we derived the equations to compute the "best-fit" line (in the least squares sense) through n data points in 2D. Using the same procedure, we can derive equations that yield the "best-fit" parabola, cubic, etc. In general, if there are n data points, then we can find the "best-fit" polynomial of degree d when d < n. You will derive these equations in this exercise. First, derive the equations (and their solution) to find the "best-fit" parabola through n data points with n > 2. Second, repeat the procedure to find the "best-fit" cubic through n data points with n > 3. Compare the equations you obtained with those for the "best-fit" line from your lecture notes. You should notice a pattern. Next, write down the equations for the "best-fit" polynomial of degree d with d < n using the pattern you observed above. Formulate the problem as a matrix system. Now that we have the equations for the "best-fit" polynomial of degree d, you are asked to turn the results into code. To this end, complete the following Matlab function so that it performs as described: function c = BestFitPoly(x,y,d) % % Input: % x,y are column n vectors % d is an integer and corresponds to the degree of the % best-fit polynomial through the (x,y) points. % % Output: % c is a column d+1 vector such that % c(x) = c(d+1)*x^d+c(d)*x^(d-1)+...+c(2)*x+c(1). % is the best-fit polynomial through the (x,y) points. Use the method of normal equations to obtain the coefficients. You are not allowed to use polyfit.m or other similar existing Matlab functions for this exercise. Finally, write a script LSPolys.m that does the following: 1 1. Reads in the data from "data.txt", which can be downloaded from the course website. The format of this data is as follows: The x coordinates are in the first column, and the y coordinates are in the second column. 2. Computes and stores the coefficients for the LS polynomials of degrees d = 1, 2, 3, 5, 7, and 10. 3. Uses six subplots of the form (3,2,i), i=1:6 in which the LS polynomial of a particular degree is shown as a black line, and the data points are plotted as red circles. Label the plots appropriately. Turn in your mathematical derivations, Matlab function, script, and the associated plots. It is fine to turn in black-and-white plots. NO points will awarded be if the mathematical derivation is not included in the submission for this question. 2. (10 points) Rootfinding and Fractals! Let f be the complex function given by f (z) = (z 2 - 1)(z 2 + 0.16), where z = x + iy. The equation has 4 roots given by z1 = 1, z2 = -1, z3 = 0.4i, and z4 = -0.4i. In this exercise, we consider finding the roots of f (z) using Newton's Method for finding roots. Suppose that we are given z0 = x0 + iy0 as a starting point for Newton's Method. Which root will the method find? As it turns out, there is no good way to predict which root the method will find. For this exercise, you will investigate which root Newton's method finds for various starting points and will generate a beautiful fractal as a result! First, complete the following function which performs Newton's Method and returns the color corresponding to the root it found in 20 iterations or less or to failture: function color = Newton(z) % % Input: % z = complex number % % Output: % color = the color associated with the root found by Newton's Method % according to the following key: % color = 'y', if Newton's Method found z_1 % 'r', if Newton's Method found z_2 % 'b', if Newton's Method found z_3 % 'g', if Newton's Method found z_4 % 'k', if Newton's Method was unsuccessful % after 20 iterations. % More precisely, "unsuccessful" means that Matlab cannot reduce % (z^2-1)(z^2+0.16) to less than 0.0001 (in absolute value) in fewer % than 20 Newton iterations. Second, write a script that calls Newton.m with various starting values z=x+iy where x [0.15, 0.55] and y [-0.15, 0.15]. Save the x and y coordinates and the colors returned by Newton.m in a structure named Points. The three fields in the Points structure should be x, y, and color. Finally, you should plot the points according to the obvious scheme: if color = r , then plot the corresponding point red. Turn in your Matlab function, your Matlab script, and the fractal that your code generated. It is fine to turn in a black-and-white fractal plot. HELPFUL HINTS: The ith entry in Points can be initialized as follows: Points(i) = struct('x',3,'y',5,'color','r'). The fields can later be accessed as Points(i).x, etc. See Chapter 1 of your text for m...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Cornell - CS - 322
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: homework5_ps.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -o homework5_ps.ps ho
Cornell - CS - 322
CS 322: Problem Set 6 Due: Friday, August 2, 2002 (In Lecture)The policies for this homework assignment are as follows: Because this is due on the last day of class, no homework will be accepted past 5:00 P.M. on the day it is due. Assignments subm
Cornell - CS - 322
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: homework6_ps.dvi %Pages: 4 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -o homework6_ps.ps ho
Cornell - CS - 322
CS 322: Quiz 1 Friday, June 28, 2002The rules for this quiz are as follows: Write your name, student ID number, and e-mail address in the upper-right hand corner of the quiz. This quiz will last for 15 minutes. Show ALL work for partial/full cred
Cornell - CS - 322
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: quiz1_ps.dvi %Pages: 1 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -o quiz1_ps.ps quiz1_ps.d
Cornell - CS - 322
CS 322: Quiz 2 Monday, July 8, 2002The rules for this quiz are as follows: Write your name, student ID number, and e-mail address in the upper-right hand corner of the quiz. This quiz will last for 15 minutes. Show ALL work for partial/full credi
Cornell - CS - 322
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: quiz2_ps.dvi %Pages: 1 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -o quiz2_ps.ps quiz2_ps.d
Cornell - CS - 322
CS 322: Quiz 3 Friday, July 12, 2002The rules for this quiz are as follows: Write your name and student ID number in the upper-right hand corner of the quiz. This quiz will last for 15 minutes. Show ALL work for partial/full credit. This includes
Cornell - CS - 322
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: quiz3_ps.dvi %Pages: 1 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -o quiz3_ps.ps quiz3_ps.d
Cornell - CS - 322
CS 322: Quiz 4 Friday, July 19, 2002The rules for this quiz are as follows: Write your name and student ID number in the upper-right hand corner of the quiz. This quiz will last for 15 minutes. Show ALL work for partial/full credit. This includes
Cornell - CS - 322
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: quiz4_ps.dvi %Pages: 1 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -o quiz4_ps.ps quiz4_ps.d
Cornell - CS - 322
CS 322: Quiz 5 Friday, July 26, 2002The rules for this quiz are as follows: Write your name and student ID number in the upper-right hand corner of the quiz. This quiz will last for 15 minutes. Show ALL work for partial/full credit. This includes
Cornell - CS - 322
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: quiz5_ps.dvi %Pages: 1 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -o quiz5_ps.ps quiz5_ps.d
Cornell - CS - 322
CS 322: Quiz 6 Friday, August 2, 2002The rules for this quiz are as follows: Write your name and student ID number in the upper-right hand corner of the quiz. This quiz will last for 15 minutes. Show ALL work for partial/full credit. This include
Cornell - CS - 322
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: quiz6_ps.dvi %Pages: 1 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -o quiz6_ps.ps quiz6_ps.d
Cornell - CS - 322
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: prelim_ps.dvi %Pages: 7 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -o prelim_ps.ps prelim_p
Cornell - CS - 322
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: final_ps.dvi %Pages: 10 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -o final_ps.ps final_ps.
University of Louisiana at Lafayette - WMC - 8199
William M. Chirdonwchirdon@louisiana.edu Office: 216B Madison Hall Ph#: (337) 482-6564Education University of Michigan, Ann ArborCombined Ph.D., Macromolecular Science and Engineering/Biologic and Materials Science, December 2004 Thesis: Diffuse
University of Louisiana at Lafayette - WMC - 8199
Parameters:depth=2 m Time=250 hr T(initial)=300 K MaxHyd=.60 CemFract=.2 Q[total]=478000 Ea=45700 k0=29209./(20) h(top)=25 w/ m^2 K rho[c]=2350 k[c]=1.65 Cp[c]=1150 T[air]=301 D=.15 m k[sty]=.012Incorporation of laboratory research into classroom
Kentucky - ME - 631
my -it 1a) = A cos cosh (k ( z + H ) )e L my my my -i t -it -it = Ak cos = Ak cos = Ak cos =0 w= sinh (k ( z + H ) )e sinh (k (- H + H ) )e sinh (0 )e z L L L b) 2 = 0 2 2 x 2+ 2 z 2 my my m -it -i t =0 + Ak 2 c
Kentucky - ME - 631
1. a) Irrotational vortex : u = Q= r1r2hdr dz0 =h 2r 22 h 2rr2r11 dr r2r2 r 2 1 1 1 2 h r2 1 = 2h dr = dr = Q 2 r 2 0 0 r1 2 2r 2 ( 2 ) 1 r 2 2 r1 r 2 2 sin( -30 o ) = -0.727 10 - 4 s -1 b) f = 2 sin = 2 (24 * 6
Kentucky - ME - 631
a a 1. a) f ( x, y ) = f 0 cos ( 3 x + y ) + cos ( 3 x - y ) + cos( ay ) 2 2 2 f x 2 2 f y 2 2 f2 3a 2 a 3a a = f 0 - cos ( 3x - y ) cos ( 3 x + y ) - 4 2 2 4 2 a2 a a a = f 0 - cos ( 3 x + y ) - cos ( 3 x - y ) - a 2 cos
UCSD - MAE - 101
P1=2 atm 0.88 kg/s
UCSD - MAE - 101
UCSD - MAE - 101
UCSD - MAE - 101
MAE 101B, Spring 2009Equation Sheet for Midterm 2 05/12/09Viscous Shear Stress on a Plane Wall (defined by y = 0) w = Flat-Plate Boundary Layer Equations u v + = 0, x y u Bernouilli Equation p(x) + U (x)2 U 2 = constant = p + . 2 2 u u p 2 u U
UCSD - MAE - 101
UCSD - MAE - 101
UCSD - MAE - 101
Georgia Tech - ATOC - 5560
Lecture 16.Light scattering and absorption by atmospheric particulates. Part 3: Scattering and absorption by nonspherical particles: DDA methods. Examples.Objectives: 1. Basics physics of dipole interactions. 2. Outline of the DDA method. 3. Effec
UMBC - PHYS - 112
Physics 112Solutions to Homework Questions 1Homework 1 (solutions)(2004 Fall)Chapt15, Problem-1:A 4.5 x 109 C charge is located 3.2 m from a 2.8 x 109 C charge. Find the electrostatic force exerted by one charge on the other.Solution: Sinc
UMBC - PHYS - 112
Physics 112Solutions to Homework Questions 1Homework 1 (solutions)(2004 Fall)Chapt15, Problem-1:A 4.5 x 109 C charge is located 3.2 m from a 2.8 x 109 C charge. Find the electrostatic force exerted by one charge on the other.Solution: Sinc
UMBC - PHYS - 112
Physics 112Solutions to Homework Questions 7Homework 7 (solutions)(2004 Fall)An AC power supply produces a maximum voltage of !Vmax = 100 V. This power supply is connected to a 24.0-&quot; resistor, and the current and resistor voltage are measure
UMBC - PHYS - 112
%!PS-Adobe-3.0 %Requirements: duplex %RBINumCopies: 1 %Pages: (atend) %APL_DSC_Encoding: UTF8 %Title: (Microsoft Word - 04fall_phys112_hk7.doc) %Creator: (Word: cgpdftops CUPS filter) %CreationDate: (Tuesday, October 26 2004 09:27:34 EDT) %For: (Ian
UMBC - PHYS - 112
Physics 112 Homework 8 (solutions) (2004 Fall)Solutions to Homework Questions 8Chapt22, Problem6: The two mirrors in Figure P22.6 meetat a right angle. The beam of
UMBC - PHYS - 112
Physics 112Solutions to Homework Questions 1Homework 1 (solutions)(2004 Fall)Chapt15, Problem-1:A 4.5 x 109 C charge is located 3.2 m from a 2.8 x 109 C charge. Find the electrostatic force exerted by one charge on the other.Solution: Sinc
Texas A&M - LESSON - 240
Memorandum To: Billy Bob Kirkham, Chairman of the Board Through: Mickey Stratton From: Vic Musculoso We at Mighty Mick's School of Muscles are very proud of our project &quot;Old and Bold&quot;. The objective of this project is to encourage our senior citizens
FIU - COT - 6930
A h z wzewokd p pb mf ef b ac {AEkzypX%kYh8dk p | f | f iee mf ef b ac f ie ie | l ie gb ebc g fg i p p m kygypVquAff8u~hdq!qd%VAdsylyphkGjgdAqvbjcdAwqIfd8AYwsyob mjiAAohvb |8AjfY!fuY8dlych{gyiArygychycAvqwfXqy
FIU - COT - 6930
%!PS-Adobe-2.0 %Creator: dvips 5.487 Copyright 1986, 1992 Radical Eye Software %Title: softencyc.dvi %Pages: 19 1 %BoundingBox: 0 0 612 792 %EndComments %DVIPSCommandLine: dvips softencyc.dvi -o softencyc.ps %BeginProcSet: tex.pro /TeXDict 250 dict d
FIU - COT - 6930
%!PS-Adobe-1.0 %Creator: frege:mclean (John McLean) %Title: stdin (ditroff) %CreationDate: Thu May 26 11:13:20 1994 %EndComments % Start of psdit.pro - prolog for ditroff translator % Copyright (c) 1985,1987 Adobe Systems Incorporated. All Rights Res
FIU - COT - 6930
The Specification and Modeling of Computer SecurityJohn McLean Center for High Assurance Computer Systems Naval Research Laboratory Washington, D.C. 20375Computer security models are specifications designed, among other things, to limit the damage
FIU - COT - 6930
#%-12345X@PJL JOB @PJL SET RESOLUTION=600 @PJL ENTER LANGUAGE=POSTSCRIPT %!PS-Adobe-3.0 %Title: Microsoft Word - sod.doc %Creator: Windows NT 4.0 %CreationDate: 15:8 8/11/2000 %Pages: (atend) %BoundingBox: 13 13 599 780 %LanguageLevel: 2 %DocumentNee
FIU - COT - 6930
1998 IEEE Symposium on Security andPrivacy,3-6 May 1998, Oakland, CaliforniaOn the Formal Definition of Separation-of-Duty Policies and their CompositionVirgil D. Gligor Electrical Engineering Department University of Maryland College Park, MD. 20
FIU - COT - 6930
%!PS-Adobe-3.0 %Title: http:/citeseer.nj.nec.com/rd/8.PDF %Creator: Windows NT 4.0 %CreationDate: 16:5 3/8/2002 %BoundingBox: 15 15 597 769 %LanguageLevel: 2 %DocumentNeededFonts: (atend) %DocumentSuppliedFonts: (atend) %EndComments %BeginSetup [{0 /
FIU - COT - 6930
x tc p x x ` v x v y v p ` v p x ` n y v x ` n x m qe$eqCdb1$3w'31iCqq7$I3$U77&quot;$ x37sqq11I7'q'7'Ies$33gi$qe7U3de$'l4d7'1er ` c p v x v ` y ` x ` p i ` p drr v x ` p v c f `r p p ` i d r ` a ` dc p ` x x v x x ` t `r
FIU - COT - 6930
9 6 4 2 0( &amp; UWeqU!2bbwte9&amp;8W2p7I! 531)'% # &quot; $!wU!22e9&amp;R!WEe!IWE!uF{9UvwvW!bp9W2WUv{Rp
FIU - COT - 6930
&amp; f F# d &amp;Q !I9gAif%!I&amp;$f(g&amp;$f$!$'GR'RQ9$g&amp;$f2G2'Gu4# 13 Pq P 13 3 3 5 f 1 Q 3A f t &amp; f F# 3 1A 1 8# 1 y !2I#IF42h4!e6IA)iGIAIfI#$f9!242#4Ciq9I$frY 8# 13 B 83 53 3 1A fA &amp; 8 &amp; t F a ` X 4v'GDGG2A%@#G4%i#2fr!w{G!(@#Yri#IF4lbYV d F 1#3 8# &amp; 3 f
FIU - COT - 6930
COT 6930 Advanced Topics in Theory Theory of Security Prof. Newman Homework 1. Due Thursday, Feb. 7, 2002. Analyze the following protocols using the BAN logic. Show all assumptions, idealized protocol, conclusions after each message delivery in the
Long Island U. - EE - 0406
Day High Monday Tuesday Wednesday Thursday Friday Saturday SundayLow 76 76 77 73 62 64 67 59 63 63 48 46 50 52 Temperature (F)Daily Temperatures90 80 70 60 50 40 30 20 10 0M on da y Tu es da y W ed ne sd ay sd ay da y Sa tu r Su nd ay Fr id ay
Long Island U. - EE - 0406
EIGHTH GRADE ENGLISHSpeakSummary Format: Main Character's Name: One Character Trait: Explain Why: Second Character Trait: Explain Why: Third Character Trait: Explain Why:Speak by Laurie Halse AndersonMargaret RyanMetz Meredith Hasemann-Cortes
Long Island U. - EE - 0406
Directions for The Power of a Penny Activity: 1. Ask the students, &quot;Would you rather take $1,000,000 right now, or a penny that doubles every day for a month?&quot; 2. Tell students that today they will be using a spreadsheet to calculate which choice wou
Long Island U. - EE - 0406
Margaret RyanMetz Grade: 7th Period: 2nd Lesson to be observed: Literature Circles Focus on clues Standard: English Language Arts Standard 1, 3, and 4 POST OBSERVATION REFLECTION FORM 1. The students were active participants in the lesson. The stude
East Los Angeles College - CHEM - 1005
LECTURE 2 Highly Reactive Carboxylic Acid Derivatives Preparation All of these functional groups are conveniently prepared from carboxylic acids as shown in the scheme below.OThe Chemistry of Acid Chlorides Dominated by Nucleophilic Substitution
East Los Angeles College - CHEM - 1005
Lecture 8 Reactions of Ketones and Aldehydes with bases Most C-H bonds are not considered to be acidic.H pKa ~ 51 H pKa ~ 44 H pKa ~ 43Lithium Diisopropyl Amide LDA is commonly used.Li NLDA =C-H bonds next to carbonyls are very weakly acidi
N.C. State - CSC - 440
CSC440 HW#1 SolutionProblem1 1 URL serves as a unique identifier for the Websites, so it is the key of the entity set Websites and it should be underlined. 2 For the subclasses Webstores and Personal Sites, they can not have the key attribute-URL, b
Arizona - AME - 352
AME 352, Exam-1, Answers 1. Number of moving bodies: 7 Number of full joints: 9 Number of half joints: 1 Number of degrees of freedom based on the mobility formula: 2 2. (a) Non-Grashof (b) Grashof 3.3 4= 0.16 CCW = 0.25 CWB P V = 0.96 P O VA
Arizona - AME - 352
AME 352, Fall 2008, Exam-2 1. Measurements in centimeters (a)Name: _ Solution _VC = VB + VCB RCB = 3.6 cm VCB = 3.6 2 = 7.2 VC = 8.3 cm/sec as shownn A C = A B + A CB + A tCB n ACB = 3.6 22 = 14.4 t ACB = 3.6 1.5 = 5.4AC = 17.8 cm/sec2 as sho
Arizona - AME - 352
AME 352, Exam-3 1. The moment arms with respect to C are shown in centimeters.Name: _ Solution _FAA3.5TFBBC8.4FC FAFBFCTC = 3.5 20 + 8.4FBFA = 20 0 FB =y30 = 0FB = 11.9 in positive y-directiony0 11.9 0 20 + FC = 0 +
Arizona - AME - 352
AME 352, Fall 08, HW-11. For each of the mechanical systems shown: (a) Identify each joint on the figure (write P for pin, S for slider, R for roll). (b) Assign numbers to the moving bodies (1, 2, 3, etc.). (c) Determine total number of moving bodi
Arizona - AME - 352
AME 352, Fall 08, HW-10 1. For a slider-crank mechanism with no offset the lengths of the crank and the connecting rod are given as 2 = 1.5 and 3 = 4. The mass centers are at the geometric centers. The inertial data are given as: m2 = 2, I G = 0.375,