mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   PARI/GP (https://www.mersenneforum.org/forumdisplay.php?f=155)
-   -   PARI's commands (https://www.mersenneforum.org/showthread.php?t=13636)

CRGreathouse 2010-08-11 19:37

Glad to hear about the addhelp. It will, uh, help in the future.

[QUOTE=3.14159;224972][B]isSPRP[/B]? Isn't the meaning a bit self-evident there?[/QUOTE]

Your function isSPRP as described in post #270 is not the indicator function for the strong probable primes, as the name would suggest. Instead it is a probable-prime test incorporating the strong test and trial divison. Your function isPRP as listed in post #252 does not check if a number is a probable prime, as the name suggests, but instead checks if the number is a strong probable prime.

3.14159 2010-08-11 21:00

[QUOTE=CRGreathouse]Your function isSPRP as described in post #270 is not the indicator function for the strong probable primes, as the name would suggest. Instead it is a probable-prime test incorporating the strong test and trial divison. Your function isPRP as listed in post #252 does not check if a number is a probable prime, as the name suggests, but instead checks if the number is a strong probable prime.
[/QUOTE]

The help addition solves all. The name of the file I saved all the definitions of the functions to is named b(m).txt, and is indeed a text file.

science_man_88 2010-08-11 21:13

[QUOTE=science_man_88;224913]so the basic idea I have of the process required is:

1)read for updates
2)send request to next part of script
3)find function names that can be understood in the text (if none exist give error and/or print questions the script has about the request)
4)print out code for functions if they are found to be in the database.
5) post code to Mersenne forums website.[/QUOTE]

instead of finding function names it's easier to find function descriptions(aka. addhelp()) in a post.

so for example if someone asks to find the first n Mersenne Numbers

in Mersenne(n) lets say the addhelp contains first n Mersenne Numbers

theres a match found it know that's the one it should print.

now they may use any variable so I wonder if we can say don't check for n check for anything in this position relative to the first part of this string. would this help to decipher? the hard part is we may need a lot of / or saying switch this synonyms addhelp from this term to this other set of them is there a way ?

CRGreathouse 2010-08-11 21:26

[QUOTE=3.14159;224982]The help addition solves all. The name of the file I saved all the definitions of the functions to is named b(m).txt, and is indeed a text file.[/QUOTE]

Yep. I have at least one deceptive name amongst my functions: DickmanRho estimates, rather than computes, Dickman's rho.
[code]>?DickmanRho
Estimates the value of the Dickman rho function. For x <= 3 the exact values
are used, up to rounding; up to 15 the value is interpolated using known values
and rhoest; after 15 rhoest is used, along with a correction factor based on
the last value in rhoTable.

>?rhoest
de Bruijn's asymptotic approximation for rho(x), rewritten as in van de Lune
and Wattel 1969. Curiously, their paper shows values for this estimate that
differ from those calculated by this function, often as soon as the second
decimal place -- but as the difference is in the direction of the true value, I
have not looked further into this.[/code]

CRGreathouse 2010-08-11 21:29

[QUOTE=science_man_88;224985]instead of finding function names it's easier to find function descriptions(aka. addhelp()) in a post.[/QUOTE]

Sure, but there are lots of ways to say things. You don't want the total size of your addhelp files to be 10^23 bytes, do you? :smile:

[QUOTE=science_man_88;224985]now they may use any variable so I wonder if we can say don't check for n check for anything in this position relative to the first part of this string. would this help to decipher? the hard part is we may need a lot of / or saying switch this synonyms addhelp from this term to this other set of them is there a way ?[/QUOTE]

It's a rather hard problem, and I do wish you luck. Synonym tables seem like a fair place to start.

Frankly, Perl would probably be better suited to this task than Pari -- Pari is bad at text processing, and that's where Perl shines.

science_man_88 2010-08-11 21:34

how could you make a synoym table in pari ? I know for a function I do function1 = function2 but how do can i do it for addhelp technically it could be more than one help file if i can call more than one. how can I make a synonym table for changing one or 2 words in a addhelp if we go for short names.

CRGreathouse 2010-08-11 21:40

There's no special way to do that. And given how painful string operations are in Pari, I wouldn't recommend doing them at all if you can avoid it.

science_man_88 2010-08-11 21:41

[CODE]addhelp(fun,Vec(?foo) - "foo." + "fun.")[/CODE]

I tried something like that.

[CODE](18:38) gp > ?foo
a function called foo.[/CODE]

science_man_88 2010-08-11 21:48

another thing I thought of can we use function1=function2 so it writes the function name without _ in each addhelp ?

science_man_88 2010-08-11 22:41

If Perl is a way to do this then use it at least up to printing the functions have the Perl executable pass pari the function names to print out maybe or maybe the Perl program can read the script file(s) involved and print it to a command prompt. the point is it's useful. if a Perl expert can give us code similar to C maybe we can convert to Pari later on.

science_man_88 2010-08-11 23:17

could we not make the read post into a vector of strings then sort from most important to least important according to a list/vector ?

oh by the way i found a typo in ?vecsort fonction-> function if I know what I'm talking about.


All times are UTC. The time now is 22:37.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.