Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 121 Engineering Computation Lab Lab 4 Department of Computer Science Drexel University February 16-20, 2008 ©By the author. All rights reserved. Permission.

Similar presentations


Presentation on theme: "CS 121 Engineering Computation Lab Lab 4 Department of Computer Science Drexel University February 16-20, 2008 ©By the author. All rights reserved. Permission."— Presentation transcript:

1 CS 121 Engineering Computation Lab Lab 4 Department of Computer Science Drexel University February 16-20, 2008 ©By the author. All rights reserved. Permission is given to CS121 Fall 2008 staff and students to use and reproduce these notes for their own use.

2 Your class instructor and TA Instructor for this section: Tim Cheeseman Office: UC 147 (CLC) Email: twc24@drexel.edu Your TAs are: Cem Sahin, Lloyd Ricks – 061 Pat Lockner - 561 Note that verification sheet requires you to put down instructor’s name.

3 Week 5 and 6 retrospective Lab 3: fifth week Scripts User Defined functions Seq, Lists, Sets Quiz 3: sixth week Getting stuck on problems during the quizzes? –Use the Cyber Learning Center (UC147)‏ –Use the discussion board for short questions

4 Lab 4 Part 1 Multiplotting – Problem 1.1 Part 2 Import Data – Problem 2.1 Part 3 Piece wise functions – Problem 2.2 Part 4 Maps – Problem 2.3

5 Multiplotting Basically means plotting more than one graph in a plot Consider 2 functions – x^2,x^3 Chapter 6 – Section 6.3 Syntax – plot(set of expr,var=range, color=list of colors) How do we plot it for the above 2 functions plot({x^2,x^3},x=0..10} The functions in plot can also be user defined functions. Part 1.1 of the lab requires this.

6 Multiplotting (cont) Coloring Multi plots Automatically colors are chosen. How to plot with specified Color ? We do this by changing the parameter of Plot Plot({f(n),g(n)},x=0..100,color=[“red”, “green”, “blue”])

7 Demo of Multiplotting Plot for x^2 and x^3, using plot({x^2,x^3},x=0..10)

8 Demo of Import Data (Text) Instructors can use the following slides optionally. grades := ImportMatrix(‘GradeData1.csv’,source=csv) gradeList := convert(grades,list) OR ImportData()

9 Demo of Import Data (Click) Instructors can use the following slides optionally.

10 Demo of Import Data (cont’d)‏

11

12 Right Click on the Blue Matrix. Click Assign to a name. The name used here is ‘thelist’ Convert the matrix to a list using Mainlist := convert(thelist,list)‏ Perform the required operations on the Mainlist

13 Part 3 : Piecewise Function What is Piecewise Function? –It is a function whose definition is dependent on the value of the independent variable.

14 Part 3 : Piecewise Function Piecewise functions are defined using the common functional notation, where the body of the function is an array of functions and associated sub domains.

15 Part 3 : Piecewise Function Maple Notation for a piecewise function Use the curly braces from Expressions Use Ctrl + Shift + R to add new row to the function

16 Part 3 : Piecewise Function Demo of Piecewise Function –Show demo for absolute value

17 Part 4 : Maps A function that associates a single output to each input element drawn from a fixed set such as the real numbers In our case the fixed set is a List – Problem 2.2 and Problem 2.3 Use map for element-wise application of a function

18 Syntax map(function or function name, structure) Part 4 : Maps

19 Example i)L:=[52,53,54] f:=(b,x)->sin(x*Pi/b) map(f,L,2) ii)map(binomial,L,6) Part 4 : Maps

20 Part 4 : Maps + Piecewise Function Demo - Piecewise function for Pass or Fail

21 Part 4 : Maps + Piecewise Function Demo - Map it with a list of marks

22 Finishing up – save your work Save worksheets onto the Desktop. You can call them Lab4Part1, Lab3Part4, etc. Or you could put all the work into one worksheet and just call it Lab 4. Submit a copy to Blackboard site as evidence that you did the lab. Email a copy to yourself and/or your lab partners as an attachment so you can look at what you did for review purposes later.

23 Turn in your verification sheet Make sure your name/user id/section number/ date,time/instructor name are on the verification sheet. Get the verification sheet signed for all parts you completed and hand it in.

24 Weeks 7 and 8 Take Quiz 4 Monday-Friday Week 8 –February 20-27 –Maple TA server down for maintenance 9- 10am and briefly at 3pm each day during the week. –All the best


Download ppt "CS 121 Engineering Computation Lab Lab 4 Department of Computer Science Drexel University February 16-20, 2008 ©By the author. All rights reserved. Permission."

Similar presentations


Ads by Google