mersenneforum.org  

Go Back   mersenneforum.org > Math Stuff > Computer Science & Computational Number Theory > PARI/GP

Reply
 
Thread Tools
Old 2010-11-29, 00:31   #1772
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

175B16 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
I used eval so people could use powers not the full written number., and yes it's incomplete.
You can certainly write
Code:
f(x,y)=x+y;

f(2^10, 3^4)
and have it work properly without eval.
CRGreathouse is offline   Reply With Quote
Old 2010-11-29, 00:33   #1773
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

597910 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
the site isn't updating I added the guessing script, and the rate counter lol.
Good stuff. I changed the name in the header to PARI/GP, because that's how it needs to be (with caps) to show up properly in the categories and all that.
CRGreathouse is offline   Reply With Quote
Old 2010-11-29, 00:33   #1774
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
You can certainly write
Code:
f(x,y)=x+y;

f(2^10, 3^4)
and have it work properly without eval.
Yeah well long multiplication uses each digit last I heard.
science_man_88 is offline   Reply With Quote
Old 2010-11-29, 00:34   #1775
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
Good stuff. I changed the name in the header to PARI/GP, because that's how it needs to be (with caps) to show up properly in the categories and all that.
I should make a note lol.
science_man_88 is offline   Reply With Quote
Old 2010-11-29, 00:37   #1776
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

135338 Posts
Default

FWIW I'm working on the task Amb at the moment.

Quote:
Originally Posted by science_man_88 View Post
Yeah well long multiplication uses each digit last I heard.
I don't know what that has to do with my point (that you don't need eval).
CRGreathouse is offline   Reply With Quote
Old 2010-11-29, 00:42   #1777
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
FWIW I'm working on the task Amb at the moment.



I don't know what that has to do with my point (that you don't need eval).
thought it wasn't self evaluating.
science_man_88 is offline   Reply With Quote
Old 2010-11-29, 00:45   #1778
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
I don't understand the program; it seems to never use c, carry, or answer. Is this just incomplete?

I certainly wouldn't use eval() unless I absolutely had to.
The reason I never use the others is I can't get the d[x]==2 stuff to work. If I can't get this to work I can't work on digit by digit in string form.
science_man_88 is offline   Reply With Quote
Old 2010-11-29, 00:59   #1779
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

135338 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
The reason I never use the others is I can't get the d[x]==2 stuff to work. If I can't get this to work I can't work on digit by digit in string form.
I don't understand what part you're stuck on, but eval() won't help you get there.

Last fiddled with by CRGreathouse on 2010-11-29 at 00:59
CRGreathouse is offline   Reply With Quote
Old 2010-11-29, 01:02   #1780
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

203008 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
I don't understand what part you're stuck on, but eval() won't help you get there.
What is stopping me is I made strings out of the digits and I want to check the digits but I haven't found a way that works to check them. If I could I'd complete->http://rosettacode.org/wiki/Determin...ing_is_numeric as well.

Last fiddled with by science_man_88 on 2010-11-29 at 01:02
science_man_88 is offline   Reply With Quote
Old 2010-11-29, 01:17   #1781
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
What is stopping me is I made strings out of the digits and I want to check the digits but I haven't found a way that works to check them. If I could I'd complete->http://rosettacode.org/wiki/Determin...ing_is_numeric as well.
What does "check the digits" mean?

Making a string out of a number is easy: Str(n). Making this into a vector is similarly easy: Vec(Str(n)). If you want numbers rather than characters, you need eval(Vec(Str(n))). Possibly a better way is Vecsmall(Str(n)) which gives numbers that are 48 to 57 rather than 0 to 9. (You can subtract, of course, as desired.)
CRGreathouse is offline   Reply With Quote
Old 2010-11-29, 01:21   #1782
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
What does "check the digits" mean?

Making a string out of a number is easy: Str(n). Making this into a vector is similarly easy: Vec(Str(n)). If you want numbers rather than characters, you need eval(Vec(Str(n))). Possibly a better way is Vecsmall(Str(n)) which gives numbers that are 48 to 57 rather than 0 to 9. (You can subtract, of course, as desired.)
okay thanks now we can use your brains to finish both long multiply and determine if numerical.

doh! What am I doing checking if it's 2? Now I can just add them now and use carry to take care of everything thanks again.

Last fiddled with by science_man_88 on 2010-11-29 at 01:26
science_man_88 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do I sometimes see all the <> formatting commands when I quote or edit? cheesehead Forum Feedback 3 2013-05-25 12:56
Passing commands to PARI on Windows James Heinrich Software 2 2012-05-13 19:19
Ubiquity commands Mini-Geek Aliquot Sequences 1 2009-09-22 19:33
64-bit Pari? CRGreathouse Software 2 2009-03-13 04:22
Are these commands correct? jasong Linux 2 2007-10-18 23:40

All times are UTC. The time now is 23:04.


Fri Aug 6 23:04:39 UTC 2021 up 14 days, 17:33, 1 user, load averages: 3.50, 3.80, 3.90

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

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.