Part 1 Your First Function
|
|
- Laurence Moses McKinney
- 5 years ago
- Views:
Transcription
1 California State University, Sacramento College of Engineering and Computer Science and Snarky Professors Computer Science 10517: Super Mega Crazy Accelerated Intro to Programming Logic Spring 2016 Activity I Functions Functions are a key part to any programming language. They differ from modules (as the textbook calls them) in that they can return a value. You have used this quite a bit during your time as a student. You should recall the Sin(x) and Cos(x) functions from trigonometry, the int(x) function from basic math, and sqrt(x) for those times you can't draw that funky square root line. Programming languages often let you create your own. And, in this lab, that is exactly what you are going to do! Part 1 Your First Function In many programming languages the term "module" and "function" are one and the same. The only difference is that a function returns something while a module does not. NOTE: Redundant Terminology Programming languages often use different terms to describe the same concept. In the C Family (which includes Java), modules and functions are synonymous. Pascal calls a module a "procedure". Visual Basic calls it a "sub" (for subroutine). Whatever you call it. programming languages let you create your own functions. They are defined pretty much the same way you create a module. To get started with functions, let's create a function that adds two numbers together and returns the result. 1. Start by selecting "Add a Function" from the Program Menu or clicking on the add icon on the main toolbar. 2. A new window will open. In the Function Name field, enter Sum. 3. Add two parameters to your function. Call them num1 and num2. Make both of them Integer. They will represent the two numbers the caller will pass in. 4. For the "Return Type", select "Integer". The "Return Variable" box is now enabled. 5. Enter the variable name result. This will be a variable that you have to declare inside your function. Don't use the same name as the function. Flowgorithm will throw a temper tantrum if you do.
2 2 NOTE: Returning Values in Flowgorithm Many programming languages can return the result of an expression. This can be a single variable (which is a very simple expression) or something far more complex. Flowgorithm just lets you return the contents of a variable. 6. Click OK 7. You should see a blank flowchart now with the word sum in the top bubble. Make it look like flowchart below. Notice that we declare an integer called result. This is the variable we will return to the caller. 8. Go back to your main function (click on the dropdown box on the toolbar) 9. Add an output shape. 10. In this output shape, type Sum(2, 2). 11. Execute your flowchart This makes it far more versatile than our earlier module which always just printed the sum. Excellent! Your flowchart uses a function to add two numbers and return the sum. However, this really isn't that useful. It's a useful start, but not still useful. So, let's work on something a bit more impressive!
3 3 Part 2 Composition One of the great benefits of functions is the ability to use the output of one function as the input to another. In great languages, like Java, you can create sophisticated mathematical expressions that make use of operators such as: +, -, *, / In reality, these are functions, but they're in a nice easy-to-read format. So, for example, anytime you use the result of a multiplication, and add it to another number, you are using the output of one function as input into another. Let's try that out using your excellent sum function. 1. Double-click on output shape in your main module. 2. Change the expression to: Sum(2, Sum(2, 2)) Look at it really closely. Look at the first Sum in the expression. The first argument is the value 2. That's easy to understand. However, look at the second argument. That argument is the result of calling Sum with 2 and 2. What's the result? 3. Execute your flowchart. Did it output what you expected? Very cool! Let's see if we can get different values. 4. Add a new output shape 5. Double-click on it. 6. Figure out an expression that will print 10 to the screen. but ONLY uses combinations of 2 and calls to Sum. 7. Execute your flowchart. If you didn't get 10, double-check your expression. Let's save your wonderful expression for later (we don't want to lose all that hard work). 8. Create another function call it CompositionExample. 9. Go back to your main function 10. Cut your two output shapes. You should now have nothing in your main module. 11. Paste the output shapes into the function you just created.
4 4 Part 3 Geometry Let's take a look at a sphere. If you forgot, the volume of a sphere can be computed with the following mathematical expression: Volume = 4 Diameter π 3 ( 2 ) 3 This equation uses Diameter/2 as a substitution for Radius. 1. Add a new function called spherevolume 2. Add a parameter for the diameter. Make it a real. 3. Calculate the volume of a sphere, and return that value. Recall that Flowgorithm has π built-in as a constant called pi. Ah, now that you have written such a nice function, it is time to check if it works correctly. Look at the following pseudocode (written in the book's format). Example Pseudocode Module main Declare Real d Input d Display spherevolume(d) End Module This program declares a real variable called d, inputs it, and then displays the result of the function. This is a great technique for testing if you got the expression correct. 4. You main function should be blank. Implement the pseudocode above. 5. Execute it your flowchart and test it with a few values. 6. Check your results with the table below Diameter Volume Did everything match up? If so. great work! It's time to move on. Otherwise, go back to your sphere function and double-check the expression.
5 Part 4 Flowcharts and the Chocolate Factory 5 You have a really cool job at a candy factory. The factory can make custom candies for anyone in the World. You work in the division that creates chocolate-covered caramels. The factory equipment can create chocolate-caramels of any size and does so regularly. They can be as small as a pea or as big as a house. The company s main problem is determining how much chocolate and caramel will be needed for a shipment. Fortunately, you can write a program that will solve this dilemma! Let's look at the type of candy you are creating: chocolate-covered caramels. Basically, these are spheres. However, there is a catch Both the caramel center and the candy itself are spheres, but what exactly is the volume of the chocolate shell? It's definitely not the volume of a sphere with the full diameter. The center doesn't take up delicious chocolate it is delicious caramel! You'll need to figure out how to compute the volume of the chocolate shell. Let's create a new function that will get us this value! 1. Add a new function 2. Give it a name it's up to you. 3. For parameters, you want to pass in the total diameter of the larger sphere and the diameter of the internal sphere. Wait a sec! Didn't you already create a function for a sphere? Use that in your new function! 4. Using your existing spherevolume function (you might call it twice), compute and return the volume of the shell. Now that you finished that. It's time to test it and make sure the values look correct! Testing is an important part of being a great computer programmer. 5. Modify your main program so you can type in 2 values the outside diameter and the inside diameter. The pseudocode is below. I called my function sphereshell; replace this with whatever your function name is. Example Pseudocode Module main Declare Real d Declare Real i Input d Input i Display sphereshell(d, i) End Module
6 6. Execute your flowchart. Check your results with the table below. 6 Outside Diameter Inside Diameter Volume Did you get the correct results? If not double check your logic, your parameters, your data types etc. Part 5 Computing a Shipment Now that you can compute the volume of the caramel center (using the volume of a sphere function) and the chocolate shell (using your new function), you can finally make a program that computes orders! You going to compute the caramel and chocolate needed for a large for a shipment of candy. To accomplish this, you need to compute the required chocolate and caramel and store those values into variables. Then, you can multiply those values by the total number of candies that will be produced. 1. Select all the shapes in your main function 2. Delete them (they were just for testing anyway) 3. Declare real variables that will store the amount of chocolate and caramel in a single candy. 4. Declare real variables that will store the total amount of chocolate and caramel for the order. 5. Declare a variable that represents the total number of candies to be produced. 6. Declare real variables for the two diameters the whole candy and the caramel center. 7. Input both diameters. Give them nice prompts. 8. Input the total number of candies with a nice prompt. 9. Call your two functions the volume of a sphere function and the volume of a shell function. Store the results. This will be for a single candy. 10. Compute the total amount of chocolate and caramel for the shipment. (hint: total chocolate = chocolate in one candy the number of candies) 11. Now, output the results with nice labels. 12. Execute and test your program!
7 7 Part 6 Running Total Currently, the program just reads in values and outputs the results for a single shipment. What if they want to handle multiple orders? We can use a do-while loop for this. After each shipment, you can ask the user if they need to enter another. You are going to need a few more variables and a loop. You will be moving most of your program inside the loop like in our previous lab. 1. Declare a string variable called again, more, or a something else (the name is up to you). Since we are going to compute an entire shipment, we need new variables to store the grand totals for the chocolate and caramel needed. These values will start at zero and increase for each order. 2. Declare these two variables. Give them good names. 3. Add a Do Loop to your flowchart below all of the declarations. 4. Select your existing shapes from the previous parts of the lab not the declarations. These should include the input, output and assignment shapes. 5. Cut them. 6. Paste them into the Do Loop. 7. Before the loop, initialize both of your new totals to zero. 8. Inside your loop, after the rest of the shapes, add the running total logic. This way, each time you compute the total chocolate and caramel needed for a shipment, they are added to the grand totals. 9. Okay, now we need to ask the user if they want another shipment. Input that string variable you declared earlier. Add a nice prompt. 10. Set up the Do Loop logic so it continues while: again == "y". (Of course, you might have named it something different) 11. Finally, print of the grand totals for the chocolate and caramel after the loop completes. Add some nice labels. Like before, go to the Tools Menu on Flowgorithm and select "Layout Windows" (you can also press Control+L). This time select "Variables & Console". EXPLORE: Variable Watch Window Flowgorithm can graphically show you the current value of your variables. This works anytime you are stepping through your program. Select the "Variable Watch Window" from the Tools menu. There is also an icon on the main toolbar. Different data types are displayed in different colors: integers are blue, reals are purple & strings are red. 12. Execute and test your program.
8 8 Part 7 Intrinsic Functions Many programming languages have built-in functions that designed to make it easy to write programs. These include the classic trigonometric functions such as Cos(), Sin(), and Tan(). They also often include ones designed to make the output look cleaner, work better with strings, and more! These intrinsic functions are different in easy programming language though there is considerable overlap. Flowgorithm has an intrinsic function that lets you control how many digits a real number will display after the decimal point. Normally, programming languages like to print all the digits they can which is nice, but not very esthetically appealing. Take, for example, how we write out monetary values. We always use 2 digits after the decimal point: $43.50 rather than $ Go to the Flowgorithm documentation and look at the list of intrinsic functions. 2. Find the one that displays a fixed number of digits. 3. Use it on your final output statements. Display the grand totals with 3 decimal digits. 4. Execute your flowchart.
Part 1 Arithmetic Operator Precedence
California State University, Sacramento College of Engineering and Computer Science Computer Science 10: Introduction to Programming Logic Activity C Expressions Computers were originally designed for
More informationPart 1 Simple Arithmetic
California State University, Sacramento College of Engineering and Computer Science Computer Science 10A: Accelerated Introduction to Programming Logic Activity B Variables, Assignments, and More Computers
More informationPart 1 - Your First algorithm
California State University, Sacramento College of Engineering and Computer Science Computer Science 10: Introduction to Programming Logic Spring 2016 Activity A Introduction to Flowgorithm Flowcharts
More informationCalifornia State University, Sacramento College of Engineering and Computer Science and Snarky Professors
California State University, Sacramento College of Engineering and Computer Science and Snarky Professors Computer Science 615517: Super Mega Crazy Accelerated Intro to Programming Logic Spring 2017 Activity
More informationPart 1 - Your First algorithm
California State University, Sacramento College of Engineering and Computer Science Computer Science 10A: Accelerated Introduction to Programming Logic Spring 2017 Activity A Introduction to Flowgorithm
More informationSkill 1: Multiplying Polynomials
CS103 Spring 2018 Mathematical Prerequisites Although CS103 is primarily a math class, this course does not require any higher math as a prerequisite. The most advanced level of mathematics you'll need
More information3.7. Vertex and tangent
3.7. Vertex and tangent Example 1. At the right we have drawn the graph of the cubic polynomial f(x) = x 2 (3 x). Notice how the structure of the graph matches the form of the algebraic expression. The
More informationAn Introduction to Maple This lab is adapted from a lab created by Bob Milnikel.
Some quick tips for getting started with Maple: An Introduction to Maple This lab is adapted from a lab created by Bob Milnikel. [Even before we start, take note of the distinction between Tet mode and
More informationFormal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5
Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5 [talking head] Formal Methods of Software Engineering means the use of mathematics as an aid to writing programs. Before we can
More informationLab 9: Creating a Reusable Class
Lab 9: Creating a Reusable Class Objective This will introduce the student to creating custom, reusable classes This will introduce the student to using the custom, reusable class This will reinforce programming
More informationSlide 1 Side Effects Duration: 00:00:53 Advance mode: Auto
Side Effects The 5 numeric operators don't modify their operands Consider this example: int sum = num1 + num2; num1 and num2 are unchanged after this The variable sum is changed This change is called a
More informationDirect Variations DIRECT AND INVERSE VARIATIONS 19. Name
DIRECT AND INVERSE VARIATIONS 19 Direct Variations Name Of the many relationships that two variables can have, one category is called a direct variation. Use the description and example of direct variation
More informationTroubleshooting Maple Worksheets: Common Problems
Troubleshooting Maple Worksheets: Common Problems So you've seen plenty of worksheets that work just fine, but that doesn't always help you much when your worksheet isn't doing what you want it to. This
More informationJohn's Tutorial on Everyday Mathcad (Version 9/2/09) Mathcad is not the specialist's ultimate mathematical simulator
John's Tutorial on Everyday Mathcad (Version 9/2/09) Mathcad isn't: Mathcad is not the specialist's ultimate mathematical simulator Applied mathematicians may prefer the power of Mathematica Complex programs
More informationChapter 2. Designing a Program. Input, Processing, and Output Fall 2016, CSUS. Chapter 2.1
Chapter 2 Input, Processing, and Output Fall 2016, CSUS Designing a Program Chapter 2.1 1 Algorithms They are the logic on how to do something how to compute the value of Pi how to delete a file how to
More informationModule 10A Lecture - 20 What is a function? Why use functions Example: power (base, n)
Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Module 10A Lecture - 20 What is a function?
More informationCSI Lab 02. Tuesday, January 21st
CSI Lab 02 Tuesday, January 21st Objectives: Explore some basic functionality of python Introduction Last week we talked about the fact that a computer is, among other things, a tool to perform high speed
More informationIntroduction to Functions. Functions. Library Functions. Intrinsic Functions. Library Functions. Chapter 6 Fall 2015, CSUS. Chapter 6.
s Introduction to s Chapter 6 Fall 2015, CSUS Chapter 6.1 Introduction to s Library s A function is a module that returns a value back to the part of the program that called it Found in practically all
More informationMITOCW watch?v=kz7jjltq9r4
MITOCW watch?v=kz7jjltq9r4 PROFESSOR: We're going to look at the most fundamental of all mathematical data types, namely sets, and let's begin with the definitions. So informally, a set is a collection
More information4. Write sets of directions for how to check for direct variation. How to check for direct variation by analyzing the graph :
Name Direct Variations There are many relationships that two variables can have. One of these relationships is called a direct variation. Use the description and example of direct variation to help you
More informationAMS 27L LAB #1 Winter 2009
AMS 27L LAB #1 Winter 2009 Introduction to MATLAB Objectives: 1. To introduce the use of the MATLAB software package 2. To learn elementary mathematics in MATLAB Getting Started: Log onto your machine
More informationApplied Calculus. Lab 1: An Introduction to R
1 Math 131/135/194, Fall 2004 Applied Calculus Profs. Kaplan & Flath Macalester College Lab 1: An Introduction to R Goal of this lab To begin to see how to use R. What is R? R is a computer package for
More informationChapter 7: Analytic Trigonometry
Chapter 7: Analytic Trigonometry 7. Trigonometric Identities Below are the basic trig identities discussed in previous chapters. Reciprocal csc(x) sec(x) cot(x) sin(x) cos(x) tan(x) Quotient sin(x) cos(x)
More informationSo on the survey, someone mentioned they wanted to work on heaps, and someone else mentioned they wanted to work on balanced binary search trees.
So on the survey, someone mentioned they wanted to work on heaps, and someone else mentioned they wanted to work on balanced binary search trees. According to the 161 schedule, heaps were last week, hashing
More informationIntroduction to Matlab
Introduction to Matlab Kristian Sandberg Department of Applied Mathematics University of Colorado Goal The goal with this worksheet is to give a brief introduction to the mathematical software Matlab.
More informationMITOCW watch?v=4dj1oguwtem
MITOCW watch?v=4dj1oguwtem PROFESSOR: So it's time to examine uncountable sets. And that's what we're going to do in this segment. So Cantor's question was, are all sets the same size? And he gives a definitive
More informationSpring CS Homework 3 p. 1. CS Homework 3
Spring 2018 - CS 111 - Homework 3 p. 1 Deadline 11:59 pm on Friday, February 9, 2018 Purpose CS 111 - Homework 3 To try out another testing function, check-within, to get more practice using the design
More informationMITOCW watch?v=zm5mw5nkzjg
MITOCW watch?v=zm5mw5nkzjg The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To
More informationIntroduction to Programming
Introduction to Programming Department of Computer Science and Information Systems Tingting Han (afternoon), Steve Maybank (evening) tingting@dcs.bbk.ac.uk sjmaybank@dcs.bbk.ac.uk Autumn 2017 Week 4: More
More informationUse Parametric notation. Interpret the effect that T has on the graph as motion.
Learning Objectives Parametric Functions Lesson 3: Go Speed Racer! Level: Algebra 2 Time required: 90 minutes One of the main ideas of the previous lesson is that the control variable t does not appear
More informationIntro To Excel Spreadsheet for use in Introductory Sciences
INTRO TO EXCEL SPREADSHEET (World Population) Objectives: Become familiar with the Excel spreadsheet environment. (Parts 1-5) Learn to create and save a worksheet. (Part 1) Perform simple calculations,
More informationMITOCW ocw f99-lec07_300k
MITOCW ocw-18.06-f99-lec07_300k OK, here's linear algebra lecture seven. I've been talking about vector spaces and specially the null space of a matrix and the column space of a matrix. What's in those
More informationThe Stack, Free Store, and Global Namespace
Pointers This tutorial is my attempt at clarifying pointers for anyone still confused about them. Pointers are notoriously hard to grasp, so I thought I'd take a shot at explaining them. The more information
More informationMITOCW watch?v=9h6muyzjms0
MITOCW watch?v=9h6muyzjms0 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To
More informationBasic and Intermediate Math Vocabulary Spring 2017 Semester
Digit A symbol for a number (1-9) Whole Number A number without fractions or decimals. Place Value The value of a digit that depends on the position in the number. Even number A natural number that is
More informationAP Calculus AB. Table of Contents. Slide 1 / 180. Slide 2 / 180. Slide 3 / 180. Review Unit
Slide 1 / 180 Slide 2 / 180 P alculus Review Unit 2015-10-20 www.njctl.org Table of ontents lick on the topic to go to that section Slide 3 / 180 Slopes Equations of Lines Functions Graphing Functions
More informationFormal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5
Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5 [talking head] This lecture we study theory design and implementation. Programmers have two roles to play here. In one role, they
More informationTrigonometry and the Unit Circle. Chapter 4
Trigonometry and the Unit Circle Chapter 4 Topics Demonstrate an understanding of angles in standard position, expressed in degrees and radians. Develop and apply the equation of the unit circle. Solve
More informationIn our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology.
Guide to and Hi everybody! In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology. This guide focuses on two of those symbols: and. These symbols represent concepts
More information6.001 Notes: Section 6.1
6.001 Notes: Section 6.1 Slide 6.1.1 When we first starting talking about Scheme expressions, you may recall we said that (almost) every Scheme expression had three components, a syntax (legal ways of
More informationThe following content is provided under a Creative Commons license. Your support
MITOCW Lecture 9 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality educational resources for free. To make a donation
More information(Ca...
1 of 8 9/7/18, 1:59 PM Getting started with 228 computational exercises Many physics problems lend themselves to solution methods that are best implemented (or essentially can only be implemented) with
More information(Refer Slide Time: 00:51)
Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute Technology, Madras Module 10 E Lecture 24 Content Example: factorial
More informationSomeone else might choose to describe the closet by determining how many square tiles it would take to cover the floor. 6 ft.
Areas Rectangles One way to describe the size of a room is by naming its dimensions. So a room that measures 12 ft. by 10 ft. could be described by saying its a 12 by 10 foot room. In fact, that is how
More informationAPPENDIX B. Fortran Hints
APPENDIX B Fortran Hints This appix contains hints on how to find errors in your programs, and how to avoid some common Fortran errors in the first place. The basics on how to invoke the Fortran compiler
More informationMath 113 Exam 1 Practice
Math Exam Practice January 6, 00 Exam will cover sections 6.-6.5 and 7.-7.5 This sheet has three sections. The first section will remind you about techniques and formulas that you should know. The second
More information4. Java Project Design, Input Methods
4-1 4. Java Project Design, Input Methods Review and Preview You should now be fairly comfortable with creating, compiling and running simple Java projects. In this class, we continue learning new Java
More informationELEMENTARY MATLAB PROGRAMMING
1 ELEMENTARY MATLAB PROGRAMMING (Version R2013a used here so some differences may be encountered) COPYRIGHT Irving K. Robbins 1992, 1998, 2014, 2015 All rights reserved INTRODUCTION % It is assumed the
More informationMITOCW watch?v=0jljzrnhwoi
MITOCW watch?v=0jljzrnhwoi The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To
More informationIntro. Speed V Growth
Intro Good code is two things. It's elegant, and it's fast. In other words, we got a need for speed. We want to find out what's fast, what's slow, and what we can optimize. First, we'll take a tour of
More informationMultiple Angle and Product-to-Sum Formulas. Multiple-Angle Formulas. Double-Angle Formulas. sin 2u 2 sin u cos u. 2 tan u 1 tan 2 u. tan 2u.
3330_0505.qxd 1/5/05 9:06 AM Page 407 Section 5.5 Multiple-Angle and Product-to-Sum Formulas 407 5.5 Multiple Angle and Product-to-Sum Formulas What you should learn Use multiple-angle formulas to rewrite
More informationTrigonometry. 9.1 Radian and Degree Measure
Trigonometry 9.1 Radian and Degree Measure Angle Measures I am aware of three ways to measure angles: degrees, radians, and gradians. In all cases, an angle in standard position has its vertex at the origin,
More informationA PROGRAM IS A SEQUENCE of instructions that a computer can execute to
A PROGRAM IS A SEQUENCE of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form
More information6.001 Notes: Section 4.1
6.001 Notes: Section 4.1 Slide 4.1.1 In this lecture, we are going to take a careful look at the kinds of procedures we can build. We will first go back to look very carefully at the substitution model,
More informationIn this chapter, we will investigate what have become the standard applications of the integral:
Chapter 8 Overview: Applications of Integrals Calculus, like most mathematical fields, began with trying to solve everyday problems. The theory and operations were formalized later. As early as 70 BC,
More informationECS Baruch Lab 3 Spring 2019 Name
ECS 102 - Baruch Lab 3 Spring 2019 Name I. You can't ask a computer to do something you can't do. Now it is your turn to step through a program, without a computer. DO NOT ENTER THIS PROGRAM ON THE COMPUTER.
More informationName: Dr. Fritz Wilhelm Lab 1, Presentation of lab reports Page # 1 of 7 5/17/2012 Physics 120 Section: ####
Name: Dr. Fritz Wilhelm Lab 1, Presentation of lab reports Page # 1 of 7 Lab partners: Lab#1 Presentation of lab reports The first thing we do is to create page headers. In Word 2007 do the following:
More information: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics
Assignment 1: Turtle Graphics Page 1 600.112: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics Peter H. Fröhlich phf@cs.jhu.edu Joanne Selinski joanne@cs.jhu.edu Due Date: Wednesdays
More informationBasic stuff -- assignments, arithmetic and functions
Basic stuff -- assignments, arithmetic and functions Most of the time, you will be using Maple as a kind of super-calculator. It is possible to write programs in Maple -- we will do this very occasionally,
More informationLESSON 1: Trigonometry Pre-test
LESSON 1: Trigonometry Pre-test Instructions. Answer each question to the best of your ability. If there is more than one answer, put both/all answers down. Try to answer each question, but if there is
More informationAn Introduction to Maple and Maplets for Calculus
An Introduction to Maple and Maplets for Calculus Douglas B. Meade Department of Mathematics University of South Carolina Columbia, SC 29208 USA URL: www.math.sc.edu/~meade e-mail: meade@math.sc.edu Philip
More informationMore Complicated Recursion CMPSC 122
More Complicated Recursion CMPSC 122 Now that we've gotten a taste of recursion, we'll look at several more examples of recursion that are special in their own way. I. Example with More Involved Arithmetic
More informationMath 2 Coordinate Geometry Part 2 Lines & Systems of Equations
Name: Math 2 Coordinate Geometry Part 2 Lines & Systems of Equations Date: USING TWO POINTS TO FIND THE SLOPE - REVIEW In mathematics, the slope of a line is often called m. We can find the slope if we
More informationDr Richard Greenaway
SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 2 Basic MATLAB Operation Dr Richard Greenaway 2 Basic MATLAB Operation 2.1 Overview 2.1.1 The Command Line In this Workshop you will learn how
More informationPIC 10A. Lecture 3: More About Variables, Arithmetic, Casting, Assignment
PIC 10A Lecture 3: More About Variables, Arithmetic, Casting, Assignment Assigning values to variables Our variables last time did not seem very variable. They always had the same value! Variables stores
More informationPython Programming Exercises 1
Python Programming Exercises 1 Notes: throughout these exercises >>> preceeds code that should be typed directly into the Python interpreter. To get the most out of these exercises, don t just follow them
More informationMITOCW watch?v=hverxup4cfg
MITOCW watch?v=hverxup4cfg PROFESSOR: We've briefly looked at graph isomorphism in the context of digraphs. And it comes up in even more fundamental way really for simple graphs where the definition is
More informationMITOCW watch?v=rvrkt-jxvko
MITOCW watch?v=rvrkt-jxvko The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To
More informationCS 206 Introduction to Computer Science II
CS 206 Introduction to Computer Science II 03 / 05 / 2018 Instructor: Michael Eckmann Today s Topics Questions? Comments? binary search trees Finish delete method Discuss run times of various methods Michael
More informationME1107 Computing Y Yan.
ME1107 Computing 1 2008-2009 Y Yan http://www.staff.city.ac.uk/~ensyy About Fortran Fortran Formula Translation High level computer language Basic, Fortran, C, C++, Java, C#, (Matlab) What do we learn?
More information[key, Left subtree, Right subtree]
Project: Binary Search Trees A binary search tree is a method to organize data, together with operations on these data (i.e., it is a data structure). In particular, the operation that this organization
More informationLesson 3: Solving Equations; Floating-point Computation
Lesson 3: Solving Equations; Floating-point Computation restart; A hard equation Last time we were looking at this equation. eq := * sin() = Pi/2; (1.1) Maple didn't know the solutions. solve(eq,,allsolutions);
More informationby Kevin M. Chevalier
Precalculus Review Handout.4 Trigonometric Functions: Identities, Graphs, and Equations, Part I by Kevin M. Chevalier Angles, Degree and Radian Measures An angle is composed of: an initial ray (side) -
More information1 Introduction to Matlab
1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,
More informationLab1: Use of Word and Excel
Dr. Fritz Wilhelm; physics 230 Lab1: Use of Word and Excel Page 1 of 9 Lab partners: Download this page onto your computer. Also download the template file which you can use whenever you start your lab
More informationThere we are; that's got the 3D screen and mouse sorted out.
Introduction to 3D To all intents and purposes, the world we live in is three dimensional. Therefore, if we want to construct a realistic computer model of it, the model should be three dimensional as
More informationQuestion 2. [5 points] Given the following symbolic constant definition
CS 101, Spring 2012 Mar 20th Exam 2 Name: Question 1. [5 points] Determine which of the following function calls are valid for a function with the prototype: void drawrect(int width, int height); Assume
More informationMITOCW watch?v=yarwp7tntl4
MITOCW watch?v=yarwp7tntl4 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality, educational resources for free.
More informationDesign and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute. Module 02 Lecture - 45 Memoization
Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute Module 02 Lecture - 45 Memoization Let us continue our discussion of inductive definitions. (Refer Slide Time: 00:05)
More information2 Making Decisions. Store the value 3 in memory location y
2.1 Aims 2 Making Decisions By the end of this worksheet, you will be able to: Do arithmetic Start to use FORTRAN intrinsic functions Begin to understand program flow and logic Know how to test for zero
More informationJava Programming. Computer Science 112
Java Programming Computer Science 112 Yay Programming! How did the RPS program go? Did you notice the part where I pointed at the answer on the board that we did together? Biggest problems in NumbersAndMath
More informationCSCI 102 Fall 2010 Exam #1
Name: USC Username: CSCI 102 Fall 2010 Exam #1 Problems Problem #1 (14 points) Problem #2 (15 points) Problem #3 (20 points) Problem #4 (16 points) Problem #5 (35 points) Total (100 points) Problem 1 Short
More informationUACCESS ANALYTICS. Intermediate Reports & Dashboards. Arizona Board of Regents, 2015 THE UNIVERSITY OF ARIZONA. updated v.1.
UACCESS ANALYTICS Arizona Board of Regents, 2015 THE UNIVERSITY OF ARIZONA For information and permission to use our PDF manuals, please send an email to: uitsworkshopteam@list.arizona.edu updated 06.01.2015
More informationIntroduction. Using Styles. Word 2010 Styles and Themes. To Select a Style: Page 1
Word 2010 Styles and Themes Introduction Page 1 Styles and themes are powerful tools in Word that can help you easily create professional looking documents. A style is a predefined combination of font
More informationLinked Lists. What is a Linked List?
Linked Lists Along with arrays, linked lists form the basis for pretty much every other data stucture out there. This makes learning and understand linked lists very important. They are also usually the
More informationCSE 142/143 Unofficial Commenting Guide Eric Arendt, Alyssa Harding, Melissa Winstanley
CSE 142/143 Unofficial Commenting Guide Eric Arendt, Alyssa Harding, Melissa Winstanley In Brief: What You Need to Know to Comment Methods in CSE 143 Audience o A random person you don t know who wants
More informationPost Experiment Interview Questions
Post Experiment Interview Questions Questions about the Maximum Problem 1. What is this problem statement asking? 2. What is meant by positive integers? 3. What does it mean by the user entering valid
More informationMITOCW ocw f99-lec12_300k
MITOCW ocw-18.06-f99-lec12_300k This is lecture twelve. OK. We've reached twelve lectures. And this one is more than the others about applications of linear algebra. And I'll confess. When I'm giving you
More informationBinary, Hexadecimal and Octal number system
Binary, Hexadecimal and Octal number system Binary, hexadecimal, and octal refer to different number systems. The one that we typically use is called decimal. These number systems refer to the number of
More informationHow To Set User Account Password In Windows 7 From Guest
How To Set User Account Password In Windows 7 From Guest To change the password of a specific user in windows 7 or 8.1, without knowing How to change or set Windows 7 default font settings to bold, italic?
More informationDear Accelerated Pre-Calculus Student:
Dear Accelerated Pre-Calculus Student: We are very excited that you have decided to take this course in the upcoming school year! This is a fast-paced, college-preparatory mathematics course that will
More informationThe following content is provided under a Creative Commons license. Your support
MITOCW Recitation 4 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To make
More informationMAT 003 Brian Killough s Instructor Notes Saint Leo University
MAT 003 Brian Killough s Instructor Notes Saint Leo University Success in online courses requires self-motivation and discipline. It is anticipated that students will read the textbook and complete sample
More informationJava Programming Constructs Java Programming 2 Lesson 1
Java Programming Constructs Java Programming 2 Lesson 1 Course Objectives Welcome to OST's Java 2 course! In this course, you'll learn more in-depth concepts and syntax of the Java Programming language.
More information1 Getting used to Python
1 Getting used to Python We assume you know how to program in some language, but are new to Python. We'll use Java as an informal running comparative example. Here are what we think are the most important
More informationAfter an "Hour of Code" now what?
After an "Hour Code" now what? 2016 Curtis Center Mathematics and Teaching Conference Chris Anderson Pressor and Director the Program in Computing UCLA Dept. Mathematics March 5, 2016 New push in K-12
More informationCOP 4516: Math for Programming Contest Notes
COP 4516: Math for Programming Contest Notes Euclid's Algorithm Euclid's Algorithm is the efficient way to determine the greatest common divisor between two integers. Given two positive integers a and
More informationTable of Contents. Introduction to the Math Practice Series...iv Common Mathematics Symbols and Terms...1
Table of Contents Table of Contents Introduction to the Math Practice Series...iv Common Mathematics Symbols and Terms...1 Chapter 1: Real Numbers...5 Real Numbers...5 Checking Progress: Real Numbers...8
More informationThe Justin Guide to Matlab for MATH 241 Part 1.
Table of Contents Running Matlab... 1 Okay, I'm running Matlab, now what?... 1 Precalculus... 2 Calculus 1... 5 Calculus 2... 6 Calculus 3... 7 The basic format of this guide is that you will sit down
More informationThe Math Class (Outsource: Math Class Supplement) Random Numbers. Lab 06 Math Class
The (Outsource: Supplement) The includes a number of constants and methods you can use to perform common mathematical functions. A commonly used constant found in the Math class is Math.PI which is defined
More information