Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
| Download
Project: math480-2016
Views: 3191Math 480: Open Source Mathematical Software
2016-04-27
William Stein
Lectures 14: Symbolic Calculus (part 2/3)
Topics
(reminder: screencast)
finding roots: symbolic, numerical
numerical approximation of a symbolic expression
more about 2d plotting
more about 3d plots
Finding Roots: symbolic
You can use the solve command to solve for zeroes of a function.
x^2 + 3 == 5
x^2 == 2
pi == pi
True
[x == -1/2*sqrt(((2*I*sqrt(15) + 2)^(2/3) + 4)/(2*I*sqrt(15) + 2)^(1/3)) - 1/2*sqrt(-(2*I*sqrt(15) + 2)^(1/3) - 4/(2*I*sqrt(15) + 2)^(1/3) + 4/sqrt(((2*I*sqrt(15) + 2)^(2/3) + 4)/(2*I*sqrt(15) + 2)^(1/3))), x == -1/2*sqrt(((2*I*sqrt(15) + 2)^(2/3) + 4)/(2*I*sqrt(15) + 2)^(1/3)) + 1/2*sqrt(-(2*I*sqrt(15) + 2)^(1/3) - 4/(2*I*sqrt(15) + 2)^(1/3) + 4/sqrt(((2*I*sqrt(15) + 2)^(2/3) + 4)/(2*I*sqrt(15) + 2)^(1/3))), x == 1/2*sqrt(((2*I*sqrt(15) + 2)^(2/3) + 4)/(2*I*sqrt(15) + 2)^(1/3)) - 1/2*sqrt(-(2*I*sqrt(15) + 2)^(1/3) - 4/(2*I*sqrt(15) + 2)^(1/3) - 4/sqrt(((2*I*sqrt(15) + 2)^(2/3) + 4)/(2*I*sqrt(15) + 2)^(1/3))), x == 1/2*sqrt(((2*I*sqrt(15) + 2)^(2/3) + 4)/(2*I*sqrt(15) + 2)^(1/3)) + 1/2*sqrt(-(2*I*sqrt(15) + 2)^(1/3) - 4/(2*I*sqrt(15) + 2)^(1/3) - 4/sqrt(((2*I*sqrt(15) + 2)^(2/3) + 4)/(2*I*sqrt(15) + 2)^(1/3)))]
[x == 4]
[x == 0]
[x == log(1/2*I*5^(1/3)*sqrt(3) - 1/2*5^(1/3)), x == log(-1/2*I*5^(1/3)*sqrt(3) - 1/2*5^(1/3)), x == 1/3*log(5)]
[{x: log(1/2*I*5^(1/3)*sqrt(3) - 1/2*5^(1/3))}, {x: log(-1/2*I*5^(1/3)*sqrt(3) - 1/2*5^(1/3))}, {x: 1/3*log(5)}]
[[x == 1.35720887245841, y == -1.35720887245841], [x == (-0.6786044041487247 + 1.175377306225595*I), y == (0.6786044041487285 - 1.175377306225602*I)], [x == (-0.6786044041487247 - 1.175377306225595*I), y == (0.6786044041487285 + 1.175377306225602*I)]]
5
[(log(1/2*I*5^(1/3)*sqrt(3) - 1/2*5^(1/3)), 1), (log(-1/2*I*5^(1/3)*sqrt(3) - 1/2*5^(1/3)), 1), (1/3*log(5), 1)]
Finding A SINGLE Root in an interval: numerical
Error in lines 1-1
Traceback (most recent call last):
File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "sage/symbolic/expression.pyx", line 10840, in sage.symbolic.expression.Expression.find_root (/projects/sage/sage-6.10/src/build/cythonized/sage/symbolic/expression.cpp:57550)
return find_root(f, a=a, b=b, xtol=xtol,
File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/sage/numerical/optimize.py", line 94, in find_root
raise RuntimeError("f appears to have no zero on the interval")
RuntimeError: f appears to have no zero on the interval
Numerical approximation of a symbolic expression
500000000000000000000000000001/1000000000000000000000000000000*pi - 1/1000000000000000000000000000000*e
1.57079632679490
0.536479304144700 + 2.09439510239320*I
0.53647930414470012486691977774206254650853378475617257397088 + 2.0943951023931954923084289221863352561314462662500705473166*I
0.53647930414470012487 + 2.0943951023931954923*I
0.536 + 2.09*I
0.53648? + 2.09440?*I
True
0.536479304144700 + 2.09439510239320*I
0.536479304144700 + 2.09439510239320*I
0.536479304144700 + 2.09439510239320*I
More about 2d plots
You can do much more than just plot(function...)
. E.g.,
a point
a bunch of points
text
"line" through a bunch of points
polygon
ellipse
implicit plot
contour plot
vector field
adlkjf\nlksjdfljs
adlkjf\lksjdfljs
+Infinity
-Infinity