[Tutor] newton's method for system of nonlinear equations

Luke Paireepinart rabidpoobear at gmail.com
Tue Jun 30 12:36:35 CEST 2009


kgotlelelok at galmail.co.za wrote:
> Hi can someone help me with my program demostrating Newton's method for
> system of nonlinear equations below. Line 45 gives an error saying return
> is outside the function 
>   
That's because you have a return outside of a function.
> for k in range(n-1,-1,-1):
>     b[k] = (b[k] - dot(a[k,k+1:n],b[k+1:n]))/a[k,k]
>     return b

Where did you get this code?  You haven't given us any indication of 
your level of python knowledge or what exactly your problem is so it's a 
little difficult to help you.
We don't just fix programs here, we provide guidance.  It's <tutor> not 
<freelanceprogrammers>.  We'd much rather give you a fishing pole and 
have you fix it yourself.


More information about the Tutor mailing list