6 Pages

lab04

Course: ECS 104, Spring 2008
School: Syracuse
Rating:
 
 
 
 
 

Word Count: 1281

Document Preview

104 ECS Engineering Computational Tools CIE Sections 002 & 007 Exercise 1: Plotting functions (to be done in lab as a learning exercise) The purpose of this exercise is to plot the function f ( x) = x 3 + 5 x 2 x 6 so that its zeroes can be approximately found. (Note that this is a minor modification of the polynomial we have been using in lecture.) As usual, start off by putting your name and an...

Register Now

Unformatted Document Excerpt

Coursehero >> New York >> Syracuse >> ECS 104

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.
104 ECS Engineering Computational Tools CIE Sections 002 & 007 Exercise 1: Plotting functions (to be done in lab as a learning exercise) The purpose of this exercise is to plot the function f ( x) = x 3 + 5 x 2 x 6 so that its zeroes can be approximately found. (Note that this is a minor modification of the polynomial we have been using in lecture.) As usual, start off by putting your name and an identifier (ECS104, Lab5, Exercise 1) in cells A1 and A2 of Sheet1. Now, after skipping a line, make a table of x and f(x), with x between -2 and +2 (in steps of 0.2). Make sure to format the table properly (with column headers in bold font and a reasonable number of decimal places for the values). Now generate a presentation quality plot of f vs. x. Make a note in your worksheet as to the approximate values of the two zeroes. Save the spreadsheet. Exercise 2: Newtons Method (to be done in lab as a learning exercise) The purpose of this exercise is to use Newtons method to find the zeroes of the polynomial f ( x) = x 3 + 5 x 2 x 6 On Sheet2, put your name and identifying information in cells A1 and A2. As we have been doing in lecture, we always start out by writing out the steps you will take (in pseudo-code). So, in the space below, write down a description as to how you will find the zeroes using Newtons method. Recall that Newtons method generates new values of x by the formula x j +1 = x j f (x j ) f ( x j ) Page 1 ECS104 -- Spring 2005 STOP HERE AND SHOW YOUR INSTRUCTOR YOUR WORK!!!!! The next step is to convert your written description into a flowchart. Do that in this space. ECS104 -- Spring 2005 Page 2 STOP HERE AND SHOW YOUR INSTRUCTOR YOUR WORK!!!!! Finally, we are ready to use the computer. After skipping a line, start a table with the column headings j, xj, f(xj), f(xj), and change (bold font please). Start with a initial guess for x=1.5. [By looking at the plot in Exercise 1, which zero do you think Newtons method will find?]. Put formulae in the first rows of the table for f(xj) [see above], f(xj) [use calculus], and change. So, in the second row of the table, insert the above formula to get the new x; copy down the formulae for f(x), f(x), and change. Now you can continue the iteration by simply copying the last row of the matrix down until the zero is found. [How far did you have to copy it down?] Box your final answer (that is, for what value of x does f(x)=0 ?) If you wanted to get the other zero, you could adjust your initial guess for x (say to 2) and you should converge to the other zero. Save the spreadsheet again. STOP HERE AND SHOW YOUR INSTRUCTOR YOUR WORK!!!!! Exercise 3: Bisection Method (to be done in lab as a learning exercise) The purpose of this exercise is to use the bisection method to find the zeroes of the polynomial f ( x) = x 3 + 5 x 2 x 6 Start with pseudo-code for how you will solve the problem. Recall that the bisection method is similar to the old game that goes like this: I think of a number between 1 and 100 and you have to guess it. You guess the mid-point (50) and I say higher. Now you know the number is between 50 and 100. You repeat the process until you guess the number. Write your pseudo-code here: ECS104 -- Spring 2005 Page 3 The flowchart goes here: Now to the computer. Start on Sheet3 with your name and identifier in cells A1 and A2. After skipping a line or two, create column headings xleft, f(xleft), xmidl, f(xmidl), xrite, f(xrite), and change. In the following row, put you initial guess for xleft (say 0.0) and xrite (say a 2.0), formula to calculate xmidl, and formulae to compute f(xleft), f(xmidl), and f(xrite). The value for change can be computed using xrite-xleft. [Recall that we need to start with xleft and xrite such that their respective function values have opposite signs.]. The real trick in the following rows is to determine which values to use for xleft and xrite. If f(xleft) and f(xmidl) are different signs, then we know the root is between them and the new xleft should be the same as the old xleft and the new xrite should be the same as the old xmidl. On the other hand, if f(xleft) and f(xmidl) are the same sign, then we know the zero is between xmidl and xrite, so the new xleft should be the old xmidl and the new xrite should be the same as the old xrite. [Draw a picture to follow this!!] We can implement this in Excel via the if() worksheet function [see the help page for more information.] Specifically, in the location for the new xleft we should put the formula =if(f(xleft)*f(xmidl)<0,xleft,xmidl). [Note that the terms in italics are not to be inserted directly as I have written; instead, use their cell addresses!] What this if() does is check the product of f(xleft) and x(xmidl). If they have opposite signs, then the product will be negative and we should use the old xleft; otherwise we should use the old xmidl. Put the similar formula in the position for the new xrite. The other formulae on the first line can now be dragged down to the line containing the new xleft and new ECS104 -- Spring 2005 Page 4 xrite. Finally, you can continue to drag the formulae down until you have converged to the zero. [How will you know this?] Box your final answer. Save the spreadsheet. STOP HERE AND SHOW YOUR INSTRUCTOR YOUR WORK!!!!! Homework: 1. Plotting functions (case 1) Plot the functions f1 ( x) = sin( x) x2 f 2 ( x) = 2 2 from x=0 to x=3. Make sure your plot is presentation quality. Determine (approximately) the value of x for which f1(x)=f2(x). Note this (in a box) on your worksheet. 2. Newtons method Use Newtons method for finding the value of x for which f1(x)=f2(x). Make sure that you include ps...

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:

