기초수학실습_김재섭

2028 days 전, jakl7436 작성

plot(Piecewise([[(0,1),x^2],[(1,2),1],[(2,3),x^2-3]])) 
       
plot(sin(x), (x,0,10), plot_points=20, linestyle='', marker='.') 
       
p1=plot(x*sin(3/x), x, -0.5,0, color='blue') p2=plot(x*sin(3/x), x, 0,0.5, color='red') show(p1+p2, ymax=0.3, ymin=-0.3, aspect_ratio=1) 
       
1 in ZZ 
       
True
True
1/2 in ZZ 
       
False
False
i^2 
       
-1
-1
i^3 
       
-I
-I
QQ(.5) 
       
1/2
1/2
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=49303 
       
       
49303
49303
t=7 
       
t=t+1 
       
       
8
8
a,b=1,2 
       
a,b 
       
(1, 2)
(1, 2)
a=4 b=5 
       
a,b 
       
(4, 5)
(4, 5)
 
       
f = x^2 + x + 1 f 
       
x^2 + x + 1
x^2 + x + 1
x=3 
       
f(x=3) 
       
13
13
f(x) = x^2 + x + 1 f(3) 
       
13
13
f(x)=x^6 + x + 356 f(3) 
       
1088
1088
[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..80] 
       
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80]
[4..9] 
       
[4, 5, 6, 7, 8, 9]
[4, 5, 6, 7, 8, 9]
[3,7..67] 
       
[3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67]
[3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67]
[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
6950 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.union(B) 
       
{1, 2, 3, 6, 8, 17, 20, -4, -2}
{1, 2, 3, 6, 8, 17, 20, -4, -2}
A.union(B).cardinality() 
       
9
9
A.intersection(B) 
       
{8, 6}
{8, 6}
A.intersection(B).cardinality() 
       
2
2
A.difference(B) 
       
{1, 2, 3}
{1, 2, 3}
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}]
tan(0) 
       
0
0
tan(pi/4) 
       
1
1
tan(pi/2) 
       
Infinity
Infinity
tan(3*pi/4) 
       
-1
-1
tan(pi) 
       
0
0
M = Set([3,6..20]) M 
       
{18, 3, 6, 9, 12, 15}
{18, 3, 6, 9, 12, 15}
M.cardinality() 
       
6
6
[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
12.divisors() 
       
[1, 2, 3, 4, 6, 12]
[1, 2, 3, 4, 6, 12]
(2^19-1).is_prime() 
       
True
True
63.factor() 
       
3^2 * 7
3^2 * 7
24.prime_divisors() 
       
[2, 3]
[2, 3]
gcd(14,63) 
       
7
7
lcm(4,5) 
       
20
20
divmod(956,98) 
       
(9, 74)
(9, 74)
234878.divides(3) 
       
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
gcd(18,51) 
       
3
3
lcm(18,51) 
       
306
306
18*51 
       
918
918
max(1020383,2181981,3214322) 
       
3214322
3214322
min(-545,-656,-4563) 
       
-4563
-4563
abs(-10) 
       
10
10
plot(abs(x), (x, -4, 4))