Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a. Modify the m file as follows: - You will still prompt the user for a number and for the desired number of iterations -
a. Modify the m file as follows: - You will still prompt the user for a number and for the desired number of iterations - Check the inputs and select the correct Taylor series for the input given (you may have already done this for the previous homework section). - Modify your check for invalid inputs - now the only invalid inputs are x values that are less than or equal to 0. - Modify your fprintf statement to display the original number, x, entered by the user and the estimate of the ln(x) with 8 places behind the decimal point. b. Now run the script to complete the following table. %ln(x) for numbers 0 to 2 \% The script will prompt the user for the value % of x and the number of terms to use and display the resulting % approximation, the actual value of ln(x) (using log(x) ), and the error. % \% get values from user x = input("Please enter the value of x: "); N = input("Please enter the number of terms: "); % compute actual value of exponential actual=log(x) \% Taylor Series for when x>2 not in this script! % taylor_series_ x=log(1/x) \% compute Taylor series expansion taylor_series =0; tolerance =0.01; % while abs(taylor_series - actual)>tolerance for k=1:N1 \% Taylor series for the range 2 not in this script! % taylor_series_ x=log(1/x) \% compute Taylor series expansion taylor_series =0; tolerance =0.01; % while abs(taylor_series - actual)>tolerance for k=1:N1 \% Taylor series for the range
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