응용수학개론

271 days 전, leejoon8723 작성

var('x') # Define variable "x" A =plot(x^3/8, x, -3, 3, linestyle = "--", color = 'green') B = plot(-1/x, x ,-3, 3) #graph the second function C = text("y=x^3/8", (3,4), color = 'green', fontsize = 15) # add the text on given position D = text("y= -1/x^n, (-1,5), fontsize = 15) # and set the font of the text show(A + B + C + D, ymax = 10, ymin = -10) #display graphs and texts one time 
       
Traceback (click to the left of this block for traceback)
...
SyntaxError: EOL while scanning string literal
Traceback (most recent call last):        # and set the font of the text
  File "", line 1, in <module>
    
  File "/tmp/tmpMIYemF/___code___.py", line 8
    D = text("y= -1/x^n, (-1,5), fontsize = 15)
                                              ^
SyntaxError: EOL while scanning string literal
var('x') f1(x) = x f2(x) = 4 - x # graph f1 on (0,2), and f2 on (2,4) plot(piecewise([((0,2),f1), ((2,4,f2]},(x, 0, 4)) 
       
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_14.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("dmFyKCd4JykKZjEoeCkgPSB4CmYyKHgpID0gNCAtIHgKIyAgICBncmFwaCBmMSBvbiAoMCwyKSwgYW5kIGYyIG9uICgyLDQpCnBsb3QocGllY2V3aXNlKFsoKDAsMiksZjEpLCAoKDIsNCxmMl19LCh4LCAwLCA0KSk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmp3PPG8U/___code___.py", line 7
    plot(piecewise([((_sage_const_0 ,_sage_const_2 ),f1), ((_sage_const_2 ,_sage_const_4 ,f2]},(x, _sage_const_0 , _sage_const_4 ))
                                                                                            ^
SyntaxError: invalid syntax