mersenneforum.org  

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

Reply
 
Thread Tools
Old 2010-11-29, 01:24   #1783
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
okay thanks now we can use your brains to finish both long multiply and determine if numerical.
I'd rather expand yours.
CRGreathouse is offline   Reply With Quote
Old 2010-11-29, 01:45   #1784
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

20C016 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
I'd rather expand yours.
Good luck with that lol.

Code:
longmultiply(a,b)= c=eval(Vec(Str(a)));d=eval(Vec(Str(b)));carry=0;answer=[];forstep(x=#d,1,[-1],forstep(y=#c,1,[-1],answer=concat(((c[y]*d[x])+carry)%10,answer);carry=floor((c[y]*d{x])/10))
  ***   sorry, embedded braces (in parser) is not yet implemented.
I can't figure out what's messing up and, Yes I've checked the braces just enough that it should work. Oh never mind stupid concat lol.

didn't work for calculating it before either.

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

26×131 Posts
Default

I have a hard time believing this hasn't been done.
science_man_88 is offline   Reply With Quote
Old 2010-11-29, 02:10   #1786
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

597910 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
Good luck with that lol.
It's already worked. Look at how much you can do with Pari now -- you hadn't even heard of it a year ago.

Quote:
Originally Posted by science_man_88 View Post
I can't figure out what's messing up and, Yes I've checked the braces just enough that it should work. Oh never mind stupid concat lol.
You wrote "{x]" instead of "[x]".
CRGreathouse is offline   Reply With Quote
Old 2010-11-29, 02:13   #1787
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
I have a hard time believing this hasn't been done.
Essentially the only tasks that are done are the ones I did over the last four weeks. Sometimes I didn't do a task because it was easy and I thought anyone could do it; sometimes I left a task because I couldn't think of any nice way to do it; sometimes I couldn't think of any way to do it; sometimes I just didn't get around to it.

You may very well become the #2 Pari contributor on RC if you continue this way. (I don't know who presently has that title, but they couldn't have very many.)
CRGreathouse is offline   Reply With Quote
Old 2010-11-29, 02:25   #1788
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
Essentially the only tasks that are done are the ones I did over the last four weeks. Sometimes I didn't do a task because it was easy and I thought anyone could do it; sometimes I left a task because I couldn't think of any nice way to do it; sometimes I couldn't think of any way to do it; sometimes I just didn't get around to it.

You may very well become the #2 Pari contributor on RC if you continue this way. (I don't know who presently has that title, but they couldn't have very many.)
Yeah something missing in my code I know because answer became

Code:
[6, 9, 4, 6]
instead of
Code:
[7,3,6]

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

10111010110112 Posts
Default

Well, good luck debugging. Sometimes splitting the program into multiple functions helps, as does adding diagnostic messages with print(). (You remove these after debugging, of course.)

I finished the Amb task, that was a pain to debug. I hate string processing in Pari.
CRGreathouse is offline   Reply With Quote
Old 2010-11-29, 02:33   #1790
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post

I finished the Amb task, that was a pain to debug. I hate string processing in Pari.
Really? I thought it was only me that hated it. I'm heading to bed I'm up 30 minutes past when I usually go to bed. I've got Pari still open and I'm semi working on a pascals triangle script.

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

3×1,993 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
Really? I thought it was only me that hated it. I'm heading to bed I'm up 30 minutes past when I usually go to bed. I've got Pari still open and I'm semi working on a pascals triangle script.
The problem I had was related to the power of concat: I wanted it to join together two vectors and it was obligingly smushing them into strings. I managed to solve my problem, thankfully.
CRGreathouse is offline   Reply With Quote
Old 2010-11-29, 12:22   #1792
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

203008 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
The problem I had was related to the power of concat: I wanted it to join together two vectors and it was obligingly smushing them into strings. I managed to solve my problem, thankfully.
the problem for me is I don't use multiple answer vectors:

023
x32
___
0046
+690

not :

23*32 =[6,9,4,6]

Last fiddled with by science_man_88 on 2010-11-29 at 13:17
science_man_88 is offline   Reply With Quote
Old 2010-11-29, 14:27   #1793
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

135338 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
the problem for me is I don't use multiple answer vectors:

023
x32
___
0046
+690

not :

23*32 =[6,9,4,6]
Ah. You should only use one, but pre-set it to the appropriate size, filled with 0s, then *add* rather than concatenate. That way you can go from

[0, 0, 0, 0, 0]
to
[0, 0, 0, 0, 6]
to
[0, 0, 0, 4, 6]
to
[0, 0, 0, 13, 6]
to
[0, 0, 6, 13, 6]
which can be simplified to
[0, 0, 7, 3, 6]
and then
[7, 3, 6]
if desired.
CRGreathouse is offline   Reply With Quote
Reply



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:03.


Fri Aug 6 23:03:17 UTC 2021 up 14 days, 17:32, 1 user, load averages: 3.70, 3.95, 3.96

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.