실습1

2336 days 전, jhlee2chn 작성

1. 실습한 내용

1 $\in$ $Z$.

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
2^(1/3) in RR
 True True
sqrt(4) in QQ
 True True
i^2
 -1 -1
I in RR
 False False
I in CC
 True True
QQ(.5)
 1/2 1/2
RR(sqrt(2))
 1.41421356237310 1.41421356237310
(sqrt(2)).n(digits=20)
 1.4142135623730950488 1.4142135623730950488
not True
 False False
True and False
 False False
True or False
 True True
(True or False) and False
 False False
1 == 1
 True True
not(True or False) == True and False
 False False
not (True or False) == (False and True)
 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
x=1/3 x > 1/2
 False False
t=t+1 t
 9 9
((3/2) > 1) ^^ (2/3 < 1)
 False False
s=12;s
 12 12
t=7 t=t+1 t
 8 8
a,b=1,2 a
 1 1
 2 2
c,d,e=2,3,5
c,d,e
 (2, 3, 5) (2, 3, 5)
a = b = 1
 1 1
 1 1
f(x) = x^2 + x + 1
f(2)
 7 7
f(3)
 13 13
[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]
[4..9]
 [4, 5, 6, 7, 8, 9] [4, 5, 6, 7, 8, 9]
[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..31]
 [1, 11, 21, 31] [1, 11, 21, 31]
[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]
[pi/4, pi/2..2*pi]
 [1/4*pi, 1/2*pi, 3/4*pi, pi, 5/4*pi, 3/2*pi, 7/4*pi, 2*pi] [1/4*pi, 1/2*pi, 3/4*pi, pi, 5/4*pi, 3/2*pi, 7/4*pi, 2*pi]
[sin(t) for t in [pi/4, pi/2..2*pi]]
 [1/2*sqrt(2), 1, 1/2*sqrt(2), 0, -1/2*sqrt(2), -1, -1/2*sqrt(2), 0] [1/2*sqrt(2), 1, 1/2*sqrt(2), 0, -1/2*sqrt(2), -1, -1/2*sqrt(2), 0]
A = Set([2,3,3,3,2,1,8,6,3]) A
 {8, 1, 2, 3, 6} {8, 1, 2, 3, 6}
C = Set([sin(t) for t in [pi/4, pi/2..2*pi]]) C
 {0, 1, -1/2*sqrt(2), 1/2*sqrt(2), -1} {0, 1, -1/2*sqrt(2), 1/2*sqrt(2), -1}
A.cardinality()
 5 5
8 in A
 True True
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).cardinality()
 2 2
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}
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.list()
 [{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}] [{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}]
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}]
[-9, -7..30]
 [-9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29] [-9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]
[-18, -15..100]
 [-18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99] [-18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99]
Set([tan(t) for t in [0, pi/4..pi]])
 {0, 1, Infinity, -1} {0, 1, Infinity, -1}
A=Set([3, 6..20]) A
 {18, 3, 6, 9, 12, 15} {18, 3, 6, 9, 12, 15}
powA=A.subsets() powA.cardinality()
 64 64
f(x)=x^2+3*x plot(f(x), (x, -5, 5))
f(x)=x^2+3*x plot(f(x), (x, -5, 5))