New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here


by: Vito Kilback

ComputationLaboratoryIII CS123

Marketplace > Drexel University > ComputerScienence > CS123 > ComputationLaboratoryIII
Vito Kilback
GPA 3.88


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in ComputerScienence

This 41 page Class Notes was uploaded by Vito Kilback on Wednesday September 23, 2015. The Class Notes belongs to CS123 at Drexel University taught by Staff in Fall. Since its upload, it has received 46 views. For similar materials see /class/212456/cs123-drexel-university in ComputerScienence at Drexel University.

Similar to CS123 at Drexel

Popular in ComputerScienence


Reviews for ComputationLaboratoryIII


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/23/15
CS 123 Computational Lab Ill Spring 2008 Department of Computer Science Drexel University Copyright by the authors Permission is given for students and staff of CS 123 Spring 2008 to reproduce these notes fortheir own use CS 123 Policies 2 4 6 8 Labs 4 11 44 3 5 7 9 Quizzes 4 5 20 10 Exam 1 36 36 Unexcused missed quizzes labs or exams will be given a grade of 0 Course grades will be one of A B C D or F Lab Policy Please note that you should attend your regular lab section in case of serious problems you can make up the lab in other sections by your and that section s instructor permit IF YOU DO NOT ATTEND A LAB AND JUST SUBMIT IT VIA BB YOU SHOULD CONTACT YOUR INSTRUCTOR ONLY IN EXCUSED PROBLEM CASES YOU WILL RECEIVE A FULL GRADE Useful Links 1 Course web Site httigswww csdrexeleducs1 23s9rin92008 2 Maple TA see Course Web site for link it s not the same as last term because we are using a newer version of MapleTA Quiz 1 will be up on this page when it Is released at the end of this week 3 Sb Vista same as always httQlearningdrexeledu Calendar Activity Due Date Lab 1 Week2 Start Apr 07 Weeks Apr 18 500 PM Quiz 1 Start Apr 13 Week 3 Apr 18 500 PM So What is today s Lab about Integration in Maple and how to implement Integrating procedures Goals 7 Expiore Mapie s raciiities ror computing inderinite and derinite integrais eveiop some understanding or now a computer can integrate LET39S STAIIT WITH MATH DEFINITIONS Definite integration j fz its is Equai to tne area or e X e eing subtracted Indefinite integration De nitinn r39 4 We use the nntation to indicate that Fis an inde nite integral of l Using this notation we have Fm I x dx Bantamx fx Fundamental Theorem of Calculus FTC Theorem Let f be a function which i5 continuous on the interval a 1Let F be an inde nite integral or antiderivative off Then t j t th dx Ftbt Na 2 The function i5 an inde nite integral or antiderivative of f That i5 A39txl fix USAGEI Look at Example 1 Look at Example 2 Integration in Maple intquot The Maple int command will handle most integrals that can be done analytically Both definite and indefinite integrals can be done Example gt intgtltquot2gtlt 9 13 xquot3 gt intgtltquot2gtlt02 9 83 gt intsin4gtltgtlt 9 14 cos4gtlt When Maple can39t do an integral it simply returns it unevaluated use EVALF f deinite integration gt intcosgtltquot3gtlt01 gt evalfintcosgtltquot3gtlt01 0831776766 Maple Commands to verify integration Expand The expand command is useful for expanding various mathematical expressions expandexpr expr1 expr2 exprn gt d 1 2 expan X X x23x2 Simplify The simplify command is in some ways the opposite of the expand command simplifyexpr simplifyexpr n1 n2 simplifyexprassumeprop gt simplify4quot1l23 5 gt simplifyxquotaquotb4quot1l2 power x b 2 Simplification at work 7 gt z dx 5 gt intsqrt2x 2 xx J27 arctanh 7 W gt diffysx is this what we started with me says it shnuld he x Zx 39 7 7 32 7 2 V 2 2 z 2 1 27 gt simplifym 27 r v v i Testing equality with simplify It still isn t easy to always get the simpli er to put an expression in exactly the same form that you want To test equality of expressions try to simplify their difference lfit s zero it means that they are equivalent through some combination of expansions arithmetic trig and power laws etc Simplification and equality L 2 Prublem4e Anion 7829 Shaw lulianh x1 ZZZ 5 HM ii fully gt dexpr difflnlanhxx V l tanhlxi dame tam 913 gt diary 7 sathx 2tanhx Shuw that it s equal 11y mating that the difference shnpli es m Zeru 0 914 Normal is a simplifier that works only with numerators and denominators r new 11 dx7 2 7 3x7 4 Hint Th5 k Seethe gt int5 x10XA2339X4 x Zlnlxi4l31nlxll 45 7 gt theianswer diffx 7 z 3 theianxwer 7 X74 X 46 gt numehehegnswer 5 x72 xi4xll 4397 gt nnrmal theianswel expanded 5x7 In 43 gt3 7 3x7 4 Fgt Normal can be cheaper than simplify because it is more limited than simplify which is more kitchen sink It can also be more effective because of the limitations such as its expanded options that works specifically on expanding numerators and denominators without changing anything else Piecewise continuous functions How to define some function like II J if39IZO 1 r ifIlt0 Ifelse doesn t work gt use piecewise condition trueexpression othenvise expression gt fexpr piecewise xgt0 x 1x Now solve diff plotint as before just like other expressions gtdexpr difffexprx Parametric curves and arc length What was arc length s r e How to find in maplel Include new package StudentCalcuus1Arcengthx expression y expression parameter ab Example gtStudentCalculuslArcLength215209x041xquot2x046 6 651 554955 Lab structure This lab is divided into the following sections Required Reading Introduction amp Overview Tutorials 14 WrapUp Required Problems Problems 14 Optional Problems Problems 5 amp 6 Work in groups as always Wrap up What to turn in Lab 19 Due Apr 18th 5 PM Quiz 1 9 Due Apr 18th 5 PM Submit your lab via Bb Vista We have office hours in UC145 next week if you had any problem in Quiz 1 feel free to stop by and ask questions Office hours schedule UC 145 during nonclass weeks all day from 9 am to 5 pm plus occasionally oter hours in later in the day Othertimes you can post questions on Bb discussion area Email your instructors in case of grading questions issues or problems Any questions Good luck CS 123 Computational Lab Spring 2008 Department of Computer Science Drexel University Coperight b the authors Permission is given for students and staff of S 123 pring 2008 to reproduce these notes for their own use Calendar Activity Due Date Lab 1 Week 2 Week 3 Quiz 1 39V39Veek 3 t w Xvi I i Lab 4 Week 8 Week 9 Quiz 4 Week 9 I Pro ciency Exam ON WEEK 10 The Exam policy is exactly like the previous term We will have about 20 questions of different labs and different difficulty levels and about 90 minutes We will have how did I do button The exam will be during the last week of classes week 10 IN UC 145 YOUR NORMAL CLASS AND YOU SHOULD ATTEND YOUR OWN SECTION In case of MAKE UP you should contact your instructor before the exams only in certain cases we will accept make ups I Important Note about Today s Lab 1You are required to work in a group 2You don39t get credit for the lab until you show a TA or instructor your results from the end of the lab You can do this at the end of the lab period or by dropping into the Cyber Learning Center next week If you do not get quotchecked inquot by a staff member then you will receive no credit for this lab even if you attended a Lab session 139 So What is today s Lab about Learn what an Application Programming Interface API is Use an API to control movements in a simulator for autonomous driving Practice Maple programming involving if then elses for loops and while loops to handle autonomous driving situations Load CarSimulator package explicitly The CarSim ulator API CarSimulator package I At the beginning of each session or after a restart read CarSimulatorm withpottoos withpots withCarSimulator Iibname Iibname Package contains a number of procedures and variables to control a car This boilerplate is presented at the beginning ofthe worksheet It is always the same A simulator for autonomous d rivi n After you load the simulator package here s how you use it 1 initialize do setBackGround steps to establish walls targets set initial position of car The commands are usually presented as hit enter once to do it all Iquot programName proc end enter the control program for the car This is the part you have to supply 3 runprogramName You do this after you de ne the procedure 4 carMoviestateTable You do this after you run the procedure Protections built into the simulator There is a variable maxMoves initially set to 40 The simulator will automatically stop if you try to run a simulation beyond 40 moves You can get complaints about exceeding 40 moves if you forget to initialize again before you rerun a program You can assign maxMoves to a larger value if you need more than 40 moves to get the work done Some key operations in the CarSimuIator package move1 moves the car forward one step turnangle turns the car in place without moving fonNard from present angle turnPi2 turn left 90 degrees turnPi turn around turn Pi2 turn right 90 degress l stateTable stateTable after you run a simulation this table contains a list of all the moves ofthe car stateTable0 is a list describing the first position ofthe car x coord y coord angle state 0 0 Pi2 CARNORMAL means car is at 00 facing northwards in a normal state 5 4 0 CARBUMPED means car is at 54 facing eastwards and has just bumped into a wall 102Pi CARFINAL means the car is at 102 facing westwards and has reached a ET square colored blue stateTable1 shows the state of the car after one move stateTable2 after two moves etc carMoviestateTable The simulation sets up stateTabIe for you you never have to do any programming to change it yourself carMoviestateTable creates an animation from the stateTabIe I Let s look at one example I we want you to write a program that will cause the car to move forward 3 steps Problem 1 gt initialize gt setBackground00l0Z030 MARKING more initialization mark the path to he travelled so that the student can see that they ve covered the expected squares establishaoundaries2020 draw a 20 x 20 sandbox for the car to roam around in Coordinates range from 00 to 2020 drawBaokground Create a plot of the wall and the target for later use but don t display it carMoviestateTable Show initial configuration HfMUM ll1M v 11 x39IIl HhU u H mmwmmwwl39 Eml H mmm39 2 rea quotrunsimpleMoveMoviemquot runsimpleMoveMovie Click on the movie and play it 1 So how can we code the Procedure to make that animation runSimpleMove proc Put your programming here move1 move1 move1 end39 9 All we need to do is to move 3 times Mmmm how about calling move1 checkthe help references NOW let s TURN run2a proc move east 3 times move1 move1 move1 turnPi2 turn north move1 move north fourtimes move1 move1 move1 turn iturn around move1 move1 turnPi2 face to the eastright again move1 The carturns gold because it facing and touching a target end How about automating the moves Loops Question Simulate this animation Key idea i WRITE SOME LOOPS gtfor i from 1 to 5 do move1 vaan end do gtturnPi2 TurnAbsolute and Nested Loops Some more Cases I Question Animate this configuration 9 Key Idea 1For complete turn 39 turnAbsqutePi face west 2Use nested loops for for Move1 turnPi2 Using parameters a steps right b steps up lgtle139e s n demo program ImI moves folward u steps and hen turns le and moves folwnrd number I slaps run a proc aposin pcsint move a steps forward make a 90 degree turn to the left and then b steps fomar coal 1 for i from 1 to a do move1 and do turnP 12 for i from 1 to b do movel end do an gt runrun3345 move 4 steps forward turn then move 5 steps forward gt Bumping Touching We have a Procedure isTouchingdirection 39barrierType39 Checks if we reached a barrier or not 9 return value i True touching False not touching Note barrierType is BARRIER or TARGET I Shuttle QAssume you want to write a procedure that given this configuration the car moves once and come back between the two walls barriers dea while getCURRENTLOCATION4 ltgt CARBUMPED do move1 end do turnPi You can use a while loop to test for whetherthe car is touching the wall gtlf it is then move forward 1 gtOtherwise leave the while loop and proceed into the actions thatturn the car and move it forward to the target gtrun5b proc gt while Nowturn right now move until you hit the target gt while gtend Finding a gap and going through it I Detecting things at a distance The car in the simulator can also use quotradarquot to look to the front and to the side to see if there39s something within a certain range gtscanDistance gives us info about space gtexample gtif scanDistancecl1c2angeRad d ltgt NULL then V get report gtprintScanDistanceReportd O I General advice I To create a car control program look at the situation and the demo if provided Have your group create a plan You can pseudo codequot the plan into the program as comments run3a procaposint Move forward 1 step Turn left Move fonNard a steps end Then ll in the comments with actual control 1statements The important thing is to have a plan Irst More general advice Put print or printf statements into your program to see what it is doing tracerun3a traceisTouching etc will also print out information To turn off tracing do untracerun3a I Some technical notes about the lab Because the lab has a lot of animations the file is very large This means autosaving will take a While Soto avoid problems it may be helpful to increase your autosave interval Also to make the file smaller it will significantly speed up your save time if you delete any tutorial animations after you viewthem You can always regenerate them later if you need them by hitting enter on the command that created the animation Finally the helpfiles may have trouble loading on the Macs in the lab lfthat is the case there are PDF versions ofthe help files in the zip folder with the lab Please referto those if the help files don t load properly on the Macs Lab structure This lab is divided into the following sections Required Reading Introduction amp Overview Tutorials 15 WrapUp Required Problems Problems 15 Optional Problems Problems 67 Work in groups as always I Do not forget to CHECK IN I Maple talk Thursday May 29 Location Bossone Auditorium Time 10am11am Date Thursday May 29 Speaker Robert Lopez Professor Emeritus RoseHulman Institute Clickable Math in Maple with Engineering Overtones Why you should go to this talk To learn about Maple s use in more advanced engineering work Because you will get credit equivalent to half a quiz for attending the entire lecture Bring your Drexel ID attendence will be taken I Talk abstract Clickable Math in Maple with Engineering Overtones The easeof use features in Maple coalesce into a syntaxfree paradigm for implementing calculations via a pointandclick approach The robustness ofthis paradigm will be illustrated by examples taken from the math courses taught to science engineering and math students in the college undergraduate curriculum Several distinctly engineering examples will also be included to show the utility of Maple as a tool outside the math classroom Can t make the lecture The lecture will be video taped There will be a replay of the lecture Bossone Auditorium Friday May 30 1030am Send email to your instructor if you wish to attend the alternative time 5quot What to turn in Lab 4Quiz4 DO NOT FORGET PROFICIENCY EXAM ON WEEK 10 Submit your lab via Bb Vista We have office hours in UC147 next week if you have any problems on Quiz 4 or the lab feel free to stop by and ask questions Good Luck


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Anthony Lee UC Santa Barbara

"I bought an awesome study guide, which helped me get an A in my Math 34B class this quarter!"

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.