Project
Project
Project
Purpose:
This assignment is to teach you how we can set up computers to solve math problems for us by just using
what you have studied in this subject and of course some programming knowledge as well.
What to do:
Write a program that keeps on taking input values from the user until user enters “end” and on each input
it tells if the input value lies in the Domain of the function f(x) = (x - 1) / sqrt (x^2 - 2) and also display the
Range of that Domain. Each input is the Domain to be checked, for example, we have input 3, the program
then checks if this input lies in the Domain of the above function which indeed it does as f(3) = (3 – 1) /
sqrt(3^2 - 2) gives the output of 0.755929 which is the Range of the given input, now display it on the
console output. If the input does not lie in the Domain of the function the program should display the
message saying that it is not in the Domain and continue asking for another input. The program end when
the user inputs the string “end”.
Sample output:
Domain: Possible inputs that can be accepted by the function in order for it to solve the equation and
get the solution.
Range: The number of solutions that are generated by the function using the Domain.
Break down the problem into smaller problems and solve each problem individually. Then combine those
smaller solutions to solve the bigger problem. To help you out in this process I have divided the program
into steps:
1. Take input.
2. If input is “end” then end the program.
3. Consider/Convert the input as the Domain to be checked.
4. Put the domain in the function.
5. If the result is not infinity or NaN.
6. Print the result as the range.
7. If not then display error message.
https://en.cppreference.com/w/cpp/numeric/math/isfinite