...Debugging of a function Consider the find_max() function given below: /** Finds the largest value in array elements x[start] through x[last]. pre: first <= last. @param x Array whose largest value is found @param start First subscript in range @param last Last subscript in range @return The largest value of x[start] through x[last] */ 1. int find_max(int x[], int start, int last) { 2. if (start > last) 3. throw invalid_argument("Empty range"); 4. int max_so_far = 0; 5. for (int i = start; i < last; i++) { 6. if (x[i] > max_so_far) 7. max_so_far = i; 8. } 9. return max_so_far; 10.} ------------------------------------------------- The function will take 3 arguments, an array, starting value and last value and calculates the maximum value and return from where the function has been called. This code does not work properly. In order to understand the working of the code, output statements should be added into the code. The output statements that will be needed in the above function should be inside for loop and after the lines 5, 7 and 9. After including the diagnostic statements, the code can be given as: /** Finds the largest value in array elements x[start] through x[last]. pre: first <= last. @param x Array whose largest value is found @param start First subscript in range @param last Last subscript in range @return The largest value of x[start] through x[last] */ int...
Words: 463 - Pages: 2
...2. A club has 25 members. A.) a) How many ways are there to choose four members of the club to serve on an executive committee? 12650 B.) b) How many ways are there to choose a president, vice president, secretary, and treasurer of the club, where no person can hold more than one office? 303600 4. In how many different ways can five elements be selected in order from a set with three elements when repetition is allowed? 243 5. What is the probability that a fair die never comes up an even number when it is rolled six times? 0.016+- 0.001 (Note: Enter the value of probability in decimal format and round it to three decimal places.) 6. Let p and q be the propositions p: You have the flu. q: You miss the final examination. Identify an English translation that expresses the compound proposition p → q. * If you miss the final exam then you have the flu. * If you have the flu, then you miss the final exam. * If you have the flu, then you will not miss the final exam. * If you don't have the flu, then you miss the final exam. 7. Let q and r be the propositions q: You miss the final examination. r: You pass the course. An English translation of the compound proposition ¬q ↔ r is "You do not miss the final exam if and only if you pass the course." * Yes * No 8. Let q and r be the propositions q: You miss the final examination. r: You pass the course. An English translation of the compound proposition q → ¬r is "If you miss the final exam, then you pass the course...
Words: 3659 - Pages: 15
...systems in which there is change and a way to deduce the predictions of such models; Calculus provides a way for us to construct relatively simple quantitative models of change and to deduce their consequence. By studying this, you can learn how to control the system to do make it do what you want it to do. CHAPTER 1: FUNCTIONS AND LIMITS FUNCTIONS * A bunch of ordered pairs of things with property that the first members of the pairs are all different from one another. Ex [ {1,1,}, {2,1}, {3,2} ] Arguments – first number of the pair Domain – whole set Values – Second number of the pair Range – set of values Classification of functions 1. Linear Functions – “steepness of the line” w/c can go uphill or downhill. y = mx + b 2. Quadratic Functions – it has a degree and forms a parabolic path. The highest (or lowest point) of the parabola is called the vertex. At has a form of (standard form of quadratic equation) F(x) = Ax2 + Bx + C where A, B,C are constant. Vertex form of Quadratic F(x) = a (x-h)2 + K Quadratic Formula 3. Polynomial Functions – a quadratic, a cubic, a quartic and so on involving only non-negative...
Words: 349 - Pages: 2
...2009 ! Module 1: Functions 1 1.1 Objectives: In this module: We introduce with examples, the concept of a function and study some classes of functions. We discuss methods of nding the domain, range, zeros and singularities of some real-valued functions. We look at injective (one to one) and surjective (onto) functions and end the module by exploring the inverse of a function and the composition of functions. We stimulate students through classroom and other interactive activities to understand the concept of a function and then discover the di erences and similarities between the several types of functions introduced. 2 1.2 Learning Outcomes: At the end of this module students should be able to De ne a function; identify di erent types of functions and Identify relations which are not functions; Identify di erent classes of functions, nd the domain and range that makes a rule f (say), a function; Investigate the injectiveness, surjectiveness and the inverse of di erent functions; Establish the composition of two or more functions. 3 1.3 Learning Activities: Students should: 1 Explore notes and exercises, individually and in groups; Explore and use related materials on the Intranet, especially the e-granary and MIT open course ware; Explore and use related materials on the OLI Calculus course on the Internet(http://www.cmu.edu/OLI/courses/); Solve relevant questions from past MTH103 Examinations. 4 1.4 Introduction A function is the means by...
Words: 18670 - Pages: 75
...MCR 3U Exam Review Unit 1 1. Evaluate each of the following. a) b) c) 2. Simplify. Express each answer with positive exponents. a) b) c) 3. Simplify and state restrictions a) b) c) d) 4. Is Justify your response. 5. Is Justify your response. Unit 2 1. Simplify each of the following. a) b) c) 2. Solve. a) b) c) 3. Solve. Express solutions in simplest radical form. a) b) 4. Find the maximum or minimum value of the function and the value of x when it occurs. a) b) 5. Write a quadratic equation, in standard form, with the roots a) and and that passes through the point (3, 1). b) and and that passes through the point (-1, 4). 6. The sum of two numbers is 20. What is the least possible sum of their squares? 7. Two numbers have a sum of 22 and their product is 103. What are the numbers ,in simplest radical form. Unit 3 1. Determine which of the following equations represent functions. Explain. Include a graph. a) b) c) d) 2. State the domain and range for each relation in question 1. 3. If and , determine the following: a) b) 4. Let . Determine the values of x for which a) b) Recall the base graphs. 5. Graph . State the domain and range. Describe...
Words: 940 - Pages: 4
...Jump to: navigation, search This article is about the branch of mathematics. For other uses, see Calculus (disambiguation). | It has been suggested that Infinitesimal calculus be merged into this article or section. (Discuss) Proposed since May 2011. | Topics in Calculus | Fundamental theorem Limits of functions Continuity Mean value theorem [show]Differential calculus | Derivative Change of variables Implicit differentiation Taylor's theorem Related rates Rules and identities:Power rule, Product rule, Quotient rule, Chain rule | [show]Integral calculus | IntegralLists of integrals Improper integrals Integration by: parts, disks, cylindrical shells, substitution, trigonometric substitution, partial fractions, changing order | [show]Vector calculus | Gradient Divergence Curl Laplacian Gradient theorem Green's theorem Stokes' theorem Divergence theorem | [show]Multivariable calculus | Matrix calculus Partial derivative Multiple integral Line integral Surface integral Volume integral Jacobian | | Calculus (Latin, calculus, a small stone used for counting) is a branch of mathematics focused on limits, functions, derivatives, integrals, and infinite series. This subject constitutes a major part of modern mathematics education. It has two major branches, differential calculus and integral calculus, which are related by the fundamental theorem of calculus. Calculus is the study of change,[1] in the same way that geometry is...
Words: 6472 - Pages: 26
... * Patriots – Tom Brady * Rams – Joe Namath * Chiefs – Joe Montana 1. Using D as the domain and Q as the range, show the relation between the 2 sets, with the correspondences based on which players are on which team. Show the relation in the following forms: Set of ordered pairs (20 points) Directional graph (like the pictures draw in class in our live chats – see HINT below). (20 points) The ordered pairs when D is the domain are: {(Jets,Joe Namath),(Giants,Eli Manning),(Cowboys, Troy Aikman),(49ers,Joe Montana),(Patriots,Tom Brady),(Rams,Joe Namath),(Chiefs, Joe Montana)} 2. Is the relation a function? Explain. (10 points) This is a function, because every element (Quarterback) of the domain is mapped to exactly one unique element (Team) of the range. So with the one to one relation of player to team, that makes this a function. 3. Now, use set Q as the domain, and set D as the range (reverse). Show the relation in the following forms: Set of ordered pairs (20 points) Directional graph (20 points) The ordered pairs when Q is the domain are: {(Joe Namath, Jets),(Eli Manning, Giants),( Troy Aikman, Cowboys),( Joe Montana,49ers,),(Tom Brady, Patriots),(Joe Namath, Rams),(Joe...
Words: 580 - Pages: 3
...1. Identify the graph that represents the system of linear equations. [pic] |A. |[pic] |C. |[pic] | | | | | | |B. |[pic] |D. |[pic] | 2. The graph below shows the cost (c), in dollars, to rent a boat for h hours at two different boat companies. [pic] At what number of hours will the cost to rent a boat be the same at both companies? F. 4 G. 5 H. 8 J. 20 3. John and Patrice are each saving money to buy a car. John has $750 saved and will save an additional $30 a week. Patrice has $1,200 saved and will save an additional $20 a week. How many weeks will it take John and Patrice to save the same amount of money? A. 39 weeks B. 40 weeks C. 45 weeks D. 55 weeks 4. Choose the equation wherein you would isolate a variable easily so that substitution method can be used to solve the linear system. [pic] F. Equation 1 G. Equation 2 H. Neither Equation 1 nor Equation 2 J. Both Equation 1 and Equation 2 5. Solve the linear system. [pic] A. (5, 7) B. (5, 8) C. (6, 7) D. (6, 8) 6. Which of the following ordered pairs satisfies the linear system? [pic] F. (-11, - 5) G. (-11, 5) H. (-5,...
Words: 1338 - Pages: 6
... a.|-7/2| b.|-6| c.|6| d.|12/15| ____ 2. Which property best describe the following statement? a.|distributive property| b.|associative property| c.|transitive property| d.|commutative property| ____ 3. Simplify a.||c.|| b.||d.|| ____ 4. Which graph below represents a function? a.||c.|| b.||d.|| ____ 5. What is the domain of the given function? a.| |c.|| b.||d.|| ____ 6. Use the distributive property to simplify the expression: . a.|| b.|| c.|| d.|| ____ 7. Which of the following is not a function? a.||c.|| b.||d.|| ____ 8. Choose the correct algebraic translation of “ 3 more than twice a number is three times the sum of the number and 5”. a.|| b.|| c.|| d.|| ____ 9. Which statement illustrate the symmetric property? a.|| b.|If 3 + 2 = 5 and 5 = 4 + 1 thenn 3 + 2 = 4 + 1| c.|If 3 + 2 = 5 then 5 = 3 + 2| d.|3 + 2 = 5| ____ 10. Translate the verbal phrase below into its mathematical representation. “ Six decreased by three times the sum of two and four times a number is one.” a.|6 - 3 + 2 + 4n = 1| b.|6 - 3 2 + 4n = 1| c.|3(2 + 4n) -6 =1 | d.|6 - 3(2 + 4n) = 1| ____ 11. Simplify a.|| b.|| c.|| d.|| ____ 12. A function, has a domain of {-6, -2, 3}. What is its range? a.|{-12, -8, 4}| b.|{-42, -22, 3}| c.|{-8, -6, 12}| d.|{-10...
Words: 660 - Pages: 3
...teaching capabilities. This system will help the faculty so that each subject can be assigned efficiently without the tedious manual assigning system. The Teaching Assignment System requires an online system with a database keeping the subjects and the trimester’s information; the online system needs to have * User friendliness for computer illegitimate * Easy to maintain by system administrators. Target User The main target user for this Teaching Assignment System will be the lecturer, dean or the faculty. This system can be very useful for: a. Faculty for designing new subjects based on associated trimester. b. Lecturers who would like to add in information on subjects that they prefer to teach for a particular semester. c. Dean who would like to analyze or view in detail about the trimester or subjects being thought to track semester progress. Plan Milestone Gant chart Literature Review Users 1. Lecturer : They are able to view the subjects for that semester and subjects that have been assigned to them. They will be able to update their preferences and the history of the subject that has been taught by them and also add in some remarks if needed. 2. Committee: The committee will be able to assign the coordinators for the subjects being thought for that semester. The committee board will also be able...
Words: 2436 - Pages: 10
...Im(z) = (z - ) When z is real, z = x then z = Polar Form of Complex Numbers Let (x,y) be the Cartesian coordinates and (r,Ө) be the polar coordinates,then x = r cos Ө , y = r sin Ө Therefore, z = x+iy = r (cos Ө+ isin Ө) r = which is the absolute value or the modulus of z. Ө = arg z = tan which is the argument of z. Important Properties Generalized Triangle Inequality : Let Then, De Moivre’s formula : Nth Root of z : Limit, Continuity and Derivatives of Function of Complex variable: Limit : Let the function of a complex variable : w = f(z) = f(z+iy) = u(x,y)+iv(x,y). A function f(z) has a limit l at if exists. Continuity : A function f(z) has a continuity at z0 , if f(z0) is defined and Derivative : A function f(z) is differentiable at z0 , if exists. Moreover, f(z) has a derivative at z0. If the function is...
Words: 1261 - Pages: 6
...Practical 5: Simple functions 1. Write one program to accept two input values x and y and find the values of the following: (a) [pic] (b) [pic][pic] (c) [pic] (d) [pic] (e) [pic] (NOTE: log10(x) function is used to calculate log10x) #include #include int main() { int x,y ; double a,b,c,d,e; printf("Enter 2 integer :\t"); scanf("%d%d",&x,&y); //calculation a=sqrt(x*y); b=(sqrt(x))*(sqrt(y)); c=pow(x,y); d=pow(y,x); e=log10(pow(x,y)); printf("%lf\n",a); printf("%lf\n",b); printf("%lf\n",c); printf("%lf\n",d); printf("%lf\n",e); return 0; } 2. Write a program that prompts the user for the Cartesian coordinates to two points [pic]and [pic] and display the distance between them computed using the following formula: distance = [pic] #include #include int main() { int x1,x2,y1,y2 ; double dis ; printf("Enter 4 integer :\t"); scanf("%d%d%d%d",&x1,&x2,&y1,&y2); //calculation dis=sqrt(pow(x1-x2,2))+(pow(y1-y2,2)); printf("The distance is %.2lf\n",dis); return 0; } 3. Write a program to compute and display the absolute difference of two type double variables, x and y (that is | x - y |). #include #include int main () { double x...
Words: 413 - Pages: 2
...πr³ 900 = πr²(h + 2/3r) 900/ πr² = h + 2/3r (900/ πr²) – 2/3r = h Cost in terms of r : C(r) = 0.05(2 πrh + πr²) + 0.10(2 πr²) = 0.1 πrh + 0.05 πr² +0.2 πr² = 0.1 πr(900/ πr² - 2r/3) + 0.25 πr² *insert h = 90 πr/ πr² - 0.2 πr²/3 + 0.25 πr² = 90/r + 1.1 πr²/6 C’(r) = -90/r² + 1.1 πr/3 * take derivative 0 = -90/r² + 1.1 πr/3 * set derivative equal to zero r²(0) = (-90/r² + 1.1 πr/3) r² *multiply both sides by r² 0 = -90r²/r² + 1.1 πr³/3 = -90 + 1.1 πr³/3 r = (90/1.1 π)^1/3 r ≈ 4.27cm Therefore, the radius is approximately 4.27cm Double derivative Check: C’’(r) = 1.1 πr² C’’(4.27) = +ve Therefore it is a minimum Finding height: h = 900/ π(4.27)² - 2/3(4.27)*plug the radius into the height equation h = 12.87 Therefore the height is 12.87cm Dimensions and Cost: * r = 4.27cm * h = 12.87 cm * V = 900 cm³ * Lid Plastic: ¢0.10/cm² * Cup Plastic: ¢0.05/cm² Demand function: X = 100,000 -5,000n n = 100,000 – x/5,000 *Isolate for n variable P = 0.99 + 0.10n P(x) = 0.99 + 0.10(100,000 – x/5,000) *plug in n value = 0.99 + 2 – 0.00002x = 2.99 – 0.00002x X = # of $0.10 increases Revenue Function: R(x) = xp(x) R(x) = 2.99x – 0.00002x² R’(x) = 2.99 – 0.00004x Cost Function: C = -0.0000004x² + 0.316x + 2000 C’ = -0.0000008x² + 0.316 Profit Function: P = (2.99x – 0.00002x²) – (-0.0000004x² + 0.316x + 2000) = -0.0000196x² + 2.674x – 2000 P’...
Words: 355 - Pages: 2
...Name: Bekenov Kuandyk Assignment 1 1. Prove that fx=2x+5 is one-to-one function. (10 points) Let make an assumption tha fx1=fx2t and then prove that x1=x2. fx1=fx2=2x1+5=2x2+5→x1=x2 , Then fx=2x+5 is one-to-one function 2. B B A A Let f: A→B, as given below. Is f a one-to-one function? Please explain why or why not. (10 points) f f 5 5 5 5 1 1 3 3 1 1 6 6 2 2 2 2 4 4 6 6 7 7 4 4 8 8 3 3 F is not one-to-one function, because f(1)=1 and f(2)=1. 3. The modulo function (a mod n or a modulo n) maps every positive integer number to the remainder of the division of a/n. For example, the expression 22 mod 5 would evaluate to 2 since 22 divided by 5 is 4 with a remainder of 2. The expression 10 mod 5 would resolve to 0 since 10 is divisible by 5 and there is not a remainder. a. If n is fixed as 5, is this function one-to-one? (5 points) F(n mod 5) is not one-to-one function, because f(n mod 5)= between 0 and 4. It means that we have the same image of F for different n (integer). b. List five numbers that have the exact same image. (5 points) 12, 17, 22, 27, 32 4. Find limn→∞n2-1n3+n (6 points) limn→∞n2-1n3+n=limn→∞n2n3-1n3n3n3+nn3=0-01+0=0 5. Find limx→∞x1001-xx1000+x (6 points) limx→∞x1001-xx1000+x=limx→∞1-1x10001x+1x1000=1-00+0=∞ 6. Find limx→∞8x6+4x4-3x2x6+x5-7 (6 points) limx→∞8x6+4x4-3x2x6+x5-7=limx→∞8+4x2-3x52+1x-7x6=8+0-02+0-0=4 ...
Words: 746 - Pages: 3
...Basics Rounding to Decimal Places If the next number is below 5, round down by leaving thr previous digit untouched. Round 15.283 correct to 2 decimal places. The answer is 15.28 If the next number is 5 or more, round up Round 3.728 correct to 2 decimal places. The answer is 3.73 Rounding to significant figures For numbers between 0 and 1, start counting the significant figures from the first non-zero digit. Round 0.007851 correct to 2 significant figures. The answer is 0.0079 For numbers larger than 1, start counting the significant figures from the first digit. Round 583 200 correct to 2 significant figures. The answer is 580 000 Scientific notation. 13450700 in scientific notation is 1.34507 10 0.00125 in scientific notation is 1.25 10 7 3 Addition Sum Subtraction Difference Multiplication * : / Product Division Quotient Numbers Real Numbers Rational Numbers Irrational Numbers Definition of a rational number. are not rational. They are non-terminating & non-recurring decimals. A number is rational if it can be expressed as a fraction in p the form q ,where p & q have no common factor and q 0. Examples 2 8 Fractions, e.g. 3 , 17 Integers, e.g. 2 , 3, 15 Terminating decimals, e.g. 0.3562 Recurring decimals, e.g. 0.4 , 0.23, 0.17 Examples , e. Surds, e.g. 2 , 3 5 . Transcendental numbers, e.g. 0.100100010000100.... Recurring...
Words: 8924 - Pages: 36