Category : Recently Uploaded Files
Archive   : PAPCW10.ZIP
Filename : ROOT.PRG

 
Output of file : ROOT.PRG contained in archive : PAPCW10.ZIP
; calculate root of x^3 - (6 * x^2) + (11 * x) - 1 = 0 using Newton's method
; correct answer is 0.0958
LBL findroot
E-10 0 sto ; tolerance
0.9 ; initial guess
100.00001 1 sto ; loop counter for max iterations
LBL loop
DUP DUP XEQ f OVER XEQ fprime / - ; calculate x'
DUP ROT -
ABS
0 RCL <=
GTO OK
DROP
1 DSE
GTO loop
PUTS "No convergence after 100 iterations\n"
RTN
LBL OK
DROP
PUTS "Answer = " 0 WIDTH 4 FIX PUTSTACK PUTS "\n\n"
DROP
RTN

LBL f ; x^3 - (6 * x^2) + (11 * x) - 1
DUP 3^ OVER 2^ 6* - SWAP 11* + 1-
RTN

LBL fprime ; (3*x^2) - (12*x) + 11
DUP 2^ 3* SWAP 12* - 11+
END


  3 Responses to “Category : Recently Uploaded Files
Archive   : PAPCW10.ZIP
Filename : ROOT.PRG

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/