Post Reply 
[VA] SRC #012b - Then and Now: Root
11-10-2022, 03:02 PM (This post was last modified: 11-12-2022 05:06 AM by C.Ret.)
Post: #14
RE: [VA] SRC #012b - Then and Now: Root
Thank you Chan.

You right, the last two or three roots may or may not have a larger norm than the first one (or first two). The loop to seek for the smallest is still needed.

Here is a corrected version of my code:

10 INPUT "n=";N @ T0=TIME @ OPTION BASE 0 @ DIM P(N) @ COMPLEX R(N-1)
20 P(N)=2 @ P(N-1)=3 @ FOR K=N-2 TO 0 STEP -1 @ P(K)=FPRIM(2+P(K+1)) @ NEXT K
30 MAT R=PROOT(P) @ FOR K=1 TO N-1 @ IF ABS(R(K))<ABS(R(0)) THEN VARSWAP R(0),R(K)
40 NEXT K @ T0=TIME-T0 @ DISP T0;ABS(R(0)) @ BEEP


I also have to edit my previous post to indicate my mistake...
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC #012b - Then and Now: Root - C.Ret - 11-10-2022 03:02 PM



User(s) browsing this thread: 2 Guest(s)