140 likes | 264 Vues
This chapter delves into the implementation of mathematical functions in programming, taking examples from geometry to illustrate key concepts. It covers the calculation of areas and circumferences of circles and the computation of the rim area of a flat washer. The chapter includes detailed figures to aid understanding, such as the square root function as a "black box" and formulas for calculating unknown sides of triangles. These mathematical principles are essential for developing problem-solving skills and designing programs, particularly in C programming.
E N D
Chapter 3:Math Functions Adapted from Problem Solving & Program Design in C Sixth Edition By Jeri R. Hanly & Elliot B. Koffman
Figure 3.3 Calculating the Area and the Circumference of a Circle
Figure 3.3 Calculating the Area and the Circumference of a Circle (cont’d)
Example Formula to calculate unknown side “a” of a triangle a2=b2 + c2 – 2bc cosα
Triangle with Unknown Side a After defining a, b, c, PI and alpha a = sqrt(pow(b,2) + pow (c,2) – 2*b*c* cos (alpha*PI /180.0));