[VA] SRC #012b - Then and Now: Root
|
11-09-2022, 04:05 PM
(This post was last modified: 11-09-2022 04:35 PM by J-F Garnier.)
Post: #6
|
|||
|
|||
RE: [VA] SRC #012b - Then and Now: Root
Thanks Werner and C.Ret to put me back on the right track, so we are looking for complex roots.
But I didn't completely loose my time, just see: (11-09-2022 09:02 AM)Werner Wrote: There are indeed no real roots. (11-09-2022 10:19 AM)C.Ret Wrote: But I suddenly discover what already discover Werner and J.-F. Garnier; polynomials with only positive coefficients and even degree have no real root. This is wrong! There are (at least) two real roots ! I used brute force, using HTBasic (1999 version) which is a HP BASIC compatible programming environment on PC, that still runs fine on my W10 computer in 2022. I know this is slightly outside the rules, but not so much, HTBasic is to the HP-71B what Free42 is to the HP-42S: a native (not emulated) compatible language running on PC, with the notable difference is that HTBasic is not free, actually quite expensive being a professional tool. So the below program, that searches where the polynomial sign changes, could in principle, be run on a HP-71B: 100 ! RE-STORE "src12b" 105 ! SRC12B, MoHPC, 8nov2022 110 ! quite 'force brut' approach 115 ! 120 OPTION BASE 0 125 DIM P(10000) 130 ! 135 N=10000 140 READ P(*) ! READ P() on the 71B 145 ! 150 ! find out where the sign changes: 155 Y1=2 ! polynomial value at X=0 160 FOR X=-.01 TO -1.01 STEP -.001 165 GOSUB Evalpoly 170 IF SGN(Y)<>SGN(Y1) THEN 175 PRINT X1,Y1 ! print the interval where sign changes 180 PRINT X,Y 185 PRINT "------" 190 END IF 195 X1=X ! save X,Y for next iteration 200 Y1=Y 205 NEXT X 210 STOP 215 ! 225 Evalpoly: ! evaluate polynomial at X, result in Y 230 Y=0 235 FOR I=0 TO N 240 IF (I*LGT(-X))>-300 THEN Y=Y+X^I*P(I) 245 NEXT I 250 RETURN 255 ! 290 ! 295 DATA 2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29 300 DATA 31 , 37 , 41 , 43 , 47 , 53 , 59 , 61 , 67 , 71 305 DATA 73 , 79 , 83 , 89 , 97 , 101 , 103 , 107 , 109 , 113 ... 5290 DATA 104677 , 104681 , 104683 , 104693 , 104701 , 104707 , 104711 , 104717 , 104723 , 104729 5295 DATA 104743 5300 END X, polynomial value: -.996 .9768... -.997 -5.9593... ------ -.999 -39.8287... -1 52726 ------ So there is a real root between -.996 and -.997 and another one between -.999 and -1, in accordance to my guess that real roots (if existing) would be close to -1. Now, I will go back to the actual question, using the 71B or a HP calculator (promised!), but I thought this unexpected result was worth to be reported here. J-F |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)