2
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ 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.) $\endgroup$ – rschwieb May 28 '13 at 16:44
  • $\begingroup$ ino belakhare khodam neveshtamesh! moshkelam to yeki az halghehaye if bood. $\endgroup$ – only math May 28 '13 at 18:57
  • $\begingroup$ soale newton ro javab dadan inja manam belakhare moshkelesho hal kardam faghat javabe akharesho ebarato sae nemikone! mesle javabie ke inja ham gozashtan $\endgroup$ – only math May 28 '13 at 18:59
  • $\begingroup$ ino manam ye javab neveshtam vasash alan ferestadam vali nemidoonam chera enghad darham omade! $\endgroup$ – only math May 28 '13 at 19:14
  • $\begingroup$ @faranak50 oonyekiam didam javabesho moshkelam kolan hal shod faghat mikham yekari konam javabe akharo bad az sade kardan bede! :D $\endgroup$ – only math May 28 '13 at 19:14
2
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Nice acer. +1.. $\endgroup$ – mrs May 28 '13 at 18:35
1
$\begingroup$

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
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.