![]() |
|
|
#1255 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
|
|
|
|
|
|
#1256 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
maybe not lol I can't get one thing to work lol if I could I can generate a multiplication table.
|
|
|
|
|
|
#1257 | |
|
Aug 2006
3×1,993 Posts |
That's the difficulty, isn't it -- I can only know what you write, not what you want.
Quote:
Code:
for(x=1,9,for(y=1,9,print1(x*y" "));print()) |
|
|
|
|
|
|
#1258 |
|
"Forget I exist"
Jul 2009
Dumbassville
100000110000002 Posts |
well I was going to try to use matrices to do it but:
Code:
multiplication(i,j)= x=Mat([]);for(i=1,i,for(j=1,j,x(i,j)=i*j));return(x(i,j)) |
|
|
|
|
|
#1259 |
|
Aug 2006
597910 Posts |
Use [] for accessing the elements of vectors and matrices, not ().
I'm not sure why you're using one here, though. You fill in a multiplication table, pull out one element, throw the table away, then return the one element. |
|
|
|
|
|
#1260 |
|
May 2010
Prime hunting commission.
168010 Posts |
Well, I'm finishing up on b = 501-750.
I have 10 values left. |
|
|
|
|
|
#1261 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
2) I wanted the whole table but I couldn't get it all to print |
|
|
|
|
|
|
#1262 |
|
"Forget I exist"
Jul 2009
Dumbassville
20C016 Posts |
I gave up on matrices.
Code:
multiplication(i,j=i)= for(i=1,i,for(j=1,j,print1(i*j"\t"));print(""))
|
|
|
|
|
|
#1263 | |
|
Aug 2006
3·1,993 Posts |
You'll need to define the matrix first. You tried -- but you only made it a 0x0 matrix, you need an i x j. try matrix(i,j,unused1, unused2, 0) or even matrix(i,j,x,y,x*y) which avoids the need for the loops.
Quote:
Code:
foo(i,j)=matrix(i,j,x,y,x*y) |
|
|
|
|
|
|
#1264 |
|
Aug 2006
3×1,993 Posts |
That looks fine, except that your variables are bumping into each other: you have the "max j" and the "loop j" and likewise for i. If you rename them this should work nicely.
|
|
|
|
|
|
#1265 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
Code:
*** too many arguments: ...plication(i,j=i)=x=Mat(i,j,x,y,x*y);for(i=1,i
^--------------------
Last fiddled with by science_man_88 on 2010-08-31 at 20:41 |
|
|
|
|
![]() |
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 |