Charles Greathouse on Thu, 09 Dec 2010 07:23:04 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Exposing library functions to GP |
I've been thinking about the changes I make between my GP scripts and Pari library functions. One function that has been very useful is Z_factor_until: often just 'one more factor' is enough to exit a function, while a complete factorization may be hard to find. For example, consider the case of a function checking if a number is a semiprime. I'm not sure if suggestions of this sort are welcome. The guidelines "We classify changes to PARI into four rough classes, where changes of the first three types are almost certain to be accepted." seem to discourage new functions, though perhaps this is an extension to an existing function rather than a new function. The natural next question: if this was added to GP, what would be the best way? One way would be to simply add parser codes for the function in its current form. Another would be to add it as an option in factorint (what would be the best way?). Another option would be to make a standalone function, perhaps called findfactor, that would return a proper factor of the number, unless the number is a probable prime (in which case it could return 1, the number itself, or throw an error; I tend to favor the first option). Charles Greathouse Analyst/Programmer Case Western Reserve University