|
|
-1 -1 |
6 6 |
0.300000000000000 0.300000000000000 |
|
8 8 |
8 8 |
1/8 1/8 |
3^2 * 5 * 17 * 131 3^2 * 5 * 17 * 131 |
|
|
|
[x == -1/2*sqrt(5) + 3/2, x == 1/2*sqrt(5) + 3/2] [x == -1/2*sqrt(5) + 3/2, x == 1/2*sqrt(5) + 3/2] |
|
[x == 1, x == -1, x == 3] [x == 1, x == -1, x == 3] |
|
[[x == 4, y == 1]] [[x == 4, y == 1]] |
|
0.841470984807897 0.841470984807897 |
다음은 파이썬 방법이다.
|
|
|
Traceback (click to the left of this block for traceback) ... NameError: name 'h1' is not defined Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_24.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("aDEoMSwyKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> File "/tmp/tmpx6lPgV/___code___.py", line 3, in <module> exec compile(u'h1(_sage_const_1 ,_sage_const_2 ) File "", line 1, in <module> NameError: name 'h1' is not defined |
|
|
e^2 e^2 |
1.34227313101524e6 1.34227313101524e6 |
$\frac{d}{dx} k(x)$
0 0 |
|
$\frac{d}{dx} f(x)$
0 0 |
$\frac{d}{dx} \sin(x)$
0 0 |
|
$\frac{\partial}{\partial x} \sin(x y)$
|
y*cos(x*y) y*cos(x*y) |
-0.841470984807897 -0.841470984807897 |
$\frac{\partial^2}{\partial x^2} \sin(x y)$
Traceback (click to the left of this block for traceback) ... NameError: name 'y' is not defined Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_21.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZGlmZihzaW4oeCp5KSx5KQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> File "/tmp/tmpfot9cH/___code___.py", line 2, in <module> exec compile(u'diff(sin(x*y),y) File "", line 1, in <module> NameError: name 'y' is not defined |
$\frac{\partial^3}{\partial x \partial y^2} \sin(x y)$
x^20*y*cos(x*y) + 20*x^19*sin(x*y) x^20*y*cos(x*y) + 20*x^19*sin(x*y) |
-x*y*sin(x*y) + cos(x*y) -x*y*sin(x*y) + cos(x*y) |
위 예제에서 편미분이 미분 순서에 무관함을 보이시오.
$\int k(x) dx$
Traceback (click to the left of this block for traceback) ... NameError: name 'k' is not defined Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_28.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZmY9aW50ZWdyYWwoayh4KSx4KQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> File "/tmp/tmpTaLj37/___code___.py", line 2, in <module> exec compile(u'ff=integral(k(x),x) File "", line 1, in <module> NameError: name 'k' is not defined |
-x*cos(x) + sin(x) -x*cos(x) + sin(x) |
x*sin(x) x*sin(x) |
$\int_1^2 k(x) dx$
|
1/2*sqrt(pi)*erf(1) 1/2*sqrt(pi)*erf(1) |
위의 결과를 소수로 나타내기 위해서는 함수 $n()$을 점(.)으로 덧붙이면 된다 (객체지향 언어의 특성).
0.746824132812427 0.746824132812427 |
|
$\int_0^\pi \sin(x)^2 dx$ 를 수치계산과 정확한 계산으로 구해보고 비교해 보자. 두 계산 결과가 오차범위내에서 일치함을 주목하라.
|
1/2*pi 1/2*pi |
1.5707963267948966192 1.5707963267948966192 |
$\int_0^\infty e^{-\sqrt{x}} dx$
|
|
e^(-x^2) e^(-x^2) |
|
(1.7724538509055137, 3.429548872025538e-08) (1.7724538509055137, 3.429548872025538e-08) |
2 2 |
(1.0226025498810094, 6.629450086680393e-07) (1.0226025498810094, 6.629450086680393e-07) |
|
(1.0226025498810094, 6.629450086680393e-07) (1.0226025498810094, 6.629450086680393e-07) |
|
2*sin(2) 2*sin(2) |
|
|
|
5/2 5/2 |
|
|
y^3 + x^2 + 2*x*y y^3 + x^2 + 2*x*y |
13.3750000000000 13.3750000000000 |
2*sin(2) 2*sin(2) |
2*cos(2) + sin(2) 2*cos(2) + sin(2) |
0.0770037537313969 0.0770037537313969 |
pi pi |
3.1415926535897932384626433832795028841971693993751058209749445923078164\ 06286208998628034825342117068 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068 |
|
|
|
|
1.818594853651363390792039731823489685405 1.818594853651363390792039731823489685405 |
|
|
[a, b, 3] [a, b, 3] |
3 3 |
|
[a, b, 3, c] [a, b, 3, c] |
[a, b, 3, c, d] [a, b, 3, c, d] |
[a, b, 3, c, d] [a, b, 3, c, d] |
|
[a, 3, c, d] [a, 3, c, d] |
|
[a, 3, c] [a, 3, c] |
a 3 c a 3 c |
c c |
|
|
|
|
|
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] |
[2, 3, 4, 5, 6, 7, 8, 9] [2, 3, 4, 5, 6, 7, 8, 9] |
[11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] |
[2, 5, 8, 11, 14, 17] [2, 5, 8, 11, 14, 17] |
[1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49] [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49] |
[2.00000000000000, 2.10000000000000, 2.20000000000000, 2.30000000000000, 2.40000000000000, 2.50000000000000, 2.60000000000000, 2.70000000000000, 2.80000000000000, 2.90000000000000] [2.00000000000000, 2.10000000000000, 2.20000000000000, 2.30000000000000, 2.40000000000000, 2.50000000000000, 2.60000000000000, 2.70000000000000, 2.80000000000000, 2.90000000000000] |
|
array([ 2. , 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3. , 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4. , 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5. , 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6. , 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7. , 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8. , 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9. , 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9]) array([ 2. , 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3. , 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4. , 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5. , 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6. , 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7. , 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8. , 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9. , 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9]) |
|
Traceback (click to the left of this block for traceback) ... NameError: name 'k' is not defined Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_21.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cGxvdChrKHgpLHgsMCwzLGZpZ3NpemU9NSk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> File "/tmp/tmpiNXNjd/___code___.py", line 3, in <module> exec compile(u'plot(k(x),x,_sage_const_0 ,_sage_const_3 ,figsize=_sage_const_5 ) File "", line 1, in <module> NameError: name 'k' is not defined |
|
한 그림창에 여러개 그리기
|
여러개 그림창을 동시에 그리기
|
히스토그램
|
|
|
|
|
|
|
|
|
|
3D List Plot
|
|
|
(1, 2, 3) (1, 2, 3) |
(-1, 3, 5) (-1, 3, 5) |
20 20 |
(1, -8, 5) (1, -8, 5) |
(-1, 8, -5) (-1, 8, -5) |
[ 1 2 3] [ 2 5 6] [-1 0 3] [ 1 2 3] [ 2 5 6] [-1 0 3] |
(14, 30, 8) (14, 30, 8) |
(2, 12, 24) (2, 12, 24) |
[ 5/2 -1 -1/2] [ -2 1 0] [ 5/6 -1/3 1/6] [ 5/2 -1 -1/2] [ -2 1 0] [ 5/6 -1/3 1/6] |
|
[1 0 0] [0 1 0] [0 0 1] [1 0 0] [0 1 0] [0 0 1] |
[1 0 0] [0 1 0] [0 0 1] [1 0 0] [0 1 0] [0 0 1] |
6 6 |
[1 2 3] [2 1 4] [3 4 5] [1 2 3] [2 1 4] [3 4 5] |
8 8 |
[-1.486979759027261?, -0.592545608423468?, 9.07952536745073?] [-1.486979759027261?, -0.592545608423468?, 9.07952536745073?] |
[(-1.486979759027261?, [(1, -7.323700036494775?, 4.053473437987430?)], 1), (-0.592545608423468?, [(1, -0.11487917829899307?, -0.4542624172751605?)], 1), (9.07952536745073?, [(1, 1.188579214793769?, 1.900788979287731?)], 1)] [(-1.486979759027261?, [(1, -7.323700036494775?, 4.053473437987430?)], 1), (-0.592545608423468?, [(1, -0.11487917829899307?, -0.4542624172751605?)], 1), (9.07952536745073?, [(1, 1.188579214793769?, 1.900788979287731?)], 1)] |
[(1, -7.323700036494775?, 4.053473437987430?)] [(1, -7.323700036494775?, 4.053473437987430?)] |
(1, -7.323700036494775?, 4.053473437987430?) (1, -7.323700036494775?, 4.053473437987430?) |
(1.000000000000000?, -7.323700036494775?, 4.053473437987430?) (1.000000000000000?, -7.323700036494775?, 4.053473437987430?) |
1 3 6 10 15 21 28 36 45 55 1 3 6 10 15 21 28 36 45 55 |
6252500 6252500 |
30 30 |
3628800 3628800 |
272539213975072950298071324540091863329079633054580341373432882344310620\ 1171875 2725392139750729502980713245400918633290796330545803413734328823443106201171875 |
45 362880 285 합= 45 , 그리고 product= 362880 45 362880 285 합= 45 , 그리고 product= 362880 |
합= 5 , 곱= 6 합= 5 , 곱= 6 |
8 8 |
8 8 |
142857 142857 |
250000 250000 |
12497500 12497500 |
71 71 |
533629132822947850455910456240429804096524722803842600971013492484562688\ 894971017575060979019850356914090887315504680983784421721178850094643023\ 443265660225021002784256328520814055449412104425101426727702947747127089\ 179639677796104532246924268664688882815820719848971051107968732493191555\ 293970175089315645199760857344730141832840117244122806490743077037366831\ 700558002936592350885893602352858528081607595747378366554131755081315225\ 17/712886527466509305316638415571427292066835886188589304045200199115432\ 408758111149947644415191387158691171781701957525651298026406762100925146\ 587100430513107268626814320019660997486274593718834370501543445252373974\ 529896314567498212823695623282379401106880926231770886197954079124775455\ 804932647573782992335275179673524804246363805113703433121478174685087845\ 348567802188807537324992199567205693202909939089168748767269795093160352\ 0000 53362913282294785045591045624042980409652472280384260097101349248456268889497101757506097901985035691409088731550468098378442172117885009464302344326566022502100278425632852081405544941210442510142672770294774712708917963967779610453224692426866468888281582071984897105110796873249319155529397017508931564519976085734473014183284011724412280649074307703736683170055800293659235088589360235285852808160759574737836655413175508131522517/7128865274665093053166384155714272920668358861885893040452001991154324087581111499476444151913871586911717817019575256512980264067621009251465871004305131072686268143200196609974862745937188343705015434452523739745298963145674982128236956232823794011068809262317708861979540791247754558049326475737829923352751796735248042463638051137034331214781746850878453485678021888075373249921995672056932029099390891687487672697950931603520000 |
7.48547086055035 7.48547086055035 |
응용: 적분
0.999923631223926 0.999923631223926 |
0.346569663294292 0.346569663294292 |
0.346573590279973 0.346573590279973 |
-3 :a negative number -1 :a negative number -2 :a negative number 0 :a zero 1 :a positive number 2 :a positive number 3 :a positive number 4 :a positive number -3 :a negative number -1 :a negative number -2 :a negative number 0 :a zero 1 :a positive number 2 :a positive number 3 :a positive number 4 :a positive number |
0.702863691057069 0.702863691057069 |
-1 :a negative number -2 :a negative number -1 :a negative number -1 :a negative number -2 :a negative number -1 :a negative number |
Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax Traceback (most recent call last): print s File "", line 1, in <module> File "/tmp/tmpnDP8L3/___code___.py", line 6 elif i%_sage_const_5 ==_sage_const_0 : ^ SyntaxError: invalid syntax |
|
|
33 33 |
11 11 |
11 11 |
위 리스트의 음수의 합을 구해보라.
1 -1 1 -3 1 -5 1 11 1 12 2 2 2 2 2 3 2 4 2 7 1 -1 1 -3 1 -5 1 11 1 12 2 2 2 2 2 3 2 4 2 7 |
44 990 44 990 |
44 990 44 990 |
|
990 990 |
140 9967 140 9967 |
|
합이 1000을 넘지 않을때까지 더해보자
44 990 44 990 |
990 990 |
|
0 1 1 1 2 2 3 6 4 24 5 120 0 1 1 1 2 2 3 6 4 24 5 120 |
|
6 120 6 120 |
|
3 3 |
5 5 |
|
24 24 |
Give a positive number Give a positive number |