Syracuse - ECS - 104
ECS 104 Engineering Computational Tools CIE Sections 002 &amp; 007 Spring 2005LABORATORY 12Solving Non-Linear Equations with Mathcad. Reading: Section 8.1 Introduction to Mathcad 11, by R.W. Larsen A. Review: User-Defined Functions Sometimes, when sol
Syracuse - ECS - 104
ECS 104 Engineering Computational Tools CIE Sections 002 &amp; 007 Spring 2005LABORATORY 11 Symbolic Operations in Mathcad. Reading: Chapter 7 Introduction to Mathcad 11, by R.W. Larsen A. Symbolic Operations A major difference between Mathcad and Exce
Syracuse - GYU - 02
Question 1Yes, I predicted the results correctly. Val1+ means val1 is increased by 1 after the operation. So During the operation &quot;val2=(val1=3)*val1+&quot;, the value of val1 is 3. val2=3*3=9. After that, val1 becomes 3+1=4. Question 2val1: +val2
Syracuse - WWANG - 09
i=2.0,i2=4.0i=4.0,i2=16.0i=6.0,i2=36.0i=8.0,i2=64.0i=10.0,i2=100.0The average value of 1-10 is 5.5
Syracuse - WWANG - 09
Q1.I was alble to predict the results.With the sentence (val1=3), the initial value of val1 is set as 3.For val2 =(val1=3)*val1+, the initial value of val1 is used, then it is added on one. So val2=3*3=9. val1 became 3+1=4 after that.So the outp
Syracuse - ECN - 611
Economics 621 Handout #4Extensive Form Games: UncertaintyExample without uncertaintyExogenous uncertainty611.04 - 1Information Sets611.04 - 2Two more examples:611.04 - 3A system of beliefs for an extensive form game ' is a mapping : X
Syracuse - ELE - 791
Object Oriented DesignCRI Spring 1999C+ - Language Structure1. Statements Preprocessor directives Declarations and Definitions Expressions l-values and r-values Statement evaluation model Overloaded operator model Declaration, Definition,
Syracuse - BJ - 8
CodeBlocks,Closures,and ContinuationsPresentedby:BassemELkarabliehOutline GettingStartedwithruby Somerubysyntax Rubyclasses Morerubysyntax NewconceptsinrubyGettingStartedRubyisadynamic,fullyobjectoriented scriptinglanguage. Installing
Syracuse - CSE - 382
CSE382 Algorithms and Data StructuresFall 2008Lab #7 Map&lt;K,V&gt; classversion 2Prologue:This lab is concerned with building a map class, Map&lt;K,V&gt;, using an instance of a Pair&lt;K,V&gt; class as the type held by an instance of the BTree&lt;T&gt;. That
Syracuse - CSE - 382
Abstract Data TypesCSE382 Algorithms and Data StructuresJim Fawcett 9/8/2008Revision 11. Removed errors in interface syntax2. Inserted note about Priority Queues implemented with Heap structure3. Eliminated iterators from tree interface to
Syracuse - CSE - 687
Design of a HashTable and its IteratorsJim Fawcett CSE687 Object Oriented Design Spring 2007Iterators as Smart PointersIterators are &quot;smart&quot; pointers: They provide part, or in some cases, all of the standard pointer interface: *it, i
Syracuse - CSE - 687
Documenting Architecture and DesignJim Fawcett Copyright 19992003 CSE687 Object Oriented Design Spring 2003Levels of Documentation Operational Concept Document Software Specification Design Document Test Report Overall view of architecture
Syracuse - CSE - 687
ExtensibleMarkupLanguage XMLJimFawcett CSE687ObjectOrientedDesign Spring2006Introduction XMLisataggedmarkuplanguagedesignedto describedata:LectureNote.xml XMLhasonlyacoupleofpredefinedtags Alltherestaredefinedbythedocumentdesigner. XMLcanbeuse
Syracuse - CSE - 687
Why C+? Why not C#?Jim Fawcett CSE687 Object Oriented Design Spring 2003Both are ImportantC+ has a huge installed base. Your next employer is very likely to be a C+ house.C# is gaining popularity very quickly. But, your next employer
Syracuse - CSE - 687
CSE687 Object Oriented Design Class NotesChapter 10 Design NotesJim Fawcett copyright (c) 1997 2001Chapter 10 - Design Issues1What is Design?Design is the process of deciding how to satisfy a program's requirements. Design has four e
Syracuse - CSE - 687
Handouts/CSE687/Code/STL/algorithmsSTL AlgorithmsPurpose:Illustrate a few typical STL algorithms. 1. fill Sets each value in a container range 2. fill_n Sets n consecutive elements to a value 3. copy copies elements from a range via iterator 4. g
Syracuse - CSE - 687
Template MetaProgramming Topics to be covered: Need a couple of real applications 1. Template Review+ a. Template classes vs template functions b. Specializations, complete and partial i. Specializations can have different interface c. Template membe
Syracuse - CSE - 687
Handouts/CSE687/Code/TemplateMetaProgramming /BinaryConversionACompileTimeFunctionPurpose:Calculatetheintegervalueofabinaryrepresentationatcompile time!ThisisourfirstexampleofTemplateMetaProgramming.It worksasfollows: 1. Arecursivetemplatestructu
Syracuse - CSE - 687
CSE687 Object Oriented DesignMidterm#3 Spring 2004Midterm #3 Instructor's SolutionName:_ SUID:_This is a closed book examination. Please place all your books on the floor beside you. You may keep one page of not
Syracuse - CSE - 687
CSE687 Object Oriented DesignMidterm #1 Spring 2004Midterm #1 Instructor's SolutionName:_ SUID:_This is a closed book examination. Please place all your books on the floor beside you. You may keep one page of no
Syracuse - CSE - 687
CSE687 Object Oriented DesignMidterm #4 Spring 2006Instructor's Solution for CSE687 Midterm #4 Jim FawcettThis is a closed book examination. Please place all your books on the floor beside you. You may keep one page of note
Syracuse - CSE - 687
CSE687 Object Oriented DesignMidTerm Makeup Spring 2004Midterm MakeupThis is a takehome examination, which you are expected to prepare entirely yourself. You may, however, ask the instructor or any TA any questio
Syracuse - CSE - 687
CSE687ObjectOrientedDesignMidterm#3Spring2006InstructorsSolutionforCSE687Midterm#3 JimFawcettThisisaclosedbookexamination.Pleaseplaceallyourbooksonthefloorbesideyou. Youmaykeeponepageofnotesonyourdesktopinadditiontothisexampackage.All examina
Syracuse - CSE - 687
CSE687 Object Oriented DesignMidterm #1 Spring 2006Instructor's Solution for CSE687 Midterm #1 Jim FawcettThis is a closed book examination. Please place all your books on the floor beside you. You may keep one page of note
Syracuse - CSE - 687
CSE687 Object Oriented DesignMidterm #4 Spring 2007CSE687 Midterm #4Instructor's SolutionThis is a closed book examination. Please place all your books on the floor beside you. You may keep one page of notes on your deskt
Syracuse - CSE - 687
CSE687ObjectOrientedDesignMidterm#1Spring2007CSE687Midterm#1InstructorsSolutionThisisaclosedbookexamination.Pleaseplaceallyourbooksonthefloorbesideyou. Youmaykeeponepageofnotesonyourdesktopinadditiontothisexampackage.All examinations will
Syracuse - CSE - 687
CSE687 Object Oriented DesignMidterm #3 Spring 2007CSE687 Midterm #3Instructor's SolutionThis is a closed book examination. Please place all your books on the floor beside you. You may keep one page of notes on your deskt
Syracuse - CSE - 687
CSE687 Object Oriented DesignMidterm #2 Spring 2006Instructor's Solution for CSE687 Midterm #2Jim FawcettThis is a closed book examination. Please place all your books on the floor beside you. You may keep one page of not
Syracuse - CSE - 687
CSE687 Object Oriented DesignMidterm #4 Spring 2005Midterm #4Name:Instructor's SolutionThis is a closed book examination. Please place all your books on the floor beside you. You may keep one page of notes on yo
Syracuse - CSE - 687
CSE687 Object Oriented DesignMidTerm #1Spring 2003Midterm#1InstructorsSolutionName:_SUID:_This is a closed bookexamination. Please placeall yourbookson the floor besideyou.Youmaykeeponepageofnotesonyourdesktopinadditiontothis exampackage. A
Syracuse - CSE - 687
CSE687 Object Oriented DesignMidTerm #3Spring 2003Midterm #3 Instructor's SolutionName:_ SUID:_This is a closed book examination. Please place all your books on the floor beside you. You may keep one page of notes on your
Syracuse - CSE - 687
CSE687ObjectOrientedDesignSpring2003MidtermMakeupProvidesolutionstoeveryproblemontheexamyoucompletedthissemester.Youhaveseen mysolutions,andmayusethemasaguide,butIamexpectingyoutorestatethesolutionsor providenewsolutionsusingyourownwordsandideas
Syracuse - CSE - 687
// MT1Q8andMT4Q6.cpp#include &lt;string&gt;#include &lt;iostream&gt;#include &lt;sstream&gt;class B { public: B(std:string s) : s_(s) {} std:string&amp; str() { return s_; } /* . */ private: std:string s_; };class D : public B { public: D() : B(&quot;)
Syracuse - CSE - 687
// MT1Q3.cpp#include &lt;string&gt;#include &lt;iostream&gt;#include &lt;sstream&gt;class B{ public: virtual ~B() {} virtual const char* say() { return &quot;B instance&quot;; } };class D : public B{ virtual const char* say() { return &quot;D instance&quot;; }};B*
Syracuse - CSE - 687
// MT3Q2.cpp#include &lt;list&gt;#include &lt;iostream&gt;#include &lt;iomanip&gt;#include &lt;math.h&gt;#include &lt;time.h&gt;template &lt;typename T&gt;class RunningInterval{public: RunningInterval(size_t n) : interval(n) {} void addDataPoint(const T&amp; t); T avg() c
Syracuse - CSE - 687
// MT3Q3.cpp#include &lt;string&gt;#include &lt;iostream&gt;#include &lt;sstream&gt;class B{ public: virtual ~B() {} virtual void say() { std:cout &lt; &quot;\n B instance&quot;; } };class D : public B{ virtual void say() { std:cout &lt; &quot;\n D instance&quot;; }};B
Syracuse - CSE - 687
// MT4Q9.cpp#include &lt;iostream&gt;class B{public: virtual ~B() {} virtual void say() { std:cout &lt; &quot;\n I am a &quot; &lt; typeid(*this).name() &lt; &quot; instance&quot;; }};class D : public B{};B* Creator() { return new D; }void main(){ B* pB
Syracuse - CSE - 687
// MT1Q2.cpp#include &lt;list&gt;#include &lt;iostream&gt;#include &lt;iomanip&gt;#include &lt;math.h&gt;#include &lt;time.h&gt;template &lt;typename T&gt;class RunningInterval{public: RunningInterval(size_t n) : interval(n) {} void addDataPoint(const T&amp; t); T span();
Syracuse - CSE - 687
* can't open MT1Q9.cpp *
Syracuse - CSE - 382
CSE382 Makeup Examination, Fall 2008Name:Instructions:If I suggested to you, at the end of your oral examination, to do a makeup examination, then you may not pass this course unless you do a good job with this makeup examination. Please complet
Syracuse - CSE - 775
Automation and IDispatchJim Fawcett CSE775 Distributed Objects Spring 2004AutomationAn automation server is a COM object that exposes methods and properties through the IDispatch interface. IDispatch is a &quot;generic&quot; interface Used by scrip
Syracuse - CSE - 775
IntroductiontoCOMCSE775DistributedObjects,Spring2006 JimFawcettcopyright19982009Introduction to COMPage 1RoadmapWhatstheproblem? tightcouplingbetweenmanycomponentsinlargesystemsmakes debugging,integration,andmaintenanceverydifficult bui
Syracuse - CSE - 775
WhyCOMand.Net?JimFawcett CSE775DistributedObjects Spring2005COMversus.NetCOMStrengths Itseverywhere: Windowsoperatingsystem GUIcontrols Word,Excel,Visio COMmakesthese programmable! .NetCLRisaCOMcomponent.NetStrengths Frameworkandlan
Syracuse - CSE - 775
.NetRemotingJimFawcett CSE775DistributedObjects Spring2004ReferencesProgrammingMicrosoft.Net,JeffProsise,MicrosoftPress, 2002,Chap15. Excellent,cleardiscussionofbasicremotingMicrosoft.NetRemoting,McLean,Naftel,Williams,Microsoft Press,2003
Syracuse - CSE - 775
PassbyReferenceFileTransferJim Fawcett CSE775 Distributed Objects Spring 2003Adapted from notes for CSE681- SWMaADesignApproachesOf the three Remoting Activation models: SingleCall Singleton Client Activated SingleCall with Pass-By-R
Syracuse - CSE - 775
The CreateFile FunctionMario Tayah and Jim FawcettCSE775 Distributed Objects Spring 2007 DefinitionThe CreateFile function creates or opens anything that can be used as a source of data including: file file stream Directory p
Syracuse - CSE - 775
C# Programming Language OverviewJim Fawcett CSE775 Distributed Objects Spring 2005C# LanguageLooks a lot like Java. A strong analogy between:Java Virtual Machine &amp; .Net CLR Java bytecodes &amp; .Net Intermediate Language Java packages &amp;
Syracuse - CSE - 775
Introduction to CMark Sapossnek CS 594 Computer Science Department Metropolitan College Boston University#Table of Contentsadded by Jim Fawcett Types Overview Predefined Types User-defined Types Program Structure Statements Opera
Syracuse - CSE - 775
Advanced CMark Sapossnek#CS 594 Computer Science Department Metropolitan College Boston UniversityTable of Contentsadded by Jim Fawcett Interfaces Classes and Structs Delegates Events Attributes Preprocessor Directives
Syracuse - CSE - 775
Testing Handling of Function ArgumentsDemonstrates that: value types pass by value. reference types pass by ref strings are immutable StringBuilders are mutableDemonstrates that: value types can be passed by ref. ref qualifier does not change ref
Syracuse - CSE - 775
IDL Syntax[attribute, .] statement name [:BaseInterfaceName] { [attribute, .] statementBlock; };attribute1. Endpoint specifies a &quot;well-known&quot; port on which servers of the interface listen 2. Helpstring human readable comment string, e.g., helpstr
Syracuse - CSE - 775
CSE791 Distributed ObjectsSpring 2002M idte rm AName:_ SSN:_This is a closed book examination. Please place all your books on the floor beside you. You may keep one page of notes on your desktop in addition to this exam package. All examinat
Syracuse - CSE - 775
CSE791 Distributed ObjectsSpring 2002Project #4 Appointment Control due Monday, 29 AprilPurpose: The purpose of this project is to build a control and an application to host the control that manages a day's appointments. You may impleme
Syracuse - CSE - 775
CSE775 Distributed Objects Students Note concerning a web service example used in class:The fileXfer web service using a Passbyvalue writeback object works only on localhost. Passbyvalue objects do not work correctly with web services. www.go
Syracuse - CSE - 775
Remoting PassByValue Demo : Client uses Interface
Syracuse - CSE - 775
C:/su/cse775/code/tryATLDeveloping tryATL ProjectPurpose:Demonstrates how to build inproc component and client, using services of the Active Template Library (ATL). 2. Uses ATL for both component and client. 3. Shows that each client will get a
Syracuse - CSE - 775
Handouts/cse775/code/Remoting_PassByValuePassByValueRemotingDemoPurpose:Illustratesuseof(transparent)objectserializationfromClientto ServerandbacktoClient. 1. Clientcreateschannel 2. Clientcreatesobjecttobepassedbyvalue 3. Servercreateschannel 4.
Syracuse - CSE - 775
CSE775DistributedObjectsSpring2006Project#4cControlsRefinementsPurpose:dueMonday,May01ThisprojectrequiresyoutouseComponenttechnologytobuildarefinedversionofyourProject#3,oryoumaycollaborate withapartner1whoisbuildingaRepositoryorSniffers.Y
Syracuse - CSE - 775
.NET Framework 3.0 XAML Browser Application Readme-XAML Browser Applications run in a sandbox with &quot;Internet Permissions&quot;.Only those .NET Framework 3.0 features that have been successfully security reviewed and validated as safe by the .NET Framew
Syracuse - CSE - 775
// demoIndexers.cs - Indexers work this way// Jim Fawcett, CSE775 - Distributed Objects, Spring 2003/using System;namespace demoIndexers{ class demoIndexers { private bool _ardvvark = false; private bool _falcon = true; p
Syracuse - CSE - 775
// demoProps.cs - Properties work this way// Jim Fawcett, CSE775 - Distributed Objects, Spring 2003/using System;namespace Properties{ class demoProps { public string name { get { return _name; } set { _name = value;