Exercises C-Programming
|
|
- Brent Day
- 6 years ago
- Views:
Transcription
1 Exercises C-Programming Claude Fuhrer 0 November 016 Contents 1 Serie 1 1 Min function Triangle surface Triangle surface Multiple assignements Serie 4 5 Numerical integration using the rectangles method Root of a function
2 1 SERIE 1 1 Serie 1 Exercise 1: Min function Write a program which read two integer from the keyboard and displays the smallest (i.e. minumum) value entered. Exercise : Triangle surface 1 Write a program which ask the user to enter the base and height of a triangle and display its area. Exercise 3: Triangle surface One can compute the area of a triangle given by its 3 sides using the Heron formula. This formula states that if s 1, s and s 3 are the length of the three sides, then the area is given by: area = p (p s 1 ) (p s ) (p s 3 ) where the variable p is the half perimeter, that is: p = s 1 + s + s 3 Tu be able to compute the square root, you should first include the following into your program: #include <math.h> and then call the function sqrt(). Exercise 4: Multiple assignements Consider the following program. 1 #include <stdio.h> #include <stdlib.h> 3 4 int main()
3 1 SERIE 1 5 { 6 int a, b, c; 7 8 a = 4; 9 b = ; 10 c = 1; 11 printf ("a = %i, b = %i, c = %i\n", a, b, c); 1 13 a = b + ; 14 b = a - b + c; 15 c = c + a; 16 printf ("a = %i, b = %i, c = %i\n", a, b, c); a = * b; 19 c = a - c; 0 b = b + / a; 1 printf ("a = %i, b = %i, c = %i\n", a, b, c); 3 c = + a; 4 a = a - b; 5 b = b + c / 3; 6 printf ("a = %i, b = %i, c = %i\n", a, b, c); 7 } 3
4 SERIE Serie Exercise 5: Numerical integration using the rectangles method Let be f(x) a function bounded over the interval [a, b]. For our example, one would take f(x) = sin(x) + sin( x ). One would compute the area delimited by the function f on the interval [0, π]. Mathematically this operation is called an integration and is written: area = π 0 sin(x) + sin( x )dx = 4 But, for this exercise, one would not use the standard analysis tools, but try to compute the integral using a numerical method. For that goal, one would decompose the function in small rectangles, compute the area of each rectangle and then sum all these rectangles to obtain an approximation of the real integral value. The graph of the function is given by: and the rectangle we woud compute are: 4
5 SERIE The algorithm may be written as: Data: The function f(x) and the bounds of the interval [a, ] Result: A numerical approximation of the interval begin numberofsteps 10; // Width of rectangles; step (upperbound- lowerbound) / numberofsteps; totalarea 0; x i lowerbound; while x i < upperbound do y i = f(x i ); rectanglearea y i step; totalarea = totalarea + rectanglearea; // Next x i value; x i = x i + step; The value of the integral is into the variable totalarea; Algorithm 1: Integration with the rectangles method To enhance the precision of the computation, it is possible to augment the number of steps, that is to reduce the width of the rectangles. 5
6 SERIE Exercise 6: Root of a function For that exercise, one would compute one root (i.e. zero) of a function over a given interval. For that goal one would use a very important theorem of analysis, called Bolzano s theorem. This theorem states that: Theorem 1 If a function f(x) is continuous over the interval [a, b] and has the value f(a) and f(b) at the bounds of the interval, then it takes any value between f(a) and f(b) within this interval. One important corollary of this theorem is that is the sign of f(a) is different of the sign of f(b) that the function f takes the value 0 over the interval [a, b]. Consider the function f(x) = sin(x) cos(3x). The graph of this function is given by: sin(x) - cos(3x) One can see that this function takes the value 0 between 0 and 0.5. But what is the exact value of x such that f(x) = 0? To solve numerically this problem, one would use a method called the bissection method. This method takes the interval [a, b] and divide it into two part. One can then check if the zero of the function is between the bounds [a, a+b a+b ] or between [, b]. The new interval is than halved iteratively until one has found an interval sufficiently small for the precision we wanted to reach. One can describe the algorithm of this method as in algorithm on page 7. Now that the algorithm is clear, it is simple to implement this approximation method. For an example, of solution, see the code of the program bissection.c. 6
7 SERIE Data: The function f(x) and the bounds of the initial interval [a, b] Result: An interval containing the zero of the function [a, b ] such b a < ε begin a a; b b; middle (a + b)/; while b a > ε do if sign(f(a )) sign(f(middle)) then b middle; else a middle; middle (a + b )/ Algorithm : The bissection method 7
An interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s.
Using Monte Carlo to Estimate π using Buffon s Needle Problem An interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s. Here s the problem (in a simplified form). Suppose
More informationWebAssign Lesson 1-2a Area Between Curves (Homework)
WebAssign Lesson 1-2a Area Between Curves (Homework) Current Score : / 30 Due : Thursday, June 26 2014 11:00 AM MDT Jaimos Skriletz Math 175, section 31, Summer 2 2014 Instructor: Jaimos Skriletz 1. /3
More informationFinal Examination. Math1339 (C) Calculus and Vectors. December 22, :30-12:30. Sanghoon Baek. Department of Mathematics and Statistics
Math1339 (C) Calculus and Vectors December 22, 2010 09:30-12:30 Sanghoon Baek Department of Mathematics and Statistics University of Ottawa Email: sbaek@uottawa.ca MAT 1339 C Instructor: Sanghoon Baek
More informationMATH 104 Sample problems for first exam - Fall MATH 104 First Midterm Exam - Fall (d) 256 3
MATH 14 Sample problems for first exam - Fall 1 MATH 14 First Midterm Exam - Fall 1. Find the area between the graphs of y = 9 x and y = x + 1. (a) 4 (b) (c) (d) 5 (e) 4 (f) 81. A solid has as its base
More informationB.Stat / B.Math. Entrance Examination 2017
B.Stat / B.Math. Entrance Examination 017 BOOKLET NO. TEST CODE : UGA Forenoon Questions : 0 Time : hours Write your Name, Registration Number, Test Centre, Test Code and the Number of this Booklet in
More informationSOME PROPERTIES OF TRIGONOMETRIC FUNCTIONS. 5! x7 7! + = 6! + = 4! x6
SOME PROPERTIES OF TRIGONOMETRIC FUNCTIONS PO-LAM YUNG We defined earlier the sine cosine by the following series: sin x = x x3 3! + x5 5! x7 7! + = k=0 cos x = 1 x! + x4 4! x6 6! + = k=0 ( 1) k x k+1
More informationExpressions. Eric McCreath
Expressions Eric McCreath 2 Expressions on integers There is the standard set of interger operators in c. We have: y = 4 + 7; // add y = 7-3; // subtract y = 3 * x; // multiply y = x / 3; // integer divide
More information2.9 Linear Approximations and Differentials
2.9 Linear Approximations and Differentials 2.9.1 Linear Approximation Consider the following graph, Recall that this is the tangent line at x = a. We had the following definition, f (a) = lim x a f(x)
More informationMEI GeoGebra Tasks for A2 Core
Task 1: Functions The Modulus Function 1. Plot the graph of y = x : use y = x or y = abs(x) 2. Plot the graph of y = ax+b : use y = ax + b or y = abs(ax+b) If prompted click Create Sliders. What combination
More information6-1 (Function). (Function) !*+!"#!, Function Description Example. natural logarithm of x (base e) rounds x to smallest integer not less than x
(Function) -1.1 Math Library Function!"#! $%&!'(#) preprocessor directive #include !*+!"#!, Function Description Example sqrt(x) square root of x sqrt(900.0) is 30.0 sqrt(9.0) is 3.0 exp(x) log(x)
More information6.001 SICP. Types. Types compound data. Types simple data. Types. Types procedures
Today s topics Types of objects and procedures Procedural abstractions Capturing patterns across procedures Higher Order Procedures Types (+ 5 1) ==> 15 (+ "hi 5) ;The object "hi", passed as the first
More informationUNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA C ASSIGNMENTS
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA C ASSIGNMENTS All programs need to be submitted on 7th Oct 206 by writing in hand written format in A4 sheet. Flowcharts, algorithms, source codes and outputs
More informationP1 REVISION EXERCISE: 1
P1 REVISION EXERCISE: 1 1. Solve the simultaneous equations: x + y = x +y = 11. For what values of p does the equation px +4x +(p 3) = 0 have equal roots? 3. Solve the equation 3 x 1 =7. Give your answer
More informationLAB 6 FUNCTIONS I School of Computer and Communication Engineering
LAB 6 FUNCTIONS I School of Computer and Communication Engineering 1 Universiti Malaysia Perlis 1. OBJECTIVES: 1.1 To apply functions as building blocks of programs. 1.2 To write C programs using functions.
More informationLog1 Contest Round 2 Theta Circles, Parabolas and Polygons. 4 points each
Name: Units do not have to be included. 016 017 Log1 Contest Round Theta Circles, Parabolas and Polygons 4 points each 1 Find the value of x given that 8 x 30 Find the area of a triangle given that it
More informationLimits and Continuity: section 12.2
Limits and Continuity: section 1. Definition. Let f(x,y) be a function with domain D, and let (a,b) be a point in the plane. We write f (x,y) = L if for each ε > 0 there exists some δ > 0 such that if
More informationAP * Calculus Review. Area and Volume
AP * Calculus Review Area and Volume Student Packet Advanced Placement and AP are registered trademark of the College Entrance Examination Board. The College Board was not involved in the production of,
More informationLECTURE 0: Introduction and Background
1 LECTURE 0: Introduction and Background September 10, 2012 1 Computational science The role of computational science has become increasingly significant during the last few decades. It has become the
More informationCHAPTER 8: INTEGRALS 8.1 REVIEW: APPROXIMATING INTEGRALS WITH RIEMANN SUMS IN 2-D
CHAPTER 8: INTEGRALS 8.1 REVIEW: APPROXIMATING INTEGRALS WITH RIEMANN SUMS IN 2-D In two dimensions we have previously used Riemann sums to approximate ( ) following steps: with the 1. Divide the region
More informationMeasurement and Geometry: Area and Volume of Geometric Figures and Objects *
OpenStax-CNX module: m35023 1 Measurement and Geometry: and Volume of Geometric Figures and Objects * Wade Ellis Denny Burzynski This work is produced by OpenStax-CNX and licensed under the Creative Commons
More informationPointers and scanf() Steven R. Bagley
Pointers and scanf() Steven R. Bagley Recap Programs are a series of statements Defined in functions Can call functions to alter program flow if statement can determine whether code gets run Loops can
More informationIntegration. Volume Estimation
Monte Carlo Integration Lab Objective: Many important integrals cannot be evaluated symbolically because the integrand has no antiderivative. Traditional numerical integration techniques like Newton-Cotes
More informationBiostatistics 615/815 Lecture 13: Numerical Optimization
Biostatistics 615/815 Lecture 13: Numerical Optimization Hyun Min Kang October 27th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 13 October 27th, 2011 1 / 35 The Problem Hyun Min Kang Biostatistics
More informationEducation Resources. This section is designed to provide examples which develop routine skills necessary for completion of this section.
Education Resources Trigonometry Higher Mathematics Supplementary Resources Section A This section is designed to provide examples which develop routine skills necessary for completion of this section.
More information5 Applications of Definite Integrals
5 Applications of Definite Integrals The previous chapter introduced the concepts of a definite integral as an area and as a limit of Riemann sums, demonstrated some of the properties of integrals, introduced
More informationf( x ), or a solution to the equation f( x) 0. You are already familiar with ways of solving
The Bisection Method and Newton s Method. If f( x ) a function, then a number r for which f( r) 0 is called a zero or a root of the function f( x ), or a solution to the equation f( x) 0. You are already
More informationHow to Do Word Problems. Study of Integers
Study of Integers In this chapter, we are are going to closely look at the number line system and study integers. -3-2 -1 0 1 2 3 4 5 6 An integer is simply a number like 0, 1, 2, 3, and 4, but unlike
More informationRectangle Sums
Rectangle Sums --208 You can approximate the area under a curve using rectangles. To do this, divide the base interval into pieces subintervals). Then on each subinterval, build a rectangle that goes up
More informationNumerical Methods Lecture 1
Numerical Methods Lecture 1 Basics of MATLAB by Pavel Ludvík The recommended textbook: Numerical Methods Lecture 1 by Pavel Ludvík 2 / 30 The recommended textbook: Title: Numerical methods with worked
More informationMathematics 134 Calculus 2 With Fundamentals Exam 2 Answers/Solutions for Sample Questions March 2, 2018
Sample Exam Questions Mathematics 1 Calculus 2 With Fundamentals Exam 2 Answers/Solutions for Sample Questions March 2, 218 Disclaimer: The actual exam questions may be organized differently and ask questions
More informationESTIMATING AND CALCULATING AREAS OF REGIONS BETWEEN THE X-AXIS AND THE GRAPH OF A CONTINUOUS FUNCTION v.07
ESTIMATING AND CALCULATING AREAS OF REGIONS BETWEEN THE X-AXIS AND THE GRAPH OF A CONTINUOUS FUNCTION v.7 In this activity, you will explore techniques to estimate the "area" etween a continuous function
More information4.2 and 4.6 filled in notes.notebook. December 08, Integration. Copyright Cengage Learning. All rights reserved.
4 Integration Copyright Cengage Learning. All rights reserved. 1 4.2 Area Copyright Cengage Learning. All rights reserved. 2 Objectives Use sigma notation to write and evaluate a sum. Understand the concept
More informationReals 1. Floating-point numbers and their properties. Pitfalls of numeric computation. Horner's method. Bisection. Newton's method.
Reals 1 13 Reals Floating-point numbers and their properties. Pitfalls of numeric computation. Horner's method. Bisection. Newton's method. 13.1 Floating-point numbers Real numbers, those declared to be
More informationCSE 251 PROJECT 1. Andrew Christlieb. Monday Class AND Friday Class Abstract. Web:
CSE 51 PROJECT 1 Andrew Christlieb Monday Class 0-03-14 AND Friday Class 01-31-14 Abstract Web: http://www.cse.msu.edu/ cse51 Project 1 due date: (Monday Class) 0-17-14 AND (Friday Class)0-14-14, time:
More informationIntroduction to MATLAB
Introduction to MATLAB Basics MATLAB is a high-level interpreted language, and uses a read-evaluate-print loop: it reads your command, evaluates it, then prints the answer. This means it works a lot like
More informationWhat is log a a equal to?
How would you differentiate a function like y = sin ax? What is log a a equal to? How do you prove three 3-D points are collinear? What is the general equation of a straight line passing through (a,b)
More informationThe Newton Method as a Short WEB Example
The Newton Method as a Short WEB Example August 31, 1996 15:22 Abstract: This is written in John Krommes FWEB but with the output higher level language being C. FWEB is the most supported of the dialects
More informationUnit #13 : Integration to Find Areas and Volumes, Volumes of Revolution
Unit #13 : Integration to Find Areas and Volumes, Volumes of Revolution Goals: Beabletoapplyaslicingapproachtoconstructintegralsforareasandvolumes. Be able to visualize surfaces generated by rotating functions
More informationBil 104 Intiroduction To Scientific And Engineering Computing. Lecture 5. Playing with Data Modifiers and Math Functions Getting Controls
Readin from and Writint to Standart I/O BIL104E: Introduction to Scientific and Engineering Computing Lecture 5 Playing with Data Modifiers and Math Functions Getting Controls Pointers What Is a Pointer?
More informationI IS II. = 2y"\ V= n{ay 2 l 3 -\y 2 )dy. Jo n [fy 5 ' 3 1
r Exercises 5.2 Figure 530 (a) EXAMPLE'S The region in the first quadrant bounded by the graphs of y = i* and y = 2x is revolved about the y-axis. Find the volume of the resulting solid. SOLUTON The region
More information= f (a, b) + (hf x + kf y ) (a,b) +
Chapter 14 Multiple Integrals 1 Double Integrals, Iterated Integrals, Cross-sections 2 Double Integrals over more general regions, Definition, Evaluation of Double Integrals, Properties of Double Integrals
More informationPHYSICS 115/242 Homework 2, Solutions
PHYSICS 115/242 Homework 2, Solutions 1. Trapezium Rule I wrote a function trap to do the trapezoidal rule, and put it in a separate file, trap.c. This is as follows: /******************************************************************
More informationSec 4.1 Trigonometric Identities Basic Identities. Name: Reciprocal Identities:
Sec 4. Trigonometric Identities Basic Identities Name: Reciprocal Identities: Quotient Identities: sin csc cos sec csc sin sec cos sin tan cos cos cot sin tan cot cot tan Using the Reciprocal and Quotient
More informationMensuration. Introduction Perimeter and area of plane figures Perimeter and Area of Triangles
5 Introduction In previous classes, you have learnt about the perimeter and area of closed plane figures such as triangles, squares, rectangles, parallelograms, trapeziums and circles; the area between
More informationProblem Solving (Computing) Array and Pointer
CS101 Introduction to computing Problem Solving (Computing) & Array and Pointer A. Sahu and S. V.Rao Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati 1 Outline Loop invariant and loop
More informationPython Lists: Example 1: >>> items=["apple", "orange",100,25.5] >>> items[0] 'apple' >>> 3*items[:2]
Python Lists: Lists are Python's compound data types. A list contains items separated by commas and enclosed within square brackets ([]). All the items belonging to a list can be of different data type.
More informationIntroduction to C++ Introduction to C++ Week 6 Dr Alex Martin 2013 Slide 1
Introduction to C++ Introduction to C++ Week 6 Dr Alex Martin 2013 Slide 1 Numerical Integration Methods The Trapezoidal Rule If one has an arbitrary function f(x) to be integrated over the region [a,b]
More informationCS 137 Part 7. Big-Oh Notation, Linear Searching and Basic Sorting Algorithms. November 10th, 2017
CS 137 Part 7 Big-Oh Notation, Linear Searching and Basic Sorting Algorithms November 10th, 2017 Big-Oh Notation Up to this point, we ve been writing code without any consideration for optimization. There
More informationMAT137 Calculus! Lecture 31
MAT137 Calculus! Lecture 31 Today: Next: Integration Methods: Integration Methods: Trig. Functions (v. 9.10-9.12) Rational Functions Trig. Substitution (v. 9.13-9.15) (v. 9.16-9.17) Integration by Parts
More informationThis is called the horizontal displacement of also known as the phase shift.
sin (x) GRAPHS OF TRIGONOMETRIC FUNCTIONS Definitions A function f is said to be periodic if there is a positive number p such that f(x + p) = f(x) for all values of x. The smallest positive number p for
More informationFondamenti di Informatica
Fondamenti di Informatica Scripts and Functions: examples lesson 9 2012/04/16 Prof. Emiliano Casalicchio emiliano.casalicchio@uniroma2.it Agenda Examples Bisection method Locating roots Secant methods
More informationA very short introduction to Matlab and Octave
A very short introduction to Matlab and Octave Claude Fuhrer (claude.fuhrer@bfh.ch) 09 November 2016 Contents 1 Installation 3 2 Variables and literal values 3 2.1 Variables....................................
More informationNAME: Section # SSN: X X X X
Math 155 FINAL EXAM A May 5, 2003 NAME: Section # SSN: X X X X Question Grade 1 5 (out of 25) 6 10 (out of 25) 11 (out of 20) 12 (out of 20) 13 (out of 10) 14 (out of 10) 15 (out of 16) 16 (out of 24)
More informationAreas of some geometric gures
reas of some geometric gures The area of a given geometric gure is the number of unit squares, (i.e. squares with length and width equal to unit), that may be tted into the region. The simplest is a rectangle
More informationAreas of Polygons and Circles
Chapter 8 Areas of Polygons and Circles Copyright Cengage Learning. All rights reserved. 8.2 Perimeter and Area of Polygons Copyright Cengage Learning. All rights reserved. Perimeter and Area of Polygons
More informationNotice that the height of each rectangle is and the width of each rectangle is.
Math 1410 Worksheet #40: Section 6.3 Name: In some cases, computing the volume of a solid of revolution with cross-sections can be difficult or even impossible. Is there another way to compute volumes
More informationEntrance Exam Wiskunde B
CENTRALE COMMISSIE VOORTENTAMEN WISKUNDE Entrance Exam Wiskunde B Date: 16 January 2015 Time: 13.30 16.30 Questions: 5 Please read the instructions below carefully before answering the questions. There
More informationIntroduction to Languages for Scientific Computing, winter semester 14/15: Final Exam
Introduction to Languages for Scientific Computing, winter semester 14/15: Final Exam Lecture given by: Paolo Bientinesi First exam, 10.02.2015 The following document is a transcript from memory created
More informationTHREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.
THREE LECTURES ON BASIC TOPOLOGY PHILIP FOTH 1. Basic notions. Let X be a set. To make a topological space out of X, one must specify a collection T of subsets of X, which are said to be open subsets of
More informationDouble Integration: Non-Rectangular Domains
Double Integration: Non-Rectangular Domains Thomas Banchoff and Associates June 18, 2003 1 Introduction In calculus of one variable, all domains are intervals which are subsets of the line. In calculus
More informationALGORITHM 2-1 Solution for Exercise 4
Chapter 2 Recursion Exercises 1. a. 3 * 4 = 12 b. (2 * (2 * fun1(0) + 7) + 7) = (2 * (2 * (3 * 0) + 7) + 7) = 21 c. (2 * (2 * fun1(2) + 7) + 7) = (2 * (2 * (3 * 2) + 7) + 7) = 45 2. a. 3 b. (fun2(2, 6)
More informationANSI C Programming Simple Programs
ANSI C Programming Simple Programs /* This program computes the distance between two points */ #include #include #include main() { /* Declare and initialize variables */ double
More informationRaspberry Pi Basics. CSInParallel Project
Raspberry Pi Basics CSInParallel Project Sep 11, 2016 CONTENTS 1 Getting started with the Raspberry Pi 1 2 A simple parallel program 3 3 Running Loops in parallel 7 4 When loops have dependencies 11 5
More informationC Program Structures
Review-1 Structure of C program Variable types and Naming Input and output Arithmetic operation 85-132 Introduction to C-Programming 9-1 C Program Structures #include void main (void) { } declaration
More informationMATH 1A MIDTERM 1 (8 AM VERSION) SOLUTION. (Last edited October 18, 2013 at 5:06pm.) lim
MATH A MIDTERM (8 AM VERSION) SOLUTION (Last edited October 8, 03 at 5:06pm.) Problem. (i) State the Squeeze Theorem. (ii) Prove the Squeeze Theorem. (iii) Using a carefully justified application of the
More informationIntro to Computational Programming in C Engineering For Kids!
CONTROL STRUCTURES CONDITIONAL EXPRESSIONS Take the construction like this: Simple example: if (conditional expression) statement(s) we do if the condition is true statement(s) we do if the condition is
More informationIn the figure show below, the measure of angle x is 150 since the sum of the remote interior angles is
Exterior angles of a triangle An exterior angle of a triangle is equal to the sum of the remote interior angles - in other words, the two interior angles on the opposite side of the triangle. In the figure
More information1) Find. a) b) c) d) e) 2) The function g is defined by the formula. Find the slope of the tangent line at x = 1. a) b) c) e) 3) Find.
1 of 7 1) Find 2) The function g is defined by the formula Find the slope of the tangent line at x = 1. 3) Find 5 1 The limit does not exist. 4) The given function f has a removable discontinuity at x
More informationCS321 Introduction To Numerical Methods
CS3 Introduction To Numerical Methods Fuhua (Frank) Cheng Department of Computer Science University of Kentucky Lexington KY 456-46 - - Table of Contents Errors and Number Representations 3 Error Types
More informationCOMPUTING AND DATA ANALYSIS WITH EXCEL. Numerical integration techniques
COMPUTING AND DATA ANALYSIS WITH EXCEL Numerical integration techniques Outline 1 Quadrature in one dimension Mid-point method Trapezium method Simpson s methods Uniform random number generation in Excel,
More informationMATH 31A HOMEWORK 9 (DUE 12/6) PARTS (A) AND (B) SECTION 5.4. f(x) = x + 1 x 2 + 9, F (7) = 0
FROM ROGAWSKI S CALCULUS (2ND ED.) SECTION 5.4 18.) Express the antiderivative F (x) of f(x) satisfying the given initial condition as an integral. f(x) = x + 1 x 2 + 9, F (7) = 28.) Find G (1), where
More informationC-Programming. Claude Fuhrer 5 août 2017
C-Programming Claude Fuhrer (claude.fuhrer@bfh.ch) 5 août 2017 1 Pseudocode The most important step in writing a program, is to understand the problem which should be solved and then establish a strategy
More informationBiostatistics 615/815 Lecture 16: Importance sampling Single dimensional optimization
Biostatistics 615/815 Lecture 16: Single dimensional optimization Hyun Min Kang November 1st, 2012 Hyun Min Kang Biostatistics 615/815 - Lecture 16 November 1st, 2012 1 / 59 The crude Monte-Carlo Methods
More informationPrecedence and Associativity Table. % specifiers in ANSI C: String Control Codes:
CMPE108, Homework-2 (C Fundamentals, Expressions, and Selection Structure.) Student Nr:... Name,Surname:...:... CMPE108 Group:... Signature... Please print this homework, and solve all questions on the
More informationReview of Trigonometry
Worksheet 8 Properties of Trigonometric Functions Section Review of Trigonometry This section reviews some of the material covered in Worksheets 8, and The reader should be familiar with the trig ratios,
More informationAreas and Paper Folding
Year 7, Years 8 and 9, Years 0 to (Geometry (extension) and Calculus (extension)) Between 45 and 90 minutes, depending on the number of modules chosen. This activity seeks the triangle of largest area
More informationGuided Problem Solving
-1 Guided Problem Solving GPS Student Page 57, Exercises 1 1: Match each rule with the correct translation. A. (x, y) (x, y 1 ) I. P(, 1) P (3, ) B. (x, y) (x 1 3, y) II. Q(3, 0) Q (3, ) C. (x, y) (x 1,
More informationComputational Geometry. Geometry Cross Product Convex Hull Problem Sweep Line Algorithm
GEOMETRY COMP 321 McGill University These slides are mainly compiled from the following resources. - Professor Jaehyun Park slides CS 97SI - Top-coder tutorials. - Programming Challenges books. Computational
More informationMATH 104 First Midterm Exam - Fall (d) A solid has as its base the region in the xy-plane the region between the curve y = 1 x2
MATH 14 First Midterm Exam - Fall 214 1. Find the area between the graphs of y = x 2 + x + 5 and y = 2x 2 x. 1. Find the area between the graphs of y = x 2 + 4x + 6 and y = 2x 2 x. 1. Find the area between
More informationTuesday 22 January 2008 Afternoon Time: 1 hour 30 minutes
Paper Reference(s) 6666/0 Edexcel GCE Core Mathematics C4 Advanced Level Tuesday 22 January 2008 Afternoon Time: hour 30 minutes Materials required for examination Mathematical Formulae (Green) Items included
More informationObject Oriented Programming Using C++ Mathematics & Computing IET, Katunayake
Assigning Values // Example 2.3(Mathematical operations in C++) float a; cout > a; cout
More informationBest Student Exam (Open and Closed) Solutions Texas A&M High School Math Contest 8 November 2014
Best Student Exam (Open and Closed) Solutions Texas A&M High School Math Contest 8 November 2014 1. The numbers 1, 2, 3, etc. are written down one after the other up to 1000, without any commas, in one
More informationEfficacy of Numerically Approximating Pi with an N-sided Polygon
Peter Vu Brewer MAT66 Honors Topic Efficacy of umerically Approximating Pi with an -sided Polygon The quest for precisely finding the irrational number pi has been an endeavor since early human history.
More informationAP Computer Science Unit 3. Programs
AP Computer Science Unit 3. Programs For most of these programs I m asking that you to limit what you print to the screen. This will help me in quickly running some tests on your code once you submit them
More informationLesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University
Lesson #3 Variables, Operators, and Expressions Variables We already know the three main types of variables in C: int, char, and double. There is also the float type which is similar to double with only
More informationThe base of a solid is the region in the first quadrant bounded above by the line y = 2, below by
Chapter 7 1) (AB/BC, calculator) The base of a solid is the region in the first quadrant bounded above by the line y =, below by y sin 1 x, and to the right by the line x = 1. For this solid, each cross-section
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 informationCS 97SI: INTRODUCTION TO PROGRAMMING CONTESTS. Jaehyun Park
CS 97SI: INTRODUCTION TO PROGRAMMING CONTESTS Jaehyun Park Today s Lecture Algebra Number Theory Combinatorics (non-computational) Geometry Emphasis on how to compute Sum of Powers n k=1 k 2 = 1 6 n(n
More informationChapter 3. Computer Science & Engineering 155E Computer Science I: Systems Engineering Focus. Existing Information.
Chapter 3 Computer Science & Engineering 155E Computer Science I: Systems Engineering Focus Lecture 03 - Introduction To Functions Christopher M. Bourke cbourke@cse.unl.edu 3.1 Building Programs from Existing
More informationReview Sheet Chapter 3
Review Sheet Chapter 3 1. Find the value of the derivative (if it exists) of the function at the extremum point (0,0). A) 0 B) 1 C) -1 D) E) 2. Find the value of the derivative (if it exists) of the function
More informationHomework: Study 6.1 # 1, 5, 7, 13, 25, 19; 3, 17, 27, 53
January, 7 Goals:. Remember that the area under a curve is the sum of the areas of an infinite number of rectangles. Understand the approach to finding the area between curves.. Be able to identify the
More informationLecture 3. Review. CS 141 Lecture 3 By Ziad Kobti -Control Structures Examples -Built-in functions. Conditions: Loops: if( ) / else switch
Lecture 3 CS 141 Lecture 3 By Ziad Kobti -Control Structures Examples -Built-in functions Review Conditions: if( ) / else switch Loops: for( ) do...while( ) while( )... 1 Examples Display the first 10
More informationf(0.2) < 0 and f(0.3) > 0 f(1.2) > 0 and f(1.3) < 0 f(1) = 1 > 0 and f(2) 0.
1. [Burden and Faires, Section 1.1 Problem 1]. Show that the following equations have at least one solution in the given intervals. a. xcosx 2x 2 +3x 1 = 0 on [0.2,0.3] and [1.2,1.3]. Let f(x) = xcosx
More informationW4260: Modeling the Universe. Lecture 4
W4260: Modeling the Universe Lecture 4 Overview Input and output (I/O) Files Scope Global variables More on functions The art of programming Before starting Program structure/layout Comments Root finding
More informationName Date Period. Worksheet 6.3 Volumes Show all work. No calculator unless stated. Multiple Choice
Name Date Period Worksheet 6. Volumes Show all work. No calculator unless stated. Multiple Choice. (Calculator Permitted) The base of a solid S is the region enclosed by the graph of y ln x, the line x
More informationUnit #11 : Integration by Parts, Average of a Function. Goals: Learning integration by parts. Computing the average value of a function.
Unit #11 : Integration by Parts, Average of a Function Goals: Learning integration by parts. Computing the average value of a function. Integration Method - By Parts - 1 Integration by Parts So far in
More informationHSC Mathematics - Extension 1. Workshop E2
HSC Mathematics - Extension Workshop E Presented by Richard D. Kenderdine BSc, GradDipAppSc(IndMaths), SurvCert, MAppStat, GStat School of Mathematics and Applied Statistics University of Wollongong Moss
More informationMULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.
Algebra Midterm Review Packet # Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. Write the set. ) E is the set of odd natural numbers between
More informationGREENWOOD PUBLIC SCHOOL DISTRICT Algebra III Pacing Guide FIRST NINE WEEKS
GREENWOOD PUBLIC SCHOOL DISTRICT Algebra III FIRST NINE WEEKS Framework/ 1 Aug. 6 10 5 1 Sequences Express sequences and series using recursive and explicit formulas. 2 Aug. 13 17 5 1 Sequences Express
More informationHandout 2 - Root Finding using MATLAB
Handout 2 - Root Finding using MATLAB Middle East Technical University MATLAB has couple of built-in root finding functions. In this handout we ll have a look at fzero, roots and solve functions. It is
More information