조회 수: 30(최근 30일)
I have the following Newton-Raphson method code.
I am attempting to call it using the following
I am receiving the following error
Can someone please help me with this? I know the number of iterations and friction factor, but I am expected to turn the loop I did into a function like this and it should work but there is something a little wrong.
Cris LaPierre 2021년 3월 15일
편집: Cris LaPierre 2021년 3월 15일
From what I can see, the result of f(x0) keeps cycling between the same set of values, none of which results in your stopping condition tol.
Iter x0 f(x0)
2 -2.1477e+07 13.9626 + 1.3646i
3 -2.1477e+07 - 5.5096e-22i 13.9626 - 1.3646i
4 -2.1477e+07 - 9.4040e-38i 13.9626 - 1.3646i
5 -2.1477e+07 + 5.5096e-22i 13.9626 + 1.3646i
6 -2.1477e+07 - 9.4040e-38i 13.9626 - 1.3646i
I would check your equations for f and df.