# 기초수학실습_배현식

## 1983 days 전, qogustlr7 작성

1 in ZZ
 True True
1/2 in ZZ
 False False
1/2 in QQ
 True True
sqrt(2) in QQ
 False False
sqrt(2) in RR
 True True
i^2
 -1 -1
I in RR
 False False
I in CC
 True True
RR(sqrt(121))
 11.0000000000000 11.0000000000000
1 != 1
 False False
not (True or False) == (False and True)
 True True
1 >= 1
 True True
1 + i >= 2 - i
 (I + 1) >= (-I + 2) (I + 1) >= (-I + 2)
((3/2) > 1) or (2/3 < 1)
 True True
((3/2) > 1) ^^ (2/3 < 1)
 False False
((3/2) > 1) ^^ (2/3 < 1) # ^^ xor 배타적 논리합
 False False
x > 1/2
 x > (1/2) x > (1/2)
s=12
 12 12
t=7
t=t+1
 8 8
a,b=1,2
 1 1
 2 2
c,d,e=2,3,5
c,d,e
 (2, 3, 5) (2, 3, 5)
a = b = 1
a b
 1 1
f(x) = x^12 + x^9 + x^3 + 1
f(12)
 8921260230337 8921260230337
[6,28,496,8128]
 [6, 28, 496, 8128] [6, 28, 496, 8128]
[1..7]
 [1, 2, 3, 4, 5, 6, 7] [1, 2, 3, 4, 5, 6, 7]
[1..12]
 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
[2,4..10]
 [2, 4, 6, 8, 10] [2, 4, 6, 8, 10]
[1,4..13]
 [1, 4, 7, 10, 13] [1, 4, 7, 10, 13]
[1,11..35]
 [1, 11, 21, 31] [1, 11, 21, 31]
[pi,4*pi..32]
 [pi, 4*pi, 7*pi, 10*pi] [pi, 4*pi, 7*pi, 10*pi]
A = Set([2,3,3,3,2,1,8,6,3])
 {8, 1, 2, 3, 6} {8, 1, 2, 3, 6}
A.cardinality()
 5 5
8 in A
 True True
10 in A
 False False
12 in A
 False False
B = Set([8,6,17,-4,20, -2 ])
 {17, 20, 6, 8, -4, -2} {17, 20, 6, 8, -4, -2}
A.cardinality(B)
 Traceback (click to the left of this block for traceback) ... TypeError: cardinality() takes exactly 1 argument (2 given) Traceback (most recent call last): File "", line 1, in File "_sage_input_81.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("QS5jYXJkaW5hbGl0eShCKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmpEsV5OC/___code___.py", line 2, in exec compile(u'A.cardinality(B) File "", line 1, in TypeError: cardinality() takes exactly 1 argument (2 given)
A.intersection(B)
 {8, 6} {8, 6}
A.difference(B)
 {1, 2, 3} {1, 2, 3}
B.difference(A)
 {17, 20, -4, -2} {17, 20, -4, -2}
A.symmetric_difference(B)
 {17, 2, 3, 20, 1, -4, -2} {17, 2, 3, 20, 1, -4, -2}
tan(x)
 tan(x) tan(x)
x=0
tan(0)
 0 0
x= pi/4
tan(pi/4)
 1 1
x= pi/2
tan(pi/2)
 Infinity Infinity
x= 3*pi/4
tan(3*pi/4)
 -1 -1
x= pi
tan(pi)
 0 0
A = Set([1,2,3]); A
 {1, 2, 3} {1, 2, 3}
powA = A.subsets(); powA
 Subsets of {1, 2, 3} Subsets of {1, 2, 3}
[3,6..20]
 [3, 6, 9, 12, 15, 18] [3, 6, 9, 12, 15, 18]
[tan(x)for x in [0,pi/4,..pi]]
 [0, 1, Infinity, -1, 0] [0, 1, Infinity, -1, 0]
14 // 4
 3 3
14 % 4
 2 2
divmod(14,4)
 (3, 2) (3, 2)
3.divides(15)
 True True
5.divides(17)
 False False
17.divides(17)
 True True
12.divisors()
 [1, 2, 3, 4, 6, 12] [1, 2, 3, 4, 6, 12]
101.divisors()
 [1, 101] [1, 101]
(2^19-1).is_prime()
 True True
153.is_prime()
 False False
(100+1).divisors ()
 [1, 101] [1, 101]
63.factor()
 3^2 * 7 3^2 * 7
factor(62)
 2 * 31 2 * 31
factor(82)
 2 * 41 2 * 41
24.prime_divisors()
 [2, 3] [2, 3]
divisors(24)
 [1, 2, 3, 4, 6, 8, 12, 24] [1, 2, 3, 4, 6, 8, 12, 24]
prime_divisors(24)
 [2, 3] [2, 3]
prime_divisors(63)
 [3, 7] [3, 7]
lcm(21,43)
 903 903
divmod(956,98)
 (9, 74) (9, 74)
956//98
 9 9
956%98
 74 74
3.divides(234878)
 False False
divisors(134)
 [1, 2, 67, 134] [1, 2, 67, 134]
divisors(491)
 [1, 491] [1, 491]
divisors(422)
 [1, 2, 211, 422] [1, 2, 211, 422]
divisors(1002)
 [1, 2, 3, 6, 167, 334, 501, 1002] [1, 2, 3, 6, 167, 334, 501, 1002]
134.prime_divisors()
 [2, 67] [2, 67]
491.prime_divisors()
 [491] [491]
1002.prime_divisors()
 [2, 3, 167] [2, 3, 167]
422.prime_divisors()
 [2, 211] [2, 211]
gcd(2,5)
 1 1
gcd(4,10)
 2 2
gcd(18,51)
 3 3
lcm(2,5)
 10 10
lcm(4,10)
 20 20
lcm(18,51)
 306 306
g=gcd(18,51)
l=lcm(18,51)
g*l == 18*51
 True True
min(1/2,1/3)
 1/3 1/3
abs(-10)
 10 10

 226 226