Docsity

CS 121 Engineering Computation Lab: Nested Structures, Point Plot, and Models - Prof. Timo, Lab Reports of Computer Science

Toggle sidebar
bg1
3/2/09
1
CS 121 Engineering Computation Lab
Lab 5
Department of Computer Science
Drexel University
March 2-6, 2009
©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.
Your class instructor and TA
• Instructor for this section: Tim Cheeseman
Office: UC 147 (CLC)
• Your TAs are:
061 – Cem, Lloyd
561 – Pat
Note that verification sheet requires you to put
down instructor’s name.
Outline
• Overview of lab
• Wrapup:
– Details of End of term Proficiency Exam
Week 7 and 8 retrospective
• Lab 4: Seventh week
• Multiplotting
• Import Data
• Piecewise functions
• Map
• Quiz 4: Eighth week
• Getting stuck on problems during the quizzes?
– Use the Cyber Learning Center (UC147)!
– Use the discussion board for short questions
Lab 5
• Part 1 Nested Structures
• Part 2 Point Plot
• Part 3 Models
Nested Structures – List of Lists
• Prelab Reading – Chapter 6 – Section 6.2 (Lab 4)
• A list, set or sequence can have items that can be any
type of Maple entity.
• The items do not have to be all numbers.
• Lists, sets and sequences can also be items of a list, set
or sequence.
pf3
pf4
pf5

Partial preview of the text

Download CS 121 Engineering Computation Lab: Nested Structures, Point Plot, and Models - Prof. Timo and more Lab Reports Computer Science in PDF only on Docsity!

CS 121 Engineering Computation Lab

Lab 5

Department of Computer Science Drexel University March 2-6, 2009 ©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.

Your class instructor and TA

  • Instructor for this section: Tim Cheeseman Office: UC 147 (CLC) Email: [email protected]
  • Your TAs are: 061 – Cem, Lloyd 561 – Pat Note that verification sheet requires you to put down instructor’s name.

Outline

  • Overview of lab
  • Wrapup:
    • Details of End of term Proficiency Exam

Week 7 and 8 retrospective

  • Lab 4: Seventh week
    • Multiplotting
    • Import Data
    • Piecewise functions
    • Map
  • Quiz 4: Eighth week
  • Getting stuck on problems during the quizzes?
    • Use the Cyber Learning Center (UC147)
    • Use the discussion board for short questions

Lab 5

  • Part 1 Nested Structures
  • Part 2 Point Plot
  • Part 3 Models

Nested Structures – List of Lists

  • Prelab Reading – Chapter 6 – Section 6.2 (Lab 4)
  • A list, set or sequence can have items that can be any type of Maple entity.
  • The items do not have to be all numbers.
  • Lists, sets and sequences can also be items of a list, set or sequence.

Nested Structures – List of Lists

Example :

  1. L1:=[[1,100],[2,99],[3,98],[4,82]] L1[1] would be [1,100] L1[1][2] would be 100
  2. L2:=[seq([i,i],i=1..5)] [[1,1],[2,2],[3,3],[4,4],[5,5]]

Point Plot

  • Prelab Reading – Chapter 6 – Section 6.4 (Lab 4)
  • Plot individual points in a two dimensional plot.
  • Plotting points by using pointplot in the plots package
    • Loading directive with(plots)
    • plots[pointplot] function
  • The argument is a list of lists (Part 1)
  • Each element of the list is a coordinate
  • The coordinates of the point are entered as a list of values:[xvalue, yvalue]

Demo Plotting with Points

p lots[pointplot]([[1, 2]], color = "red", symbol = "diamond", symbolsize = 36, thickness = 5)

Demo Plotting with Points

  • plots[pointplot]([[1, 2], [1, 3], [2, 3], [2, 3]], symbol = "cross", symbolsize = 25, thickness = 5)

Demo Plotting with Points

plots[pointplot]([seq([ i,evalf(log(i)) ],i=1..100)],color=“Indigo”);

Demo Plotting with Points

Vertical Flip of Last Graph

plots[pointplot]([seq([ 100-i,evalf(log(i)) ],i=1..100)],color=“Indigo”);

Models

We have a formula for the viewing angle (it was in a quiz problem, and is in the lab directions), but we want to understand how the angle changes as we move back in rows. Clearly the viewing angle is also affected by the height of the base and the height of the screen. We want to understand how all three of these affect things. We can look at some different situations by changing values of the parameters and rerunning our explanatory calculations to see what happens.

Demo Model

  • The Viewing angle from a seat that is x feet away from the screen in given by the formula
  • Define a function V(x,bv,hv) which describes the viewing angle
  • Test the function
    • V(8,4,5)
    • HomeAngle:=evalf(V(8,4,5))
  • Use the seq function to create a list to represent the distance of different rows from the screen [5,8,11,…,92]
  • seatList:=[seq(5+(i-1)*3,i=1..30)]
  • Map the V function to the list to calculate the viewing angles of different rows
  • Map(V,seatList,5,20)
  • Compute the limited-precision value of the viewing angle for each element in the list
  • seatAngles:=evalf(%)

Modeling angles for different

rows

Visualizing seat angle as a

function of distance x in rows

  • Plot the seatAngles values in a point plot.

Fancier plotting

  • Combine that plot with the plot of the continuous function.
  • pcont:=plot(V(x,5,20),x=5..90)
  • pcont

Home Theatre VS Movie Rows

  • Superimpose the horizontal line y= homeAngle to get an easy graphical comparison of the viewing angles at the home theatre and the movies - pconst:=plot(homeAngle,x=5..90,color=green) - plotsdisplay

Is the theater competitive with

what you can get at home?

  • Design a piecewise function that counts home many rows provide a viewing angle that is at least as good as "homeAngle", and prove that it works. This function tells us how many rows we can actually put into the theater where every row is competitive with the home theater viewing angle. - Build a filter function that counts row if they are good as homeAngle - Map the filter function onto the list of viewingAngles, to get a list of zeroes and ones. - Sum the list of zeroes of ones to get the total count

How many rows are as good as

a home theater?

Finishing up – save your work

  • Save worksheets onto the Desktop. You can call them Lab5Part1, Lab5Part2, etc. Or you could put all the work into one worksheet and just call it Lab 5.
  • 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.

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.

Weeks 9 and 10

  • Take Quiz 5
  • Friday March 6 (Week 9) – Friday, March 13 (Week 10)
  • Maple TA server down for maintenance 9-10am and briefly at 3pm each day during the week

Week 11 – Proficiency Exam

  • In class exam, during regular class hour
  • The exam counts for approximately 36% of your final grade

Final Exam Policy

  • If you have a conflict or are unable to attend the scheduled exam due to a reasonable medical or personal excuse, you should contact your section instructor and arrange an alternative time as soon as possible.
  • If you miss your exam and delay contacting your instructor until after the proficiency exam week has passed, our policy will be to give you a zero for the exam.

See you next term in CS 122