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)

science_man_88 2010-08-10 21:03

[QUOTE=CRGreathouse;224801]I used to edit text on Windows with Crimson Editor, where I had a nice macro. I would type the name of the function and its arguments, like

[code]foo(a,b)[/code]
and press the shortcut key to transform this to
[code]foo(a,b)={

};
addhelp(foo, "foo(a, b): ");[/code]
by appropriate use of 'duplicate line', 'next word', etc. functions.

:smile:

Now I'm using gedit on Linux and Notepad++ on Windows; I like them better, overall, but I have no such feature. Pity.[/QUOTE]

I wanted to make something read the inputs and create the code even more.

CRGreathouse 2010-08-10 21:06

[QUOTE=science_man_88;224803]I wanted to make something read the inputs and create the code even more.[/QUOTE]

Sounds [url=http://en.wikipedia.org/wiki/AI-complete]AI-Complete[/url].

science_man_88 2010-08-10 21:09

[QUOTE=CRGreathouse;224804]Sounds [url=http://en.wikipedia.org/wiki/AI-complete]AI-Complete[/url].[/QUOTE]

search the input for descriptive words or sentences like "all primes until n" if n is greater than primelimit warn the user or use for(1,n,if(isprime()) things like that.

CRGreathouse 2010-08-10 21:15

I agree, that would be very cool. But it's a hard task.

I was doing a problem that is somewhat similar: take natural language and see if it has a certain mathematical meaning. My source data was the OEIS; the goal was to determine which sequences represented quadratic equations ([url=http://math.crg4.com/oeis-quadratics.html]results here[/url]). But even at that very restricted task I found many problems: different ways to write polynomials and generating functions, differences in base variables, mentions of equations other than those defining the sequence, etc.

For a more general-purpose task like this one, I can only imagine how much harder it would be.

science_man_88 2010-08-10 21:20

[QUOTE=CRGreathouse;224807]I agree, that would be very cool. But it's a hard task.

I was doing a problem that is somewhat similar: take natural language and see if it has a certain mathematical meaning. My source data was the OEIS; the goal was to determine which sequences represented quadratic equations ([url=http://math.crg4.com/oeis-quadratics.html]results here[/url]). But even at that very restricted task I found many problems: different ways to write polynomials and generating functions, differences in base variables, mentions of equations other than those defining the sequence, etc.

For a more general-purpose task like this one, I can only imagine how much harder it would be.[/QUOTE]

apparently embedded braces in parser is not supported by PARI go figure

[CODE]scriptwriter(name,input()) = { print(name"() = {");addhelp(name,name"()"input());if(input()=="all primes until";if(n>primelimit,print(n"is greater than primelimit"));addhelp(name,name"():"input());[/CODE]

3.14159 2010-08-10 21:40

[QUOTE=CRGreathouse]No thanks, that would be too much work. But feel free to work them out yourself if you like.
[/QUOTE]

What the - It's not up to me to validate what you post! You do that!

Prime-numbered post. Woo.

science_man_88 2010-08-10 21:50

[CODE]script(name) = print(name"()=");if(input()==,print("is n greater than primelimit?"))[/CODE]

can't figure out how to check strings the way I want can I fill in a vector with them ? if so can't I check strings like that ?

CRGreathouse 2010-08-10 21:52

[QUOTE=3.14159;224810]What the - It's not up to me to validate what you post! You do that![/QUOTE]

You asked me to find a general composite that was a pseudoprime to at least 20 bases, and I did that. You didn't ask for a list of the bases! If you want those you can generate them yourself. I imagine you can work mod each of the primes and CRT the results together.

CRGreathouse 2010-08-10 21:54

[QUOTE=science_man_88;224812][CODE]script(name) = print(name"()=");if(input()==,print("is n greater than primelimit?"))[/CODE]

can't figure out how to check strings the way I want can I fill in a vector with them ? if so can't I check strings like that ?[/QUOTE]

You can certainly have strings in vectors:
[code]["one", "two", "three"][/code]
and even convert strings into vectors of characters
[code]Vec("hi there")[/code]

Is that what you wanted?

3.14159 2010-08-10 21:57

[QUOTE=CRGreathouse]You asked me to find a general composite that was a pseudoprime to at least 20 bases, and I did that. You didn't ask for a list of the bases! If you want those you can generate them yourself. I imagine you can work mod each of the primes and CRT the results together.[/QUOTE]

I didn't ask for a list of bases? What is it that I ask for here, then:

[QUOTE=3.14159]Please, tell me which 49 bases it is pseudoprime to.[/QUOTE]

[B]I couldn't make it any more explicit than that.[/B]

science_man_88 2010-08-10 21:58

might work CRG also i got this working as wanted:

[CODE]script(name) = print(name"()=");if(input()==all primes upto,print("is n greater than primelimit?"))[/CODE]

if I implement yours the hard part is telling how long the number(or it's representation) would be after this.

nvm if I can check for spaces I just add a extra character onto my string I check for and then check for the next space and read the number encoded check if it's above the prime limit if so I warn them ask them if it should be changed if not I go with [CODE]for(x=1,#,if(isprime(x)))[/CODE] deal.


All times are UTC. The time now is 06:55.

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