a.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, sqrt(4.0).
Solution:
The function, sqrt(4.0), will evaluate to 2. The sqrt function will perform the square root of the number which is passed in the function parameter. It is a library function belonging to the header, cmath.
b.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, sin(2*PI).
Solution:
The function, sin(2*PI) , evaluates to 0. The sin function returns the final value of the sine of the angle which is passed in the parameter. It is a library function belonging to the header, cmath. It returns the sine of angle in radians.
c.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, cos(2*PI).
Solution:
The function, cos(2*PI), evaluates to 1. The cosine function returns the final value of the cosine of the angle which is passed in the parameter. It is a library function belonging to the header, cmath. It returns the cosine of angle in radians.
d.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, pow(2.0, 2).
Solution:
The function, pow(2.0, 2), will return the value 4. It computes the base number which is raised to the power of the exponent number. It is a library function belonging to the header, cmath. It follows the syntax pow(base, exponent).
e.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, log(E).
Solution:
The function, log(E), will evaluate to 1. It returns the natural logarithmic value of the argument which is passed as the parameter. The parameters can belong to any data type, like int, float, double or long-double.
f.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, exp(1.0).
Solution:
The function, exp(1.0), will return the value 2. It returns the exponential, e, which is raised to the argument that is given. It is a library function belonging to the header, cmath.
g.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, max(2, min(3, 4)).
Solution:
The function, max(2, min(3,4)), will return the value 3. The min function returns the minimum of the parameters passed to the function. Whereas, the max function returns the maximum of the parameters passed. In the given condition, first the inner bracket will evaluate, so the min(3,4) will be 3. Then, the outer bracket will evaluate, so the max(2,3) will be 3. Thereby, making the final result to be 3.
h.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, sqrt(125.0).
Solution:
The function, sqrt(125.0), will evaluate to 11. The sqrt function is the function which helps in finding the square root of the parameter which is passed to the function. It is a library function belonging to the header, cmath.
i.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, ceil(-2.5).
Solution:
The function, ceil(-2.5), will return the value -2.0. It returns the smallest possible value which has to be either greater than or equal to the passed argument. It is a library function belonging to the header, cmath.
j.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, floor(-2.5).
Solution:
The function, floor(-2.5), will return the value -3.0. It will return the largest possible value which has to be either equal to or less than the passed argument. It is a library function belonging to the header, cmath.
k.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, asin(0.5).
Solution:
The function, asin(0.5), will return the value 0.52359. It returns the inverse of the sine of the angle which is passed as the parameter. It returns the value of the angle in radians. It is a library function belonging to the header, cmath.
l.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, acos(0.5).
Solution:
The function, acos(0.5), will return the value 1.04719. It returns the inverse of the cosine of the angle which is passed as the parameter. It returns the value of the angle in radians. It is a library function belonging to the header, cmath.
m.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, atan(1.0).
Solution:
The function, atan(1.0), will return the value 0.785398. It returns the inverse of the tangent of the angle which is passed as the parameter. It returns the value of the angle in radians. It is a library function belonging to the header, cmath.
n.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, ceil(2.5).
Solution:
The function, ceil(2.5), will return the value 3.0. It returns the smallest possible value which has to be either greater than or equal to the passed argument. It is a library function belonging to the header, cmath.
o.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, floor(2.5).
Solution:
The function floor, (2.5), will return the value 2.0. It will return the largest possible value which has to be either lesser than or equal to the passed argument. It is a library function belonging to the header, cmath.
p.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, log10(10.0).
Solution:
The function, log10(10.0), will return the value of 1. It returns the common base 10 logarithmic value of the argument which is passed inside. It is a library function belonging to the header, cmath.
q.
Explanation of Solution
Given: The value of PI is 3.14159 and E has the value 2.71828.
To find:Â That what will be the result of the function, pow(2.0, 3).
Solution:
The function, pow(2.0, 3), will return the value 8.0. It computes the base number which is raised to the power of the exponent number. It is a library function belonging to the header, cmath. It follows the syntax, pow(base, exponent).
Want to see more full solutions like this?
Chapter 4 Solutions
Introduction to Programming with C++
- python code Problem 7 Define a function named z and have it take 3 arguments: score , mu (sample mean) , sigma (standard deviation).. Return the calculated z-score. Use your z function on this data to show it works: You have a test score of 190. The test has a mean (μ) of 150 and a standard deviation (σ) of 25. Now define a function named std_error and have it take 2 arguments: sigma (standard deviation) , and n. Return the calculated standard error Use your std_error function (you can assume a sample size of 10) Print the answer rounded to the 2nd decimal place. (you can look up these formulas online)arrow_forwardQ1 Computer Science Write a R function f(x,y,z) to generate the following results: >f(“I am”, “a”, “NJIT student”) >I am a NJIT student Plz do not copy past before solution is incorrectarrow_forwardNumbers can be regarded as product of its factors. For example,8 = 2 x 2 x 2; = 2 x 4.Write a function that takes an integer nand return all possible combinations of its factors.Note:You may assume that n is always positive.Factors should be greater than 1 and less than n.Examples:input: 1output:[]input: 37output:[]input: 12output:[ [2, 6], [2, 2, 3], [3, 4]]input: 32output:[ [2, 16], [2, 2, 8], [2, 2, 2, 4], [2, 2, 2, 2, 2], [2, 4, 4], [4, 8]].arrow_forward
- Write a function that implements the quadratic equation. Given three inputs (a, b, and c), calculate the roots (r1 (+) and r2 (-)) of the quadratic formula. Review 19 Write a function that implements the quadratic equation. Given three inputs (a, b, and c), calculate the roots (r1 and r2) of the quadratic formula. Call your function Roots a = 1 b = 2 c = -3 [r1,r2]=Roots(a,b,c)arrow_forwardGiven the following function definition 2. If we change the statement calc (x, y); to calc(1,2) in the code segment, explain why the statement calc(1, 2); would be an error.arrow_forwardWrite pseudo code for a function to draw a regular N-gon. Arguments for the function are location (x,y) and radius r.arrow_forward
- Let A = {a, b, c}, B = {x, y}, and C = {0, 1}.arrow_forwardc language Write a function which takes an integer and returns 1 if there are an odd number of ‘1’ bits 0 if there are an even number of ‘1’ bits Example, of x is 1010 in binary, it should return 0 because there are two 1's. 1110 should return 1 because there are three 1'sarrow_forwardGiven a time in 24-hour notation, write a function that adds 2 times, a function that substracts 2 times, and a function that displays the time in 12-hour notation. (C++)arrow_forward
- Given an integer, , print the following values for each integer from to : Decimal Octal Hexadecimal (capitalized) Binary Function Description Complete the print_formatted function in the editor below. print_formatted has the following parameters: int number: the maximum value to print Prints The four values must be printed on a single line in the order specified above for each from to . Each value should be space-padded to match the width of the binary value of and the values should be separated by a single space. Input Format A single integer denoting . Constraints Sample Input 17 Sample Output 1 1 1 1 2 2 2 10 3 3 3 11 4 4 4 100 5 5 5 101 6 6 6 110 7 7 7 111 8 10 8 1000 9 11 9 1001 10 12 A 1010 11 13 B 1011 12 14 C 1100 13 15 D 1101 14 16 E 1110 15 17 F 1111 16 20 10 10000 17 21 11 10001arrow_forwardPyton.Write a function absolute(x) that prints the absolute value of xarrow_forwardPRogram - python Define a function named z and have it take 3 arguments: score , mu (sample mean) , sigma (standard deviation).. Return the calculated z-score. Use your z function on this data to show it works: You have a test score of 190. The test has a mean (μ) of 150 and a standard deviation (σ) of 25. Now define a function named std_error and have it take 2 arguments: sigma (standard deviation) , and n. Return the calculated standard error Use your std_error function (you can assume a sample size of 10) Print the answer rounded to the 2nd decimal place. (you can look up these formulas online) Zscore formula https://www.simplypsychology.org/z-score.html#:~:text=How%20do%20you%20calculate%20the,by%20the%20population%20standard%20deviation. Standard error formula https://toptipbio.com/standard-error-formula/ https://www.statisticshowto.com/probability-and-statistics/z-score/arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr