secant method in maple. Find a root of the statement $x^3-3x^2+4x-1=0$ with the initial value $x_0=0$ and $x_1=1$ with 5 digits point approximation.
- 67
-
Not sure what you mean by "tendinous," here, because I can't imagine why a method in maple would have the nature of a tendon. Thought you might mean "tendentious," but still one would wonder what the method has to do with the question. Hopefully it isn't critical to the question. (Maybe I've misunderstood.) – rschwieb May 28 '13 at 16:44
-
ino belakhare khodam neveshtamesh! moshkelam to yeki az halghehaye if bood. – only math May 28 '13 at 18:57
-
soale newton ro javab dadan inja manam belakhare moshkelesho hal kardam faghat javabe akharesho ebarato sae nemikone! mesle javabie ke inja ham gozashtan – only math May 28 '13 at 18:59
-
ino manam ye javab neveshtam vasash alan ferestadam vali nemidoonam chera enghad darham omade! – only math May 28 '13 at 19:14
-
@faranak50 oonyekiam didam javabesho moshkelam kolan hal shod faghat mikham yekari konam javabe akharo bad az sade kardan bede! :D – only math May 28 '13 at 19:14
-
in ta 5 ragham khaste ke hal shod. newton ro mikham sade konam ke chan jomle ee aslie bedas biad. ye marhale kam dare alan – only math May 28 '13 at 19:23
2 Answers
If this is homework and you're supposed to program it yourself then you could show what you've accomplished on your own already.
If you just want to see answers from such an algorithm then you could use the Student:-NumericalAnalysis command. Eg,
[Student:-NumericalAnalysis:-Secant(x^3-3*x^2+4*x-1,x=[0,1],
tolerance=1e-5,
maxiterations=50)]:
evalf[5](%)[];
0.31767
[Student:-NumericalAnalysis:-Secant(x^3-3*x^2+4*x-1,x=[0,1],
tolerance=1e-5,
output=sequence,
maxiterations=50)]:
evalf[5](%)[];
0., 1., 0.50000, 0.20000, 0.33624, 0.31947, 0.31764, 0.31767, 0.31767
Programming questions about Maple are better asked on stackoverflow, unless it is the mathematics behind the algorithm that is your central concern.
- 5,293
another one:
eps_step := 0.00001;
eps_abs := 0.00001;
f := x -> x^3-3*x^2+4*x-1;
x[0] := 1.0;
x[1] := 1.5;
for i from 2 to 100 do
x[i] := (x[i - 2]*f(x[i - 1]) - x[i - 1]*f(x[i - 2]))/(f(x[i - 1]) - f(x[i - 2]));
if abs( x[i] - x[i - 1] ) < eps_step and abs( f( x[i] ) ) < eps_abs then
eps_abs then break;
elif i = 100 then
end if;
end do:
evalf(x[i],5);
eps_step := 0.00001
eps_abs := 0.00001
f := x -> x^3-3*x^2+4*x-1
x[0] := 1.0
x[1] := 1.5
0.31767
- 67