Question
A mathematical relationship between x and y is described by the following expressions: y=a*exp(x^3)-b*x^2+x-c if x
A mathematical relationship between x and y is described by the following expressions: y=a*exp(x^3)-b*x^2+x-c if x<-1 (Case 1) y=2*log(x)-(a*x-1)^3+c^2 if -1<=x<5 (Case 2) y=a*exp(-x^2)/log(x)+b/x^2-c if x>=5 (Case 3) where a, b, and c are constants. Write a program that inputs the constants a, b, c, and the argument x, and print the corresponding value of y by calling the appropriate function to evaluate y. Print x by using 3 decimal places, and y by using 4 decimal places. Use if/else statements to choose the proper expression for y, corresponding to selected x. Your program should use a while loop to evaluate y for scanned x in each of the above three cases. If you input x from the same interval more than twice, your program should ask you to input x from another interval, until you input x twice from each interval. Your output should look like: Enter a, b, c: -1.5 2.5 0.125 Enter x: -3.5 Case 1 x value is = -3.500 and y value is = . Enter x: -5 Case 1 x value is = -5.000 and y value is = .. Enter x: -7 Enter x from another interval! Enter x: 1.85 Case 2 x value is = 1.850 and y value is = . Etc.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started