Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Develop a computer program to find the root of the following function: P = ( - m + 4 ) e - 0 . 5
Develop a computer program to find the root of the following function:
P mem
using the following three methods:
a Bisection initial guesses of ml and mu
b NewtonRaphson initial guess of m
c Secant initial guesses of m and m
Perform iterations until the approximate percent relative error falls below For this problem, it is Mandatory to use MatLab. However, you are not allowed to use any builtin functions in MatLab that are not available in the other compilers. Function definition
P @mm exp m;
Bisection method
ml ;
mu ;
maxiterations ;
tolerance ; as a decimal
for i :maxiterations
fm Pml;
fu Pmu;
m ml mu;
fp Pm;
Check for convergence
if absfp tolerance
break;
end
Update interval
if fm fp
mu m;
else
ml m;
end
end
fprintfBisection Method: Root f Iterations d
m i;
NewtonRaphson method
m;
for i :maxiterations
f Pm;
fprime Pm Pm; Numerical derivative
m m f fprime;
Check for convergence
if absm m m tolerance
break;
end
m m;
end
fprintfNewtonRaphson Method: Root f Iterations d
m i;
Secant method
mminus;
msecant ;
for i :maxiterations
fminus Pmminus;
fsecant Pmsecant;
msecant msecant fsecant msecant mminusfsecant fminus;
Check for convergence
if absmsecant msecant msecant tolerance
break;
end
mminus msecant;
msecant msecant;
end ANS: fprintfSecant Method: Root f Iterations d
msecant, i;
Bisection Method: Root Iterations
NewtonRaphson Method: Root Iterations
Secant Method: Root Iterations as last expert gave me the code and when i performed it is showing that iterations in bisection and soon for other methods. but his sample results is just showing iterations. so can i get a proper solution that how many iterations will be required and allong with the answers of all the iterations.
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