︠16b6580d-d305-4cc2-bc29-67e7961223d4i︠
%md
# The current undesirable behavior of plot3d
︡98566a2e-d023-44b2-80b5-88cfb9a10491︡{"done":true,"md":"# The current undesirable behavior of plot3d"}
︠1b3cf123-c1b2-4441-bd1c-eb4ade6a51de︠
var("x y z")
plot3d( x^2 + y^3, (x,-3,3), (y,-3,3) )
︡2e850936-f0cf-43fa-b6ee-d360ed4f1562︡{"stdout":"(x, y, z)\n"}︡{"file":{"filename":"4d61b3d3-8ff5-497b-8067-ae69ff1e9f0d.sage3d","uuid":"4d61b3d3-8ff5-497b-8067-ae69ff1e9f0d"}}︡{"html":""}︡{"done":true}︡
︠a2bedcce-bf88-4390-bd59-8f6efc6967c8s︠
var("x y")
plot3d( 1/( (x-2)^2 + (y-1)^2 ), (x,-3,3), (y,-3,3) )
︡88e70911-0800-458d-a1fc-9486b046936c︡{"stdout":"(x, y)\n"}︡{"file":{"filename":"8b4f64da-f53a-463b-bf7a-9a5142e9ad53.sage3d","uuid":"8b4f64da-f53a-463b-bf7a-9a5142e9ad53"}}︡{"html":""}︡{"done":true}︡
︠29d4f551-a05e-4862-9e01-e089b399828di︠
%md
# Now, the behavior of the new code that I've written
︡0f94f1f5-7162-42ea-8575-085dc98bd194︡{"done":true,"md":"# Now, the behavior of the new code that I've written"}
︠759f7ef3-de67-4457-9a88-8aae0c317ec6s︠
%load new_plot3d_syntax.sage
︡e2526cee-71b1-426f-b456-06b17693b11f︡{"done":true}︡
︠ec7e6b39-c148-4eb8-8191-3d01eaf5f75es︠
newPlot3d( x^2 + y^3, -3,3, -3,3, -4,4 )
︡27c8a180-bb79-4cfa-91ec-9cf4c1c93d86︡{"stderr":":1: DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...)\nSee http://trac.sagemath.org/5930 for details.\n"}︡{"file":{"filename":"eb4f5b17-8122-4e27-87f0-f399c93dfc0e.sage3d","uuid":"eb4f5b17-8122-4e27-87f0-f399c93dfc0e"}}︡{"html":""}︡{"done":true}︡
︠673aa2fe-787f-45c7-817a-4322da618d70︠
newPlot3d( 1/( (x-2)^2 + (y-1)^2 ), -3,3, -3,3, 0,6 )
︡0b5fa972-f65e-40d8-88a4-8f66058fbc20︡{"file":{"filename":"efc2b28f-9979-431a-8feb-86a4d3789190.sage3d","uuid":"efc2b28f-9979-431a-8feb-86a4d3789190"}}︡{"html":""}︡{"done":true}︡
︠210c2f65-80fa-466d-afa9-64cfc6bf9000i︠
%md
# What are some of the changes?
* Functions with vertical asymptotes were not graphable at all before
* Before, you'd get something that looks like a vertical pencil.
* Now they can be graphed like any other function.
* Before, you could not bound the desired z-coordinates at all
* Now such bounds are obligatory.
* This is what allows for functions with vertical asymptotes.
* Before, the aspect ratio defaults to [1,1,1]
* Now, the aspect ratio is computed for the user so as to produce a graph in a cube.
* Many images, in the old code, were hard to interpret/understand because of the aspect ratios.
* The aspect ratio requires knowledge of the bounds of the function.
* I don't think a student at the start of learning about 3D functions can compute those bounds unassisted.
* Yet, without those bounds, the aspect ratio to produce a cube cannot be computed.
* And without the aspect ratios being provided by the user in the old code, the image is unreadable.
* Therefore, with the current commands, newbie users cannot just sit down and graph in 3D.
* You can always override the default aspect ratios, in either case, by an option.
* Before the mesh defaults to "off", but you can turn it on with an option.
* Now the mesh defaults to "on", but you can turn it off with an option.
︡4686fbf0-f935-422f-a031-c279354b7c18︡{"done":true,"md":"\n# What are some of the changes?\n\n* Functions with vertical asymptotes were not graphable at all before\n * Before, you'd get something that looks like a vertical pencil.\n * Now they can be graphed like any other function.\n* Before, you could not bound the desired z-coordinates at all\n * Now such bounds are obligatory.\n * This is what allows for functions with vertical asymptotes.\n* Before, the aspect ratio defaults to [1,1,1]\n * Now, the aspect ratio is computed for the user so as to produce a graph in a cube.\n * Many images, in the old code, were hard to interpret/understand because of the aspect ratios.\n * The aspect ratio requires knowledge of the bounds of the function.\n * I don't think a student at the start of learning about 3D functions can compute those bounds unassisted.\n * Yet, without those bounds, the aspect ratio to produce a cube cannot be computed.\n * And without the aspect ratios being provided by the user in the old code, the image is unreadable.\n * Therefore, with the current commands, newbie users cannot just sit down and graph in 3D.\n * You can always override the default aspect ratios, in either case, by an option.\n* Before the mesh defaults to \"off\", but you can turn it on with an option.\n * Now the mesh defaults to \"on\", but you can turn it off with an option."}
︠0b2905a5-1ead-4e06-9b08-4951d1e03617s︠
sage: from sage.plot.plot3d.implicit_surface import ImplicitSurface
%var x,y,z
contour=[-1, 0, 1, 2]
from numpy import linspace
where = linspace(min(contour), max(contour), len(contour)) / (max(contour) - min(contour))
where -= where[0]
colors = [colormaps.coolwarm(i) for i in where]
sum(implicit_plot3d( 1/( (x-2)^2 + (y-1)^2 ) == z, (x,-3, 3), (y,-3, 3), (z, -1, 6), contour=con, color=col, mesh=True) for con, col in zip(contour, colors))
︡648a7c27-05a3-4b90-996d-ec3d674a4797︡{"file":{"filename":"c0d6d652-82a4-4ae4-a21e-2490e3fb154d.sage3d","uuid":"c0d6d652-82a4-4ae4-a21e-2490e3fb154d"}}︡{"html":""}︡{"done":true}︡
︠927cbbed-0381-4aa4-a919-d4a5b58373c9︠
implicit_plot3d( 1/( (x-2)^2 + (y-1)^2 ) == z, (x,-3, 3), (y,-3, 3), (z, 0, 6), mesh=True, color='green')
︡3b03e1d8-3008-4703-8490-3cd91b1db8b0︡{"file":{"filename":"e327fc7b-dc12-43eb-ade9-1dc088d6a738.sage3d","uuid":"e327fc7b-dc12-43eb-ade9-1dc088d6a738"}}︡{"html":""}︡{"done":true}︡
︠9424b2f0-743b-4362-b840-f0ddc3be1714︠