기초수학실습-신민석

2029 days 전, sms970316@naver.com 작성

plot(Piecewise([[(0,1),x^2],[(1,2),1],[(2,3),x^2-3]])) 
       
1 in ZZ 
       
True
True
sqrt(2) in QQ 
       
False
False
i^2 
       
-1
-1
QQ(.5) 
       
1/2
1/2
not True 
       
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
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)
x^2 + x + 1 
       
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]
[1,4..13] 
       
[1, 4, 7, 10, 13]
[1, 4, 7, 10, 13]
[1,11..31] 
       
[1, 11, 21, 31]
[1, 11, 21, 31]
       
{8, 1, 2, 3, 6}
{8, 1, 2, 3, 6}
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
B = Set([8,6,17,-4,20, -2 ]) 
       
A.union(B) 
       
{1, 2, 3, 6, 8, 17, 20, -4, -2}
{1, 2, 3, 6, 8, 17, 20, -4, -2}
A.intersection(B) 
       
{8, 6}
{8, 6}
A.difference(B) 
       
{1, 2, 3}
{1, 2, 3}
A.symmetric_differenc 
       
Traceback (click to the left of this block for traceback)
...
AttributeError: 'Set_object_enumerated_with_category' object has no
attribute 'symmetric_differenc'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_45.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("QS5zeW1tZXRyaWNfZGlmZmVyZW5j"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpbDKl0X/___code___.py", line 2, in <module>
    exec compile(u'A.symmetric_differenc
  File "", line 1, in <module>
    
  File "parent.pyx", line 761, in sage.structure.parent.Parent.__getattr__ (sage/structure/parent.c:6823)
  File "misc.pyx", line 251, in sage.structure.misc.getattr_from_other_class (sage/structure/misc.c:1606)
AttributeError: 'Set_object_enumerated_with_category' object has no attribute 'symmetric_differenc'
[tan(x) for x in[0, pi/4..pi]] 
       
[0, 1, Infinity, -1, 0]
[0, 1, Infinity, -1, 0]
 
       
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
63.factor() 
       
3^2 * 7
3^2 * 7
divmod(956,98) 
       
(9, 74)
(9, 74)
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]
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
abs(4) 
       
4
4