SharedHandouts / c03.sagewsOpen in CoCalc
Author: Alejandra Roman
Views : 9
623 * 937
583751
3**17
129140163
sin(47 * (pi/180))
sin(47/180*pi)
N(sin(47 * (pi/180), digits=10))
Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags), namespace, locals) File "", line 1, in <module> File "sage/symbolic/function.pyx", line 897, in sage.symbolic.function.BuiltinFunction.__call__ (build/cythonized/sage/symbolic/function.cpp:10396) def __call__(self, *args, bint coerce=True, bint hold=False, TypeError: __call__() got an unexpected keyword argument 'digits'
#I wrote the expression like how it is written in the worksheet I am not sure why I am getting an error plot(cos(x), (0, 2*pi))
plot(x^2, (-2,2))
plot(x^3, (-2,2))
#On problem 7 I couldn't figure out how to use the help action for the plot function #same problem on 8 because I don't know where the color option is f(x) = x^3-x x**3-x
x^3 - x
f(1)
0
f(100)
999900
plot(f, -2,2)
plot(f(x), -2,2)
plot(f)
c=27/14 f(c)
14391/2744
var("y") g(x,y)= x**2+y**2-2 plot3d(g(x,y), (x,-1,1),(y,-1,1))
y
3D rendering not yet implemented
solve(x**2-1,x)
[x == -1, x == 1]
x^2+1 = 0
Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags), namespace, locals) File "<string>", line 1 SyntaxError: can't assign to operator
#tried different ways of solving an equation but it keeps giving me syntax error solve(x^2+x=25,x)
Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags), namespace, locals) File "<string>", line 1 SyntaxError: keyword can't be an expression
#kept trying to solve this but not sure how to solve(sin(x)-.5,x)
[x == 1/6*pi]
#sage doesn't take into account all possible solutions var("a b c") solve(a*x**2+b*x+c, x)
(a, b, c) [x == -1/2*(b + sqrt(b^2 - 4*a*c))/a, x == -1/2*(b - sqrt(b^2 - 4*a*c))/a]
plot(x^5+x^4+x^3-x^2+x-1)
find_root(x**5+x**4+x**3-x**2+x-1,-1,1)
0.7104342557869125
find_root(x**5+x**4+x**3-x**2+x-1,-1,0)
Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags), namespace, locals) File "", line 1, in <module> File "sage/misc/lazy_import.pyx", line 354, in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/lazy_import.c:3690) return self.get_object()(*args, **kwds) File "/ext/sage/sage-8.8_1804/local/lib/python2.7/site-packages/sage/numerical/optimize.py", line 106, in find_root return f.find_root(a=a,b=b,xtol=xtol,rtol=rtol,maxiter=maxiter,full_output=full_output) File "sage/symbolic/expression.pyx", line 11825, in sage.symbolic.expression.Expression.find_root (build/cythonized/sage/symbolic/expression.cpp:61353) return find_root(f, a=a, b=b, xtol=xtol, File "/ext/sage/sage-8.8_1804/local/lib/python2.7/site-packages/sage/numerical/optimize.py", line 139, in find_root raise RuntimeError("f appears to have no zero on the interval") RuntimeError: f appears to have no zero on the interval