# 기초수학-실습_Hong Seok woo

## 2404 days 전, hsw1474@naver.com 작성

plot(Piecewise([[(0,1),x^2],[(1,2),1],[(2,3),x^2-3]]))
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^3
 -I -I
I in RR
 False False
I in CC
 True True
QQ(.5)
 1/2 1/2
RR(sqrt(2))
 1.41421356237310 1.41421356237310
not False
 True True
True and False
 False False
sage: 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) # ^^ xor 배타적 논리합
 False False
x > 1/2
 x > (1/2) x > (1/2)
s=12
 12 12
s=34
 34 34
t=7
t=t+1
 8 8
c,d,e=2,3,5
 3 3
 2 2
 5 5
a = b = 1 (a,b)
 (1, 1) (1, 1)
f(x) = x^2 + x + 1 f(19)
 381 381
 x |--> x^2 + x + 1 x |--> x^2 + x + 1
f(x=3)
 13 13
[6,28,496,8128]
 [6, 28, 496, 8128] [6, 28, 496, 8128]
[2,4,6..10]
 [2, 4, 6, 8, 10] [2, 4, 6, 8, 10]
[2,4..10]
 [2, 4, 6, 8, 10] [2, 4, 6, 8, 10]
[1,3..9]
 [1, 3, 5, 7, 9] [1, 3, 5, 7, 9]
[1,11..40]
 [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]
[2,3,3,3,2,1,8,6,3]
 [2, 3, 3, 3, 2, 1, 8, 6, 3] [2, 3, 3, 3, 2, 1, 8, 6, 3]
A = Set([2,3,3,3,2,1,8,6,3]) A
 {8, 1, 2, 3, 6} {8, 1, 2, 3, 6}
A.cardinality()
 5 5
9 in A
 False False
B = Set([8,6,17,-4,20, -2 ]) B
 {17, 20, 6, 8, -4, -2} {17, 20, 6, 8, -4, -2}
A.union(B).cardinality()
 9 9
A.intersection(B)
 {8, 6} {8, 6}
A.difference(B)
 {1, 2, 3} {1, 2, 3}
A.symmetric_difference(B)
 {17, 2, 3, 20, 1, -4, -2} {17, 2, 3, 20, 1, -4, -2}
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}
powA.cardinality()
 8 8
pairsA = A.subsets(2); pairsA
 Subsets of {1, 2, 3} of size 2 Subsets of {1, 2, 3} of size 2
pairsA.list()
 [{1, 2}, {1, 3}, {2, 3}] [{1, 2}, {1, 3}, {2, 3}]
tan(x)
 tan(x) tan(x)
tan(0)
 0 0
tan(pi/4)
 1 1
tan(pi/2)
 Infinity Infinity
tan(3*pi/4)
 -1 -1
tan(pi)
 0 0
[3,6..20]
 [3, 6, 9, 12, 15, 18] [3, 6, 9, 12, 15, 18]
M= Set[3,6..20] M
 {18, 3, 6, 9, 12, 15} {18, 3, 6, 9, 12, 15}
powM = M.subsets(); powM
 Subsets of {18, 3, 6, 9, 12, 15} Subsets of {18, 3, 6, 9, 12, 15}
powM.cardinality()
 64 64
tan(x)
 tan(x) tan(x)
[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
12.divisors()
 [1, 2, 3, 4, 6, 12] [1, 2, 3, 4, 6, 12]
(2^19-1).is_prime()
 True True
153.is_prime()
 False False
62.factor(62)
 2 * 31 2 * 31
24.prime_divisors()
 [2, 3] [2, 3]
gcd(14,63)
 7 7
lcm(4,5)
 20 20
divmod(956,98)
 (9, 74) (9, 74)
98*9+74
 956 956
3.divides(234878)
 False False
134.divisors()
 [1, 2, 67, 134] [1, 2, 67, 134]
491.divisors()
 [1, 491] [1, 491]
422.divisors()
 [1, 2, 211, 422] [1, 2, 211, 422]
1002.divisors()
 [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]
422.prime_divisors()
 [2, 211] [2, 211]
1002.prime_divisors()
 [2, 3, 167] [2, 3, 167]
gcd(2,5)
 1 1
lcm(2,5)
 10 10
2*5
 10 10
gcd(4,10)
 2 2
lcm(4,10)
 20 20
4*10
 40 40
g=gcd(18,51)
l=lcm(18,51)
g*l==18*51
 True True
max(14,5,8,-3,100)
 100 100
plot(abs(x), (x, -3, 3))