기초수학반실습 0114 정해석

1978 days 전, jlh516 작성

[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]
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
show(expand(P(x))) 
       
factor(P(x)) 
       
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, 70*x - 40)*P(x)+70*x - 40 
       
Traceback (click to the left of this block for traceback)
...
TypeError: unsupported operand parent(s) for '*': '<type 'tuple'>'
and 'Symbolic Ring'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_19.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("KDIqeF4zIC0gMTAqeF4yICsgMjYqeCAtIDgsIDcwKnggLSA0MCkqUCh4KSs3MCp4IC0gNDA="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpk1JZ8P/___code___.py", line 3, in <module>
    exec compile(u'(_sage_const_2 *x**_sage_const_3  - _sage_const_10 *x**_sage_const_2  + _sage_const_26 *x - _sage_const_8 , _sage_const_70 *x - _sage_const_40 )*P(x)+_sage_const_70 *x - _sage_const_40 
  File "", line 1, in <module>
    
  File "element.pyx", line 1701, in sage.structure.element.RingElement.__mul__ (sage/structure/element.c:14531)
  File "coerce.pyx", line 856, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:8169)
TypeError: unsupported operand parent(s) for '*': '<type 'tuple'>' and 'Symbolic Ring'
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 == 0],x,y) 
       
[]
[]
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]]
solve([x^3-x==7*x^2-7],x) 
       
[x == 7, x == -1, x == 1]
[x == 7, x == -1, x == 1]
var('t') solve(abs(t-7)>=3,t) 
       
#0: solve_rat_ineq(ineq=abs(t-7) >= 3)
[[t == 10], [t == 4], [t < 4], [10 < t]]
#0: solve_rat_ineq(ineq=abs(t-7) >= 3)
[[t == 10], [t == 4], [t < 4], [10 < t]]
solve([2*x + y == 17 , x - 3*y == -16],x,y) 
       
[[x == 5, y == 7]]
[[x == 5, y == 7]]
f(x) = sin(x) p = plot(f(x), (x, 0, 2*pi), color='red') p.show() 
       
p = plot(f(x), (x,-pi/2, pi/2), axes_labels=['x','sin(x)'], color='purple') p.show() 
       
f(x) = sin(x) g(x) = cos(x) p = plot(f(x),(x,-pi/2,pi/2), color='black') q = plot(g(x), (x,-pi/2, pi/2), color='red') r = p + q r.show() 
       
f(x) = (x^3 + x^2 + x)/(x^2 - x -2 ) p = plot(f(x), (x, -5,5)) p.show(p.show(xmin=-2, xmax=4, ymin=-20, ymax=20)) 
       

Traceback (click to the left of this block for traceback)
...
TypeError: show() takes exactly 1 argument (3 given)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_46.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("Zih4KSA9ICh4XjMgKyB4XjIgKyB4KS8oeF4yIC0geCAtMiApCnAgPSBwbG90KGYoeCksICh4LCAtNSw1KSkKcC5zaG93KHAuc2hvdyh4bWluPS0yLCB4bWF4PTQsIHltaW49LTIwLCB5bWF4PTIwKSk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmp0mHsHS/___code___.py", line 5, in <module>
    exec compile(u'p.show(p.show(xmin=-_sage_const_2 , xmax=_sage_const_4 , ymin=-_sage_const_20 , ymax=_sage_const_20 ))
  File "", line 1, in <module>
    
  File "/usr/local/sage-5.12/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 458, in wrapper
    return func(*args, **kwds)
TypeError: show() takes exactly 1 argument (3 given)
p = plot(sin(pi*x-pi), (x,-1, 1), thickness=3, color='red') p.show() 
       
p = plot(cos(pi*x-pi), (x,-1, 1), thickness=3, color='blue') p.show() 
       
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(1/x, (x,-1,1)) p.show(ymin=-10, ymax=10) 
       
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절편 구하기 
       
[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) 
       
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=-10000) 
       
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)) 
       
plot(f(x), (x, -6, 6)) plot(f(x), (x, -4, 6), ymax=20, ymin=-20) 
       
x,y = var("x y") f(x,y) = x^2 - y^2 p = plot3d(f(x,y), (x,-10,10), (y,-10,10)) p.show() 
       
Sleeping...
If no image appears re-execute the cell. 3-D viewer has been updated.