- plot3d(f, urange, vrange, adaptive=False, **kwds)
- INPUT:
- ``f`` - a symbolic expression or function of 2
variables
- ``urange`` - a 2-tuple (u_min, u_max) or a 3-tuple
(u, u_min, u_max)
- ``vrange`` - a 2-tuple (v_min, v_max) or a 3-tuple
(v, v_min, v_max)
- ``adaptive`` - (default: False) whether to use
adaptive refinement to draw the plot (slower, but may look better)
- ``mesh`` - bool (default: False) whether to display
mesh grid lines
- ``dots`` - bool (default: False) whether to display
dots at mesh grid points
.. note::
``mesh`` and ``dots`` are not supported when using the Tachyon
raytracer renderer.
EXAMPLES: We plot a 3d function defined as a Python function::
sage: plot3d(lambda x, y: x^2 + y^2, (-2,2), (-2,2))
We plot the same 3d function but using adaptive refinement::
sage: plot3d(lambda x, y: x^2 + y^2, (-2,2), (-2,2), adaptive=True)
Adaptive refinement but with more points::
sage: plot3d(lambda x, y: x^2 + y^2, (-2,2), (-2,2), adaptive=True, initial_depth=5)
We plot some 3d symbolic functions::
sage: x, y = var('x,y')
sage: plot3d(x^2 + y^2, (x,-2,2), (y,-2,2))
sage: plot3d(sin(x*y), (x, -pi, pi), (y, -pi, pi))
A 3d plot with a mesh::
sage: var('x,y')
(x, y)
sage: plot3d(sin(x-y)*y*cos(x),(x,-3,3),(y,-3,3), mesh=True)
Two wobby translucent planes::
sage: x,y = var('x,y')
sage: P = plot3d(x+y+sin(x*y), (x,-10,10),(y,-10,10), opacity=0.87, color='blue')
sage: Q = plot3d(x-2*y-cos(x*y),(x,-10,10),(y,-10,10),opacity=0.3,color='red')
sage: P + Q
We draw two parametric surfaces and a transparent plane::
sage: L = plot3d(lambda x,y: 0, (-5,5), (-5,5), color="lightblue", opacity=0.8)
sage: P = plot3d(lambda x,y: 4 - x^3 - y^2, (-2,2), (-2,2), color='green')
sage: Q = plot3d(lambda x,y: x^3 + y^2 - 4, (-2,2), (-2,2), color='orange')
sage: L + P + Q
We draw the "Sinus" function (water ripple-like surface)::
sage: x, y = var('x y')
sage: plot3d(sin(pi*(x^2+y^2))/2,(x,-1,1),(y,-1,1))
Hill and valley (flat surface with a bump and a dent)::
sage: x, y = var('x y')
sage: plot3d( 4*x*exp(-x^2-y^2), (x,-2,2), (y,-2,2))
TESTS: Listing the same plot variable twice gives an error.
::
sage: x, y = var('x y')
sage: plot3d( 4*x*exp(-x^2-y^2), (x,-2,2), (x,-2,2))
Traceback (most recent call last):
...
ValueError: plot variables should be distinct, but both are x.