# 14.1.2016 기초수학 장세영

## 2410 days 전, seoyo1 작성

[-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]
[1..100]
 [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, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] [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, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]
[a.is_prime() for a in [1..100]]
 [False, True, True, False, True, False, True, False, False, False, True, False, True, False, False, False, True, False, True, False, False, False, True, False, False, False, False, False, True, False, True, False, False, False, False, False, True, False, False, False, True, False, True, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, True, False, False, False, False, False, True, False, False, False, True, False, True, False, False, False, False, False, True, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, False, False, True, False, False, False] [False, True, True, False, True, False, True, False, False, False, True, False, True, False, False, False, True, False, True, False, False, False, True, False, False, False, False, False, True, False, True, False, False, False, False, False, True, False, False, False, True, False, True, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, True, False, False, False, False, False, True, False, False, False, True, False, True, False, False, False, False, False, True, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, False, False, True, False, False, False]
b=[] for a in [1..100]: if a.is_prime(): b.append(a) print b
 [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
--다항식의전개/인수분해
 Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax Traceback (most recent call last): File "", line 1, in File "_sage_input_11.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("LeuLpO2VreyLneydmOyghOqwnA=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmplI7PNH/___code___.py", line 2 -다항식의전개 ^ SyntaxError: invalid syntax
P(x)=(x-2)^3*(x^2-4*x+3)*2 P(x)
 2*(x^2 - 4*x + 3)*(x - 2)^3 2*(x^2 - 4*x + 3)*(x - 2)^3
expand(P(x))
 2*x^5 - 20*x^4 + 78*x^3 - 148*x^2 + 136*x - 48 2*x^5 - 20*x^4 + 78*x^3 - 148*x^2 + 136*x - 48
factor(2*x^5 - 20*x^4 + 78*x^3 - 148*x^2 + 136*x - 48)
 2*(x - 1)*(x - 2)^3*(x - 3) 2*(x - 1)*(x - 2)^3*(x - 3)
(P(x)/(x-1))
 2*(x^2 - 4*x + 3)*(x - 2)^3/(x - 1) 2*(x^2 - 4*x + 3)*(x - 2)^3/(x - 1)
(P(x)/(x-1)).simplify_full()
 2*x^4 - 18*x^3 + 60*x^2 - 88*x + 48 2*x^4 - 18*x^3 + 60*x^2 - 88*x + 48
W.<x>=QQ[] W(P(x)).quo_rem(x^2-5*x+1)
 (2*x^3 - 10*x^2 + 26*x - 8, 70*x - 40) (2*x^3 - 10*x^2 + 26*x - 8, 70*x - 40)
(2*x^3 - 10*x^2 + 26*x - 8)*(x^2-5*x+1)+70*x - 40
 2*x^5 - 20*x^4 + 78*x^3 - 148*x^2 + 136*x - 48 2*x^5 - 20*x^4 + 78*x^3 - 148*x^2 + 136*x - 48
--변수가 여러 개인 방정식
 Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax Traceback (most recent call last): File "", line 1, in File "_sage_input_46.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("LeuzgOyImOqwgCDsl6zrn6wg6rCc7J24IOuwqeygleyLnQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmpjpzuE4/___code___.py", line 2 -변수가 여러 개인 방정식 ^ SyntaxError: invalid syntax
var('x,y') solve( [3*x - y == 2, -2*x -y == 1 ], x,y)
 [[x == (1/5), y == (-7/5)]] [[x == (1/5), y == (-7/5)]]
solve( [ 2*x + y == -1 , -4*x - 2*y == 2],x,y)
 [[x == -1/2*r1 - 1/2, y == r1]] [[x == -1/2*r1 - 1/2, y == r1]]
var('z') solve([ 2*x + 3*y + 5*z == 1, 4*x + 6*y + 10*z == 2, 6*x + 9*y + 15*z == 3], x,y,z)
 [[x == -5/2*r4 - 3/2*r5 + 1/2, y == r5, z == r4]] [[x == -5/2*r4 - 3/2*r5 + 1/2, y == r5, z == r4]]
--문제
 Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax Traceback (most recent call last): File "", line 1, in File "_sage_input_51.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("66y47KCc"),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmp5_4n0p/___code___.py", line 2 문제 ^ SyntaxError: invalid syntax
solve(x^3-x==7*x^2-7, x)
 [x == 7, x == -1, x == 1] [x == 7, x == -1, x == 1]
solve([abs(x-7)>=3],x)
 #0: solve_rat_ineq(ineq=abs(x-7) >= 3) [[x == 10], [x == 4], [x < 4], [10 < x]] #0: solve_rat_ineq(ineq=abs(x-7) >= 3) [[x == 10], [x == 4], [x < 4], [10 < x]]
solve( [ 2*x + y == 17 , x - 3*y == -16 ],x,y)
 [[x == 5, y == 7]] [[x == 5, y == 7]]
--그림 그리기
 Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax Traceback (most recent call last): File "", line 1, in File "_sage_input_69.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("LS3qt7jrprwg6re466as6riw"),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmpWa0mF3/___code___.py", line 2 --그림 그리기 ^ SyntaxError: invalid syntax
f(x) = sin(x) p = plot(f(x), (x, -pi/2, pi/2), color='red') p.show()
--라벨/색깔
 Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax Traceback (most recent call last): File "", line 1, in File "_sage_input_73.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("LS3rnbzrsqgv7IOJ6rmU"),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmpqUHdYk/___code___.py", line 2 --라벨/색깔 ^ SyntaxError: invalid syntax
plot(f(x), (x,-pi/2, pi/2), axes_labels=['x','sin(x)'], color='purple')
--곡선 두께
 Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax Traceback (most recent call last): File "", line 1, in File "_sage_input_77.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("LS3qs6HshKAg65GQ6ruY"),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmp_D9qf1/___code___.py", line 2 --곡선 두께 ^ SyntaxError: invalid syntax
plot(f(x), (x,-pi/2, pi/2), linestyle='--', thickness=3) p.show()
--두 그래프를 동시에 ( + 사용)
 Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax Traceback (most recent call last): File "", line 1, in File "_sage_input_79.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("LS3rkZAg6re4656Y7ZSE66W8IOuPmeyLnOyXkCAoICsg7IKs7JqpKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmpTD1g5y/___code___.py", line 2 --두 그래프를 동시에 ( + 사용) ^ SyntaxError: invalid syntax
sage: f(x) = sin(x) sage: g(x) = cos(x) sage: p = plot(f(x),(x,-pi/2,pi/2), color='black') sage: q = plot(g(x), (x,-pi/2, pi/2), color='red') sage: r = p + q sage: r.show()
--원하지 않는 모양이 나올 수도 있다.
 Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax 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("LS3sm5DtlZjsp4Ag7JWK64qUIOuqqOyWkeydtCDrgpjsmKwg7IiY64+EIOyeiOuLpC4="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmpbVOpPb/___code___.py", line 2 --원하지 않는 모양이 나올 수도 있다. ^ SyntaxError: invalid syntax
f(x) = (x^3 + x^2 + x)/(x^2 - x -2 ) p = plot(f(x), (x, -5,5)) p.show(xmin=-2, xmax=4, ymin=-20, ymax=20)
--문제
 Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax Traceback (most recent call last): File "", line 1, in File "_sage_input_88.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("LS3rrLjsoJw="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmp4M6nhL/___code___.py", line 2 --문제 ^ SyntaxError: invalid syntax
plot(sin(pi*x-pi), (x,-1, 1),thickness=3 , color='red')
plot(cos(pi*x-pi), (x,-1, 1),thickness=3 , color='blue')
f(x) = sin(x) g(x) = cos(x) p=plot(sin(pi*x-pi), (x,-1, 1),thickness=3 , color='red') q=plot(cos(pi*x-pi), (x,-1, 1),thickness=3 , color='blue') r=p+q r.show()
f(x) = 1/x p= plot(f(x), (x, -1, 1)) p.show(xmin=-1, xmax=1, ymin=-10, ymax=10)
--다항함수의 그래프 그리기
 Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax Traceback (most recent call last): File "", line 1, in File "_sage_input_101.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("LS3ri6Ttla3tlajsiJjsnZgg6re4656Y7ZSEIOq3uOumrOq4sA=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmp2R5Fuh/___code___.py", line 2 --다항함수의 그래프 그리기 ^ SyntaxError: invalid syntax
P(x)=2*x^3+3*x^2-5*x-6 solve(P(x)==0, x)
 [x == -2, x == -1, x == (3/2)] [x == -2, x == -1, x == (3/2)]
plot(P(x), (x, -4, 4), ymax=20, ymin=-20)
P(x)=4*x^4++4*x^3-9*x^2-x+2 solve(P(x)==0, x)
 [x == (1/2), x == -2, x == 1, x == (-1/2)] [x == (1/2), x == -2, x == 1, x == (-1/2)]
plot(P(x), (x, -3, 3), ymax=20, ymin=-20)
--유리함수의 그래프 그리기
 Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax Traceback (most recent call last): File "", line 1, in File "_sage_input_108.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("LS3snKDrpqztlajsiJjsnZgg6re4656Y7ZSEIOq3uOumrOq4sA=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmp36P1ju/___code___.py", line 2 --유리함수의 그래프 그리기 ^ SyntaxError: invalid syntax
f(x)=2/(x-5) plot(f(x), (x, 2, 7), ymax=10, ymin=-10)
f(x)=-4/((x-4)^2) plot(f(x), (x, 2, 7), ymax=10, ymin=-20)
f(x)=(2*x^2+1)/(x^2-4*x+3) plot(f(x), (x, -2, 6), ymax=20, ymin=-20)
f(x)=(2*x^2-1)/(x^2+1) plot(f(x), (x, -6, 6), ymax=3)+plot(2, (x, -6, 6), color='red')
f(x)=(x^2-4)/(x-2) plot(f(x), (x, -6, 6))
f(x)=(x+2)/(x^2-x-6) plot(f(x), (x, -4, 6), ymax=20, ymin=-20)
--3D Graphics 기본 명령어는 plot3d()
 Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax Traceback (most recent call last): File "", line 1, in File "_sage_input_118.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("LS0zRCBHcmFwaGljcwrquLDrs7gg66qF66C57Ja064qUIHBsb3QzZCgp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmpNKQkcH/___code___.py", line 2 --3D Graphics ^ SyntaxError: invalid syntax
sage: x,y = var("x y") sage: f(x,y) = x^2 - y^2 sage: p = plot3d(f(x,y), (x,-10,10), (y,-10,10)) sage: p.show()
 script ERROR: script ERROR: io error reading /root/.sage/sage_notebook.sagenb/home/__store__/f/f4/f41/f416/seoyo1/2/c\ ells/55/sage0-size500-367578640.jmol.zip|SCRIPT: java.io.FileNotFoundException: /root/.sage/sage_notebook.sagenb/home/__store__/f/f4/f41/f416/seoyo1/2/c\ ells/55/sage0-size500-367578640.jmol.zip (그런 파일이나 디렉터리가 없습니다) script ERROR: script ERROR: io error reading /root/.sage/sage_notebook.sagenb/home/__store__/f/f4/f41/f416/seoyo1/2/cells/55/sage0-size500-367578640.jmol.zip|SCRIPT: java.io.FileNotFoundException: /root/.sage/sage_notebook.sagenb/home/__store__/f/f4/f41/f416/seoyo1/2/cells/55/sage0-size500-367578640.jmol.zip (그런 파일이나 디렉터리가 없습니다) Sleeping...