Question Number 175785 by otchereabdullai@gmail.com last updated on 06/Sep/22
Commented by Ar Brandon last updated on 07/Sep/22
#include <stdio.h>
#include <math.h>
int main(void)
{
double fx, gx, xn, x_m;
printf("Enter initial value:");
scanf("%lf", &xn);
for(int i=0; i<100; i++)
{
fx = pow(xn, log(2)/log(3))-sqrt(xn)-1;
gx = log(2)/log(3)*pow(xn,log(2)/log(3)-1)
-0.5/sqrt(xn);
x_m = xn - fx / gx;
xn = x_m;
}
printf("x ≈ %.2f\n", xn);
return 0;
}
Commented by Ar Brandon last updated on 07/Sep/22
$${x}=\mathrm{9} \\ $$$$\mathrm{Newton}-\mathrm{Raphson}'\mathrm{s}\:\mathrm{method}\:\mathrm{with}\:\mathrm{initial} \\ $$$$\:\mathrm{value}\:{x}_{\mathrm{0}} =\mathrm{1}\:\mathrm{and}\:\mathrm{100}\:\mathrm{repetitions}. \\ $$
Commented by Frix last updated on 07/Sep/22
$$\mathrm{this}\:\mathrm{is}\:\mathrm{again}\:\mathrm{no}\:\mathrm{math}\:\mathrm{example}\:\mathrm{but}\:\mathrm{a}\:\mathrm{magic} \\ $$$$\mathrm{trick}\:\mathrm{example}.\:\mathrm{obviously}\:\left(\mathrm{at}\:\mathrm{least}\:\mathrm{for}\:\mathrm{me}\right) \\ $$$${x}=\mathrm{9}.\:\mathrm{but}\:\mathrm{no}\:\mathrm{exact}\:\mathrm{method}\:\mathrm{is}\:\mathrm{possible}.\:\mathrm{or} \\ $$$$\mathrm{else}\:\mathrm{try} \\ $$$${x}^{\mathrm{log}_{\mathrm{2}} \:\mathrm{3}} =\sqrt{{x}}+\mathrm{1} \\ $$
Answered by Ar Brandon last updated on 07/Sep/22
Answered by LordKazuma last updated on 07/Sep/22
$${x}^{{log}_{\mathrm{3}} \mathrm{2}} \:=\:\sqrt{{x}}\:\:+\:\mathrm{1} \\ $$$${let}\:{x}\:=\:\mathrm{3}^{{t}} \:\Rightarrow\:\sqrt{{x}}\:=\:\mathrm{3}^{\frac{{t}}{\mathrm{2}}} \\ $$$$\mathrm{3}^{{t}\:\centerdot\:{log}_{\mathrm{3}} \mathrm{2}} \:=\:\mathrm{3}^{\frac{{t}}{\mathrm{2}}} \:+\:\mathrm{1} \\ $$$$\mathrm{3}^{{log}_{\mathrm{3}} \mathrm{2}^{{t}} } \:=\:\mathrm{3}^{\frac{{t}}{\mathrm{2}}} \:+\:\mathrm{1} \\ $$$$\mathrm{2}^{{t}} \:=\:\mathrm{3}^{\frac{{t}}{\mathrm{2}}} \:+\:\mathrm{1} \\ $$$$\mathrm{the}\:\mathrm{value}\:\mathrm{of}\:{t}\:\mathrm{that}\:\mathrm{statisfies}\:\mathrm{this}\:\mathrm{equation}\:\mathrm{only} \\ $$$${t}\:=\:\mathrm{2}\:\Rightarrow\:{x}\:=\:\mathrm{3}^{{t}} \:\Rightarrow\:{x}\:=\:\mathrm{9}\: \\ $$
Commented by LordKazuma last updated on 07/Sep/22
$$ \\ $$