기초수학실습 0114 하영진

1979 days 전, portia0 작성

[-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]
[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
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 - 3) * (x - 1) * (x - 2)^3
(2) * (x - 3) * (x - 1) * (x - 2)^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
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]]
solve( [ 2*x + y == -1 , -4*x - 2*y == 0],x,y) 
       
[]
[]
solve( [ 2*x - y == -1 , 2*x - y == 2],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,y) 
       
([x == 7, x == -1, x == 1], [1, 1, 1])
([x == 7, x == -1, x == 1], [1, 1, 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='green')+plot(cos(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() 
       
Traceback (click to the left of this block for traceback)
...
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_4.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cCA9IHBsb3QoZih4KSwgKHgsLXBpLzIsIHBpLzIpLCBheGVzX2xhYmVscz0oJ3gnLCdzaW4oeCknLCBjb2xvcj0ncHVycGxlJykKcC5zaG93KCk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpVcvJ6j/___code___.py", line 3
    p = plot(f(x), (x,-pi/_sage_const_2 , pi/_sage_const_2 ), axes_labels=('x','sin(x)', color='purple')
                                                                                              ^
SyntaxError: invalid syntax
p = plot(f(x), (x,-pi/2, pi/2), linestyle='--', thickness=3) p.show 
       
<bound method Graphics.show of Graphics object consisting of 1
graphics primitive>
<bound method Graphics.show of Graphics object consisting of 1 graphics primitive>
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) 
       
plot(sin(pi*x-pi),(x,-1,1), thickness=3, color='red') 
       
plot(cos(pi*x-pi), (x,-1,1), thickness=5, color='blue') 
       
p1=plot(sin(pi*x-pi),(x,-1,1), thickness=3, color='red') p2=plot(cos(pi*x-pi), (x,-1,1), thickness=5, color='blue') show(p1+p2) 
       
p=plot(1/x,(x,-1,1),(y,-10,10)) p.show() 
       
Traceback (click to the left of this block for traceback)
...
TypeError: float() argument must be a string or a number
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_128.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cD1wbG90KDEveCwoeCwtMSwxKSwoeSwtMTAsMTApKQpwLnNob3coKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpZbVz9S/___code___.py", line 3, in <module>
    p=plot(_sage_const_1 /x,(x,-_sage_const_1 ,_sage_const_1 ),(y,-_sage_const_10 ,_sage_const_10 ))
  File "/usr/local/sage-5.12/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 692, in wrapper
    return func(*args, **kwds)
  File "/usr/local/sage-5.12/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 537, in wrapper
    return func(*args, **options)
  File "/usr/local/sage-5.12/local/lib/python2.7/site-packages/sage/plot/plot.py", line 1121, in plot
    G = funcs.plot(*args, **original_opts)
  File "expression.pyx", line 9522, in sage.symbolic.expression.Expression.plot (sage/symbolic/expression.cpp:40012)
  File "/usr/local/sage-5.12/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 692, in wrapper
    return func(*args, **kwds)
  File "/usr/local/sage-5.12/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 537, in wrapper
    return func(*args, **options)
  File "/usr/local/sage-5.12/local/lib/python2.7/site-packages/sage/plot/plot.py", line 1140, in plot
    G = _plot(funcs, (xmin, xmax), *args, **kwds)
  File "/usr/local/sage-5.12/local/lib/python2.7/site-packages/sage/plot/plot.py", line 1236, in _plot
    funcs, ranges = setup_for_eval_on_grid(funcs, [xrange], options['plot_points'])
  File "/usr/local/sage-5.12/local/lib/python2.7/site-packages/sage/plot/misc.py", line 121, in setup_for_eval_on_grid
    ranges = [[float(z) for z in r] for r in ranges]
TypeError: float() argument must be a string or a number
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) 
       
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),linestyle='--',color='red') 
       
f(x)=(x^2-4)/(x-2) 
       
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.