Robert Willam Grieve a ?crit :
> Greetings list
>
> I'm still getting used to this, but I've been lurking a while and
> now I have to start doing basic college first year calc. I'm
> working up to Stochastic processes later in the year.
> I'll do it in Mathematica if I need to but I'd rather use your
> package, it suits me better.
>
> I'm getting to grips with parts and equation manipulation, so I
> tryed this, prove eqn1 converges to root n for x > 0:
>
> eqn1 : (1/2)*(x + (n/x)) = 0$
> eqn1 : eqn1*2$
> eqn1 : eqn1 - part(part(eqn1, 1), 1)$
> eqn1 : eqn1^2$
At this place, you forget about a minus sign ; the new equation is not
equivalent to the first one.
> eqn1 : eqn1 * part(part(eqn1, 1), 2)$
> eqn1 : eqn1^(1/4)$
Here you get only one of four solutions : x=sqrt(n) but there are three
other that maxima doesn't show : i*sqrt(n) , -sqrt(n) , -i*sqrt(n).
Only i*sqrt(n) and -i*sqrt(n) are solutions of your first equation. The
other have been introduced by in the squaring step above.
> eqn1;
>
> And I get something that can be written in c as sqrt(n) == abs(x)
> Fair enough
>
> I also got rid of the abs by doing
>
> assume(n > 0, x > 0);
>
> which is fine cause my case allows it.
>
> So having proved this 'manually' I want to try and get solve to
> do it automatically.
>
> But when I do this:
>
> assume(n>0)$
> eqn2 : (1/2)*(x + (n/x)) = 0$
> soln : solve(eqn2, x)$
> soln;
>
> I get [ -%i*n^(1/2), %i*n^(1/2) ]
This answer is correct.
If you want to find the square root of n as a limit of the sequence
defined by u_(k+1)=(1/2)*(u_k+n/u_k), you are looking for a FIXED POINT
(not a zero) of f(x)=(1/2)*(x + (n/x)). Hence the equation should be
eqn3 : (1/2)*(x + (n/x)) = x;
Now solve(eqn3, x); returns [x = - sqrt(n), x = sqrt(n)] as expected.
Eric