![]() |
|
|
#2157 |
|
Aug 2006
3×1,993 Posts |
|
|
|
|
|
|
#2158 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
if we take away the if statement on the outside then it tries to find the first element of a 0 element set since that's impossible it would skip to the end and return 1 regardless if they are the same or the fact that [] is a subset of every set.
Last fiddled with by science_man_88 on 2011-02-07 at 15:57 |
|
|
|
|
|
#2159 |
|
Aug 2006
3·1,993 Posts |
|
|
|
|
|
|
#2160 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
|
|
|
|
|
|
#2161 |
|
Jun 2003
5,087 Posts |
So? If one or both of the sets are empty, they _are_ disjoint. Disjoint means "no common element". If one of them is empty, how can there be a common element?
|
|
|
|
|
|
#2162 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
I was told the empty is part of every set unless that's false [],[] can only return 0 because they have something in common [],set or set,[] have the same reason to return 0 but my code can't work with 0 elements unless I have that outer statement if the statement isn't there it returns 1 (true) that all these are disjoint but everything I've been told makes that a bad result.
|
|
|
|
|
|
#2163 | |
|
Jun 2003
117378 Posts |
Empty set is a _subset_ of every set. It is not an _element_ of every set. "Part of" is not a mathematically meaningful term.
Quote:
|
|
|
|
|
|
|
#2164 |
|
Aug 2006
3·1,993 Posts |
This is the empty set (as we're representing it with PARI vectors): []
This is a set containing the empty set as a member: [[]] This is another set containing the empty set as a member: [1, 2, 3, 4, 5, [], 6] aredisjoint([], [[]]) should return 1 because they are disjoint: the first set has no members and so there are no common members. aredisjoint([1, 2, 3, 4, 5, [], 6], [[]]) should return 0 because they aren't disjoint: [] is a member of both. |
|
|
|
|
|
#2165 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
|
|
|
|
|
|
|
#2166 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
Code:
(11:29)>?ispower
ispower(x,{k},{&n}): if k > 0 is given, return true (1) if x is a k-th power, false (0) if not. If k is omitted, return the maximal k >= 2 such that x =
n^k is a perfect power, or 0 if no such k exist. If n is present, and the function returns a non-zero result, set n to the k-th root of x.
(11:31)>ispower(4,,2)
*** expected character: '&': ispower(4,,2)
^--
(11:31)>ispower(4,,&2)
*** syntax error, unexpected KINTEGER, expecting KENTRY: ispower(4,,&2)
^--
(11:31)>ispower(4,,{&2})
*** syntax error, unexpected KINTEGER, expecting KENTRY: ispower(4,,&2)
^--
(11:31)>ispower(4,,{&2})
*** syntax error, unexpected KINTEGER, expecting KENTRY: ispower(4,,&2)
^--
(11:32)>ispower(4,,{2&})
*** syntax error, unexpected ')': ispower(4,,2&)
^-
(11:32)>ispower(4,,&2)
*** syntax error, unexpected KINTEGER, expecting KENTRY: ispower(4,,&2)
^--
(11:32)>ispower(4,2,&2)
*** syntax error, unexpected KINTEGER, expecting KENTRY: ispower(4,2,&2)
^--
(11:32)>ispower(4,,&2)
*** syntax error, unexpected KINTEGER, expecting KENTRY: ispower(4,,&2)
^--
(11:32)>ispower(4,,2)
*** expected character: '&': ispower(4,,2)
^--
(11:32)>ispower(4,,&)
*** syntax error, unexpected ')', expecting KENTRY: ispower(4,,&)
^-
(11:33)>ispower(4,,&"2")
*** syntax error, unexpected KSTRING, expecting KENTRY: ispower(4,,&"2")
^--
(11:33)>ispower(4,,&2)
*** syntax error, unexpected KINTEGER, expecting KENTRY: ispower(4,,&2)
^--
(11:33)>ispower(4,,{2})
*** expected character: '&': ispower(4,,2)
^--
(11:33)>ispower(4,,&{2})
*** syntax error, unexpected KINTEGER, expecting KENTRY: ispower(4,,&2)
^--
(11:33)>ispower(4,,&})
*** unexpected closing brace.
(11:33)>ispower(4,,&}
*** unexpected closing brace.
(11:33)>ispower(4,,&2}
*** unexpected closing brace.
(11:33)>ispower(4,,&2)
*** syntax error, unexpected KINTEGER, expecting KENTRY: ispower(4,,&2)
^--
(11:34)>ispower(4,,{2})
*** expected character: '&': ispower(4,,2)
^--
(11:34)>ispower(4,,2)
*** expected character: '&': ispower(4,,2)
^--
(11:34)>ispower(4,,2)
|
|
|
|
|
|
#2167 |
|
Jun 2003
5,087 Posts |
Code:
? n=0 %12 = 0 ? ispower(1024,,&n) %13 = 10 ? n %14 = 2 |
|
|
|
![]() |
| 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 |