Need an HP employee to answer this question - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Calculators (and very old HP Computers) ( /forum-3.html)+--- Forum: HP Prime ( /forum-5.html)+--- Thread: Need an HP employee to answer this question ( /thread-8554.html) |

Need an HP employee to answer this question - webmasterpdx - 06-23-2017 10:59 PM
Im currently exploring a possible proof to Goldbach's conjecture in number theory. I have a function (NPRIMES) I wrote to calculate the exact number of primes <= N. In there I use the isPrime() function. Now I figured this function used a sieve or some other such algorithm. So, I reasoned that if I wrote a faster version that used the Fermat primality test, which is to calculate (a^(n-1))MOD n and show that it equals 1 for 3 different values of a coprime with n. If it equals 1 for all values of a, then n is prime. I used the powmod function to calculate this. However, in my NPRIMES function, I got no noticable speedup by using the Fermat primality test. Now, my questions are: 1. What algorithm is used to calculate isPrime(). I need someone from HP that has access to the source code to tell me this. Is it a sieve or does it already use Fermat's primality test...or what? 2. Does the powmod function use the speedup trick using the properties: (axb)MODc = (aMODc x bMODc)MOD c and (g^2)MODp = (gMODp)^2 MOD p ....and thus avoiding having to use integers greater than p. ...or does it use the CAS ability to actually calculate g^n exactly using the full 2500 digit resolution, which would be much slower. Thanks in advance. -Donald RE: Need an HP employee to answer this question - Tim Wessman - 06-24-2017 02:10 AM
https://www-fourier.ujf-grenoble.fr/~parisse/giac_compile.html When it comes to CAS questions, we generally can't answer as we didn't write it. There is the source code for the CAS at that link though. Unzip it, search for at_powmod or "powmod" and you'll get into the actual functions really quick. Else the CAS author might post here if he notices. RE: Need an HP employee to answer this question - parisse - 06-24-2017 06:11 AM
isPrime does the Miller-Rabin test on the Prime. powmod(a,n,m) is computed by the fast powering algorithm, it does not compute a^n before taking remainder. nprimes is a Giac/Xcas command, but it is not available on the Prime (perhaps we could add it?). Note that ithprime might be useful to implement nprimes, as a first step using an asymptotic guess. RE: Need an HP employee to answer this question - Anders - 06-24-2017 06:53 AM
to parisse's point, Yes we (HP) should add it, long with all the other missing commands from full Giac/Xcas. RE: Need an HP employee to answer this question - webmasterpdx - 06-24-2017 11:35 AM
Thanks guys, I gotta remember that CAS is based on XCAS. Parisse answered my questions. Thx -D RE: Need an HP employee to answer this question - DrD - 06-24-2017 12:47 PM
(06-23-2017 10:59 PM)webmasterpdx Wrote: Im currently exploring a possible proof to Goldbach's conjecture in number theory. That reminded me of this: http://www.hpmuseum.org/forum/thread-3385.html?highlight=Goldbach. It's been awhile and it's been a few firmware rev's, but maybe it still works(?) RE: Need an HP employee to answer this question - Tim Wessman - 06-24-2017 05:46 PM
(06-24-2017 06:53 AM)Anders Wrote: to parisse's point, Yes we (HP) should add it, long with all the other missing commands from full Giac/Xcas. If someone can provide the list of all these "missing" commands I'd be happy to look at it and do so. Every time I've asked there is a vague "well they should just all be there" and yet the only things that have been removed are those that can't be used (licensing problems), duplicates (in some cases, 4 keywords that are the same command), and things that don't make sense due to system architecture (.wav processing, direct file access to the drive, etc), or things that have been added and I just don't have a clue are there. In this case, I'm pretty sure nprimes was added later after the initial inclusion of CAS stuff at the beginning of the Prime and I frankly wasn't aware of it. Recently, I turned on "chisquaret", "kolmogorovd", "kolmogorovt", "multinomial", "randvector", "wilcoxonp", "wilcoxons", "wilcoxont" as I had a bit of time. Would love to add more. RE: Need an HP employee to answer this question - Joe Horn - 06-24-2017 07:16 PM
(06-24-2017 05:46 PM)Tim Wessman Wrote:(06-24-2017 06:53 AM)Anders Wrote: to parisse's point, Yes we (HP) should add it, long with all the other missing commands from full Giac/Xcas. Not quite "every time". ONCE AGAIN, here's a NON-VAGUE list of Xcas commands missing from Prime, including the two very simple and very useful functions I've been repeatedly requesting for years (dfc and dfc2f). Partial List of Xcas functions not in Prime. Synonyms for retained functions are not included in this list. adjoint_matrix Airy_Ai Airy_Bi as_function_of bernoulli blockmatrix border boxwhisker center2interval changebase cloc2 clop2 colspace combine conique_reduite count_eq count_inf count_sup cycle2perm cycleinv cycles2permu det_minor dfc <----------- :-( dfc2f <----------- :-( epsilon2zero exp2list fdistrib feuille genpoly groupermu heugcd is_cycle is_permu is_pseudoprime isom lll makevector mRowAdd newList ord pari perminv permu2cycles permu2mat permuorder ploc2 plop2 psrgcd quadrique_reduite rationalroot realroot reverse_rsolve roots rowspace semi_augment simp2 simplex_reduce sommet SortA SortD split subsop syst2mat tcoeff unquote user_operator Note: The above Xcas functions are documented in English in "cascmd_en.doc" by Renee & Bernard. RE: Need an HP employee to answer this question - toml_12953 - 06-24-2017 08:36 PM
(06-24-2017 06:53 AM)Anders Wrote: to parisse's point, Yes we (HP) should add it, long with all the other missing commands from full Giac/Xcas. +1 RE: Need an HP employee to answer this question - compsystems - 06-25-2017 01:56 AM
more cmds evalb cmd ? cmd union cmd Missing documentation id cmd with quotes, same nop on xcas (No OPeration cmd) Example so please add it to the help catalog hp-prime [subst((abs(2*x-1)) = 1,'abs','id'), subst((abs(2*x-1)) = 1,'abs','neg')] returns -> [(2*x-1) = 1, (-2*x+1) = 1] (06-24-2017 05:46 PM)Tim Wessman Wrote: If someone can provide the list of all these "missing" commands I'd be happy to look at it and do so. Every time I've asked there is a vague "well they should just all be there" and yet the only things that have been removed are those that can't be used (licensing problems), duplicates (in some cases, 4 keywords that are the same command), and things that don't make sense due to system architecture (.wav processing, direct file access to the drive, etc), or things that have been added and I just don't have a clue are there. 1> duplicates (in some cases, 4 keywords that are the same command) Apparently do the same, eg eval with evalb, Many times I want to see the numeric or symbolic output of a test, so the evalb commands is required. Evalb http://www-fourier.ujf-grenoble.fr/~parisse/giac/doc/en/cascmd_en/cascmd_en005.html#htoc9 evalb(sqrt(2)>1.42) returns 0 eval(sqrt(2)>1.42) returns false 2: Now the following library has a license problem? 3: Some commands are internally, but the catalog does not appear union with lowercase on cas mode {a,o,u} union {ee,ii} returns set [a, o, u, ee, ii] ? cmd is the infixed version of when function, They do the same but the entry is different help and documentation on catalog (Cond)? (Expr1):(Expr2). If condition Cond=1/true returns Expr1 else returns Expr2. ? cmd ((true)? (123▶var01): (456▶var02)) -> when(true,var01:=123,var02:=456) |