15 Reputation

One Badge

5 years, 155 days

MaplePrimes Activity

These are replies submitted by MAJP


I downloaded your file and it seems to work perfectly, 2.422 was the answer I was looking for.

Thank you for helping me and for basically recreating the whole thing. With this I'm confident I can finish it before the deadline now.


@acer I've spent some time going through the code again, and made a few changes. I ended up with this;


Newton := proc (n, y0, Q, b, m, k, S0) local A, P, Sf, y, F, dAdy, dPdy, Fdiff, i; global ylist;

y[0] := y0;

for i from 0 to n do

A[i] := (b+m*y[i])*y[i];

P[i] := b+2*y[i]*sqrt(1+m^2);

Sf[i] := Q*abs(Q)*P[i]^(4/3)/(k^2*A[i]^(10/3));

F[i] := S0/Sf[i]-1;

dAdy[i] := b+2*m*y[1];

dPdy[i] := 2*sqrt(1+m^2);

Fdiff[i] := (2/3)*(F[i]-1)(5*dAdy[i]/A[i]-2*dPdy[i]/P[i]);

y[i+1] := y[i]-F[i]/Fdiff[i] end do;

ylist := [seq(y[i], i = 0 .. n)]; return ylist

end proc;


Newton(10, 1, 5, 12, 1, 30, 10^(-5));

When I try to run it now, I receive no error. However the calculation seems to take a very long time. In fact, it takes so long that I'm pretty sure I'm never going to get a result from this. What could be the issue?

@acer Thanks for your answer.

Removing procname (and not changing anything else) gave me another error instead;

Error, (in Newton) too many levels of recursion

I encountered this before, and the error page on the Maplesoft site informed me that adding procname was one of the ways to solve it. To be honest, I wasn't really sure what procname did in the first place.

The other possible solution the page offered was to add a baseline, which I thought I was already doing by adding this statement in the procedure; y[0] := y0. So now I'm not sure what else could be wrong.

Any other ideas? Thanks in advance.


Page 1 of 1