3. The function f (x) = ln(x) is defıned over the real numbers (R1) for x E (0, oo) (though MATLAB will report ln(0) as -Inf)

3. The function f (x) = ln(x) is defıned over the real numbers (R1) for x E (0, oo) (though MATLAB will report ln(0) as -Inf). Use an if selection structure to check if the inputted value of x is in the domain of f(x) according to these three cases: Case 1: If the inputted is not in the domain of f(x) (i.e. if x E (-o,0), use the error command to print an error message to the Command Window. Case 2: If the inputted is on the domain (0, 1), to print a warning to the Command Window stating that the value of f(x)wil use the warning command be less than 0. Case 3: If the inputted x is in the domain |1, oo) then calculate and print to the Command Window the value of f(x). Hint: What are the branches in this selection structure? Identify them first, then begin to program the cases. NB: The symbol E is a mathematical symbol that can be interpreted in English as “is an element of.” For example, if E [0, 5 then x is defined within (or “belongs to”) that range of numbers. You will likely recall from calculus that parentheses indicate a specific interval does not include the end-point (a so- called “open interval”), while brackets indicate that the interval does include the end point (a so-called “closed interval”) 4. Create a flowchart, and write pseudocode for, the prompt in Problem 3.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *