ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 02 Mar 2019 11:24:11 -0600How to plot ellipsoid with interact?http://ask.sagemath.org/question/45602/how-to-plot-ellipsoid-with-interact/I would like to plot ellipsoid $\dfrac{x^2}{a^2}+\dfrac{y^2}{b^2}+\dfrac{z^2}{c^2}=1$ in SageMath, where the parameters $a,b,c$ can be changed interactively. I found it what I want here https://www.geogebra.org/m/cqtAE6Sm. But I want to do the same in Sage. How can I do it?math.mks@yandex.comSat, 02 Mar 2019 11:24:11 -0600http://ask.sagemath.org/question/45602/Conditional Plot, plot f(x+iy) if g(x+iy) satisfies some kind of conditionhttp://ask.sagemath.org/question/45445/conditional-plot-plot-fxiy-if-gxiy-satisfies-some-kind-of-condition/Let's say I have two functions f(zeta) and g(zeta), and I'd like to have 3D-plot and Contour Plot of f(zeta) if g(zeta) in a certain range.
I have defined f(zeta) and g(zeta), and then I tried this command, but Sage said the syntax is not valid.
B=implicit_plot(lambda x,y : float(f(x+y*I)),if 1<g(x+y*I)<3,(-5,5),(-5,5)))
I am pretty new with Sage math, so please bear with me if the question is too trivial....
JacobsonRadicalWed, 13 Feb 2019 04:55:53 -0600http://ask.sagemath.org/question/45445/Use colormap for a 3dlistplot?http://ask.sagemath.org/question/45408/use-colormap-for-a-3dlistplot/How can I plot a list of points in space where the points are colored by their height?
The following code:
biglist = [(0, 0, 12), (0, 1, 19), (0, 2, 24), (0, 3, 30), (0, 4, 33), (0, 5, 35),
(0, 6, 38), (0, 7, 40), (0, 8, 41), (0, 9, 43), (0, 10, 44), (0, 11,
44), (0, 12, 44), (0, 13, 44)]
cm = colormaps.autumn
cf = lambda (x,y,z): z/100 % 1
list_plot3d(biglist, color=(cm,cf), point_list=True)
produces the following error:
/Applications/SageMath-7.2.app/Contents/Resources/sage/local/lib/python2\
.7/site-packages/matplotlib-1.5.1-py2.7-macosx-10.7-x86_64.egg/matplotli\
b/cbook.py:137: MatplotlibDeprecationWarning: The matplotlib.delaunay
module was deprecated in version 1.4. Use matplotlib.tri.Triangulation
instead.
warnings.warn(message, mplDeprecation, stacklevel=1)
/Applications/SageMath-7.2.app/Contents/Resources/sage/local/lib/python2\
.7/site-packages/numpy-1.11.0-py2.7-macosx-10.7-x86_64.egg/numpy/lib/fun\
ction_base.py:2558: RuntimeWarning: invalid value encountered in
true_divide
c /= stddev[:, None]
/Applications/SageMath-7.2.app/Contents/Resources/sage/local/lib/python2\
.7/site-packages/numpy-1.11.0-py2.7-macosx-10.7-x86_64.egg/numpy/lib/fun\
ction_base.py:2559: RuntimeWarning: invalid value encountered in
true_divide
c /= stddev[None, :]
Traceback (click to the left of this block for traceback)
...
KeyError: 'popitem(): dictionary is empty'watcher00090Sat, 09 Feb 2019 23:09:56 -0600http://ask.sagemath.org/question/45408/Deformed 3d shapeshttp://ask.sagemath.org/question/44887/deformed-3d-shapes/ Hi
I am a beginner in sagemaths and I would like to print a cube that has been deformed. I have the 3 vectors of the side of the cube but I really don't know how modelise it.
Would you have any idea ?
Thank you very muchZ_etuFri, 04 Jan 2019 04:52:29 -0600http://ask.sagemath.org/question/44887/Viewer 3D issueshttp://ask.sagemath.org/question/44620/viewer-3d-issues/I'm trying to draw some 3D polyhedra. A search has brought up
https://ask.sagemath.org/question/41910/viewer-3d-problem/
but I still can't get a live plot. I have constructed my polyhedron `V` from the `Polyhedron` class as an intersection of linear inequalities. The command `V.plot()` works by using the JMol engine, except that when I attempt to make it "live" all the edges and faces disappear and I have collection of vertices only.
I can also plot with tachyon; that works fine but doesn't allow rotating.
When I plot with threejs: `V.plot(viewer='threejs',online=True)` all it plots is the wireframe box surrounding the polyhedron; that is, the xyz "box" in which the polyhedron fits, but not the polyhedron itself.
So - how can I create a 3D polyhedron with a "live" plot that allows rotating? AlasdairSun, 09 Dec 2018 22:49:34 -0600http://ask.sagemath.org/question/44620/How to show the coordinates of the mouse position?http://ask.sagemath.org/question/43026/how-to-show-the-coordinates-of-the-mouse-position/ When I draw a graph with gnuplot, the coordinates corresponding to the position of my mouse cursor is
shown in the lower-left corner of the plot. Is it possible for SageMath to show the coordinates of the
mouse position when I draw a graph with plot command? hiros1Sun, 15 Jul 2018 08:32:40 -0500http://ask.sagemath.org/question/43026/Orienting and Saving 3D Plotshttp://ask.sagemath.org/question/42190/orienting-and-saving-3d-plots/Hi !
I am very new to using Sage, I've started only a few weeks ago. I hope my inability to answer anyone's questions won't ruin my "karma" ! Anyway, here is my first question:
I've been experimenting with plotting 3D objects, so far. Right now, I am plotting simple cubes scattered in space. With great satisfaction, I've noticed I could initialize the point of view of my 3D plot by specifying:
orientation(0,0,0,0)
That initializes to X being horizontal, Y vertical, and Z orthogonal to the screen. Then, I specify:
G.rotate([1,0,0],pi/4).show(aspect_ratio=[1,1,1],frame=False)
and get a point of view I really like. My goal is to generate a bunch of .png files of my cubes from different points of view, and I was hoping to use this rotate() functionality with a [ for i in range(n)] type statement. Therefore, I'd really like SAGE to write a bunch of .png files without me generating images one by one and saving manually. So I tried using the save() function, like so:
G.rotate([1,0,0],pi/4).save("MyImage.png",aspect_ratio=[1,1,1],frame=False)
Here is my problem: when I use the save() function, my previous orientation(0,0,0,0) statement is completely overridden, and the resulting MyImage.png I get is rotated according to rotate([1,0,0],pi/4), but not from the intented X being horizontal, Y vertical, and Z orthogonal to the screen configuration, rather, from the default point of view show() gives me, if I do not specify orientation(0,0,0,0).
Why is it so, and how can I fix this ?
Thank you very much,
Turiel.TurielFri, 27 Apr 2018 11:18:47 -0500http://ask.sagemath.org/question/42190/3D Vector Field Doesn't have Arrowshttp://ask.sagemath.org/question/41898/3d-vector-field-doesnt-have-arrows/I have been trying to plot 3D vector fields, but I keep running into a problem. The graphic does not have arrows instead it is just lines.
Here is the code.
var('x,y,z')
p = plot_vector_field3d((x,y,z), (x, -5, 5), (y, -5, 5), (z, -5, 5))
p.show()
jacksevenFri, 06 Apr 2018 21:01:14 -0500http://ask.sagemath.org/question/41898/Problem with .stl and Graphhttp://ask.sagemath.org/question/41702/problem-with-stl-and-graph/Hi everyone!
I have a problem with SageMath, and I need your help :).
I want to save my personal Graph from a list to a .stl file
(.stl for 3d object representation, "stereolithography").
My code:
p = [[0,0,0],[1,2,3],[2,3,1],[2,1,0],[1,3,2],[3,2,1]]
points = PointConfiguration(p)
triang = points.triangulate()
triang.save('mygraph.stl')
triang.plot(axes=False)
___
When I try to save my file it's in the .sobj extension. (I research this extension
and it's just an extension SageObject, so it's not useful for me). I want to draw
a graph with a list of point and to convert them in a .stl file.
I already tried:
- save the plot:
triang.plot().save('mygraph.stl') # Fails as there is no attribute face_list
- save the all[-1]:
triang.all[-1].save('test.stl') # Fails as PointConfiguration don't have argument all.
I don't know what is the problem, so I ask for your help.
Thank you very much.haaggenWed, 21 Mar 2018 15:48:59 -0500http://ask.sagemath.org/question/41702/plot_vector_field3d and three.js viewerhttp://ask.sagemath.org/question/41091/plot_vector_field3d-and-threejs-viewer/ I guess there might be some mistake in my code, but I cannot use `plot_vector_field3d` and show the result with `three.js` viewer. The code is
var('x y z')
f = (x, y, z)
show(plot_vector_field3d(f, (x,-3,3), (y,-3,3), (z,-3,3), aspect_ratio=1), viewer='threejs')
and it only shows an empty box. How to explain this behaviour?jepstraTue, 13 Feb 2018 05:56:22 -0600http://ask.sagemath.org/question/41091/Can I generate 3D plots in isometric projection?http://ask.sagemath.org/question/38491/can-i-generate-3d-plots-in-isometric-projection/I'd like to show some plots in isometric projection. For certain plots, it's not hard to project the lines manually and do a 2d plot, but ideally, I'd like to rotate the plot with the mouse, and be able to show any 3d plot in isometric projection: do you know a way?pangTue, 08 Aug 2017 13:58:36 -0500http://ask.sagemath.org/question/38491/Plot plane projective curves.http://ask.sagemath.org/question/38707/plot-plane-projective-curves/Hey wanted to plot plane projective curves (i.e. an algebraic curve in $\mathbb P^2$) as a 3 dimensional pictures
or as the intersection with a sphere.
Any idea how to do that in sage math?
![Examples](http://voltage.typepad.com/.a/6a00e55375ef1c8833014e88802058970d-500wi)http://voltage.typepad.com/.a/6a00e55375ef1c8833014e88802058970d-500wi
![Examples](https://mathsbyagirl.files.wordpress.com/2015/10/projective-curve-in-p2.png)hanswFri, 01 Sep 2017 11:20:02 -0500http://ask.sagemath.org/question/38707/Implicit plot with squaring and absolute value produces empty plothttp://ask.sagemath.org/question/38563/implicit-plot-with-squaring-and-absolute-value-produces-empty-plot/ The following code:
sage: x,y = var('x y')
sage: implicit_plot(x, (x,-2,2), (y,-2,2))
produces a plot of a straight line along the coordinate y-axis as expected (it should plot the curve $x = 0$).
However, this very similar code:
sage: implicit_plot(x^2, (x,-2,2), (y,-2,2))
produces a plot with nothing on it, even though it *should* plot the curve $x^2 = 0$ which is clearly the same as the above curve.
This problem seems to persist with any function $f(x, y)$, i.e., in the following code,
f(x, y) = [some expression involving x and y]
sage: implicit_plot(f(x, y), [x scale], [y scale])
sage: implicit_plot(f(x, y)^2, [x scale], [y scale])
the second line produces a nonempty plot while the third line produces an empty plot. Replacing `f(x,y)^2` with `abs(f(x,y))` or even `abs_symbolic(f(x,y))` has the same effect: they all produce empty plots.
The problem persists when one replaces `implicit_plot` with `implicit_plot3d`.
What's going on? Is this a bug?DoekeThu, 17 Aug 2017 17:36:31 -0500http://ask.sagemath.org/question/38563/3d isosurface contour plot from list/3d matrixhttp://ask.sagemath.org/question/38451/3d-isosurface-contour-plot-from-list3d-matrix/ I want to make a 3d isosurface contour plot from 3d matrix data. Since the mayavi package, as far as I know, isn't compatible with python 3, I can't use it anymore.
The only way which should work, is opening an interface to GNU octave, which is able to make such plots.
What I would like to know, if there exist easier ways to do that.
osMon, 31 Jul 2017 09:38:09 -0500http://ask.sagemath.org/question/38451/Plot Multiple 3D Graphs that overlaphttp://ask.sagemath.org/question/37990/plot-multiple-3d-graphs-that-overlap/Hello,
I can graph multiple 3D graphs by adding them together but I can not get them to overlap the way I want. I would like to be able to flip the axis. As an example, I would like to be able to graph the height of the cylindrical_plot3d along the x or y axes in addition to the z axes. Same for the 3d parabola.
var('y,z')
theta,y=var('theta,y')#start was z
cylindrical_plot3d(10,(theta,0,2*pi),(y,-2,2)) + plot3d(x^2, (-1,1),(-1,1))
Thanks in advance!
happys5Sat, 17 Jun 2017 14:18:10 -0500http://ask.sagemath.org/question/37990/What is the meaning of 3d graph?http://ask.sagemath.org/question/37707/what-is-the-meaning-of-3d-graph/I read the reference manual. There I see only `x,y`. So how is the value of z decided?
Example:
def f(x,y):
return math.sin(y*y+x*x)/math.sqrt(x*x+y*y+.0001)
P = plot3d(f,(-3,3),(-3,3), adaptive=True, color=rainbow(60, 'rgbtuple'), max_bend=.1, max_depth=15)
P.show()
I also don't know how to paste the sage cell code, as only latex is the way here.screened00Fri, 26 May 2017 12:48:26 -0500http://ask.sagemath.org/question/37707/How to add tick marks or control them in the frame of 3d plots?http://ask.sagemath.org/question/35411/how-to-add-tick-marks-or-control-them-in-the-frame-of-3d-plots/Apparently there is no way to add tick marks or control their spacing in the frame box for 3d plots as you can do it in 2d plots. There is no ticks option.
There is no axis with ticks option. No control over axes labels neither.
I found a way to do so as in the following code (But I cannot interact with the plot as rotating and zooming with the mouse as can be done with sage 3d plots. I would like to have frame tick marks and grid lines, and axis labels as in the graph generated by this code):
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import axes3d
x,y,z=var('x,y,z')
# Next we define the parameters
sigma=10
rho=28
beta=8/3
# The Lorenz equations
lorenz=[sigma*(y-x),x*(rho-z)-y,x*y-beta*z]
# Time and initial conditions
N=250000
tmax=250
h=tmax/N
t=srange(0,tmax+h,h)
ics=[0,1,1]
sol=desolve_odeint(lorenz,ics,t,[x,y,z],rtol=1e-13,atol=1e-14)
X=sol[:,0]
Y=sol[:,1]
Z=sol[:,2]
# Plot the result
from mpl_toolkits.mplot3d import axes3d
from matplotlib import pyplot as plt
# Call the plot function if you want to plot the data
def plot():
fig = plt.figure(1)
ax = fig.add_subplot(111, projection='3d')
ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10)
ax.set_xlabel('X(t)')
ax.set_ylabel('Y(t)')
ax.set_zlabel('Z(t)')
plt.show()
plot()galmeida2007Thu, 03 Nov 2016 22:53:41 -0500http://ask.sagemath.org/question/35411/plot error: No X11 DISPLAY variable was sethttp://ask.sagemath.org/question/35071/plot-error-no-x11-display-variable-was-set/Hi, I have to make a plot of the following formula
x,y=var('x, y')
plot3d((x^2)*y-x*y+x*y^3,0,5)
but I obtain error message
> /usr/lib64/python2.7/site-packages/sage/plot/plot3d/parametric_plot3d.py\
> :704: DeprecationWarning: Unnamed
> ranges for more than one variable is
> deprecated and will be removed from a
> future release of Sage; you can used
> named ranges instead, like (x,0,2) See
> http://trac.sagemath.org/7008 for
> details. g, ranges =
> setup_for_eval_on_grid(f,
> [urange,vrange], plot_points)
> Exception in thread "main"
> java.lang.ExceptionInInitializerError
> Caused by: java.awt.HeadlessException:
> No X11 DISPLAY variable was set, but
> this program performed an operation
> which requires it. at
> sun.awt.HeadlessToolkit.getScreenSize(HeadlessToolkit.java:284)
> at
> org.openscience.jmol.app.jmolpanel.JmolPanel.<clinit>(JmolPanel.ja\
> va:173)
> /usr/lib64/python2.7/site-packages/sage/repl/rich_output/display_manager\
> .py:570: RichReprWarning: Exception in
> _rich_repr_ while displaying object: Jmol failed to create file
> '/home/sage/.sage/temp/host/1582/dir_0OP2db/preview.png',
> see
> '/home/sage/.sage/temp/host/1582/tmp_4sBlqC.txt'
> for details RichReprWarning,
> Graphics3d ObjectCaterpillarWed, 05 Oct 2016 03:24:03 -0500http://ask.sagemath.org/question/35071/polygon3d() doesn't workhttp://ask.sagemath.org/question/34054/polygon3d-doesnt-work/The polygon class plot well in 2d, but if I type in the command as the example on tutorial:
EXAMPLES:
A simple triangle:
sage: polygon3d([[0,0,0], [1,2,3], [3,0,0]])
Graphics3d Object
I think it should shows a triangle, but my linux jmol grapher doesn't plot anything. However, the axes still changes as I change the coordinates. I really want to plot a triangle in 3d, can anyone help? Great thanks!
yshuidieThu, 07 Jul 2016 17:09:09 -0500http://ask.sagemath.org/question/34054/Plot intersections of two relationshttp://ask.sagemath.org/question/33521/plot-intersections-of-two-relations/ How can I plot an intersection of two relations? For instance, if I have two spheres $x^2 + (y-1)^2 + (z-1)^2 = 1$ and $x^2 + y^2 + z^2 = 1$, how can I plot their intersection on a graph?slemonideMon, 23 May 2016 00:23:52 -0500http://ask.sagemath.org/question/33521/Plotting an inequality in 3D regionhttp://ask.sagemath.org/question/33277/plotting-an-inequality-in-3d-region/
Ideally I would like to plot a region in 3D space which is defined by a bunch of inequalities. For example let us consider the region $R$ defined by $$ \{ (x,y, z): x \le 0 \text{ and } y \le 0 \text{ and } x+y \le z \} $$.
I am wondering what would be an easier way to do it.
With my limited knowledge I came up with these two approaches.
*Approach 1 :* Generate points in this region and plot them in 3D. Is there a way to extend the function in <code> region_plot () </code> that generates plot points for my needs?
*Approach 2 :* Concatenate implicit -3D plots of functions of the form $ x + y - (z+t) $, where $t$ is a small positive parameter, for different values of $t$. Then plot all these simultaneously.
I would appreciate any alternate way to do this or any improvements on these approaches.
Thank you for your time in advance.
DBSSun, 01 May 2016 11:36:45 -0500http://ask.sagemath.org/question/33277/Interactive 3d plotting in SageMathCloud Jupyter?http://ask.sagemath.org/question/32898/interactive-3d-plotting-in-sagemathcloud-jupyter/So I'm experimenting with some 3d plots. I can create an interactive plot in Sage with plot3d, but the options are limited. I can create a 3d plot with more control using matplotlib inside Jupyter, except that the resulting plot is not interactive - I can't pan, zoom, or rotate to find the best view of the plot. So what I need is some plotting functionality which has the control of matplotlib, and the interactivity of plot3d. I understand that something similar can be obtained with Mayavi, but this is not part of SageMathCloud Jupyter. And I want to do this online so I can share it with a co-worker. Advice, as usual , would be appreciated!AlasdairSun, 27 Mar 2016 19:46:02 -0500http://ask.sagemath.org/question/32898/Axes labels on 3D plots?http://ask.sagemath.org/question/32890/axes-labels-on-3d-plots/I know you can label the axes on 2d plots, but what about on 3d plots, obtained with plot3d? I've hunted around in the documentation, but have found nothing. Or can this be done by first creating a graphics rectangular parallelepiped, appropriately labelled, and inserting the plot3d (plotted without labels) into it? Or some other way?AlasdairSun, 27 Mar 2016 03:55:40 -0500http://ask.sagemath.org/question/32890/how to user a external program to plot graphic?http://ask.sagemath.org/question/32454/how-to-user-a-external-program-to-plot-graphic/ how to user a external program to plot graphic?
ex: gnuplot, xmaxima, mgnuplot....jmarcellopereiraThu, 04 Feb 2016 13:32:43 -0600http://ask.sagemath.org/question/32454/Error rendering 3d scenehttp://ask.sagemath.org/question/29510/error-rendering-3d-scene/I'm working in the SageMath Cloud. The code block
x,y,t = var('x,y,t')
f = lambda x,y: x*abs(y)/sqrt(x^2+y^2) if (x,y)<>(0,0) else 0
a,b = 1,6
e = 0.1
parametric_plot3d( [b*t, -a*t, f(b*t,-a*t)], [t,-e,e], color="yellow", size=15 )
produces an error message:
error rendering 3d scene -- error downloading /blobs/682b952d-d577-45ce-98ff-4e7a06ddad32.sage3d?uuid=682b952d-d577-45ce-98ff-4e7a06ddad32
But if I change the fourth line to `e = 1`, then it works just fine.
A similar error was reported in http://ask.sagemath.org/question/27300/error-rending-3d-scene, but the fix there was easier.
Jeremy MartinSun, 20 Sep 2015 07:03:28 -0500http://ask.sagemath.org/question/29510/How to embed a 3D matplotlib figure in the notebook interface?http://ask.sagemath.org/question/32079/how-to-embed-a-3d-matplotlib-figure-in-the-notebook-interface/I'd like to embed a matplotlib figure in the notebook interface of SageMath, is this possible? Presently I am using this SageMath code:
x,y,z=var('x,y,z')
# Next we define the parameters
sigma=10
rho=40
beta=8/3
# The Lorenz equations
lorenz=[sigma*(y-x),x*(rho-z)-y,x*y-beta*z]
# Time and initial conditions
N=250000
tmax=150
h=tmax/N
times=srange(0,tmax+h,h)
ics=[0,1,1]
sol=desolve_odeint(lorenz,ics,times,[x,y,z],rtol=1e-13,atol=1e-14)
X=sol[:,0]
Y=sol[:,1]
Z=sol[:,2]
# Plot the result
from mpl_toolkits.mplot3d import axes3d
from matplotlib import pyplot as plt
def plot():
fig = plt.figure(1)
ax = fig.add_subplot(111, projection='3d')
ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10)
ax.set_xlabel('X(t)')
ax.set_ylabel('Y(t)')
ax.set_zlabel('Z(t)')
plt.show()
plot()
to solve and plot the solution to the Lorenz equations. What modification to the `plot()` function do I have to make in order to embed the matplotlib plot in the notebook interface. Fusion809Tue, 05 Jan 2016 02:51:50 -0600http://ask.sagemath.org/question/32079/How do I plot a 3D Lorenz attractor with x, y and z labels?http://ask.sagemath.org/question/31847/how-do-i-plot-a-3d-lorenz-attractor-with-x-y-and-z-labels/I have been attempting to perform a 3D wireframe plot of the solution to the Lorenz equations, which is stored in the variables X, Y and Z. This is what I am presently using (unsuccessfully I might add):
# Plot the result
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import axes3d
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
plt.figure(1)
plt.xlabel('X(t)')
plt.ylabel('Y(t)')
plt.zlabel('Z(t)')
axes3d.plot_wireframe(X,Y,Z)
plt.show()
How do I get this plot to work? I'm guessing you'll probably be able to guess that X, Y and Z are ndarrays, produced from this SageMath script:
x,y,z=var('x,y,z')
# Next we define the parameters
sigma=10
rho=28
beta=8/3
# The Lorenz equations
lorenz=[sigma*(y-x),x*(rho-z)-y,x*y-beta*z]
# Time and initial conditions
N=250000
tmax=250
h=tmax/N
t=srange(0,tmax+h,h)
ics=[0,1,1]
sol=desolve_odeint(lorenz,ics,t,[x,y,z],rtol=1e-13,atol=1e-14)
X=sol[:,0]
Y=sol[:,1]
Z=sol[:,2]Fusion809Sat, 26 Dec 2015 07:50:53 -0600http://ask.sagemath.org/question/31847/Graphing 3 planeshttp://ask.sagemath.org/question/30425/graphing-3-planes/Disclaimer: I'm new to linear algebra and an intermediate with Sage.
How can I graph the following planes? This example is taken from Linear Algebra and Its Applications by Strang. I've tried to follow [these instructions](http://sage.maa.org/home/pub/66/), but I'm stuck. Thanks!
![image description](https://dl.dropboxusercontent.com/u/22824199/seanwingert.com/3planes.png) mellow_yellowTue, 03 Nov 2015 07:53:23 -0600http://ask.sagemath.org/question/30425/How to plot 2D from 3Dhttp://ask.sagemath.org/question/30020/how-to-plot-2d-from-3d/ I have the following code that gives a 3D graph.
f(m,p)=16*p^4*m^4-8*(18*p^10 - 54*p^9 + 59*p^8 + 130*p^7 - 209*p^6 - 98*p^5 + 407*p^4 + 362*p^3 + 49*p^2 - 16*p + 8)*m^2+(9*( p + 1 )^2*(p^4 - 2*p^3 + 2*p^2 + 2*p + 1)*(4*p^8 - 52*p^7 + 373*p^6 + 68*p^5 - 445*p^4 + 72*p^3 + 163*p^2 - 48*p + 9))
G = plot3d(f, (-5,5), (-10,10))
G.show(zmax=5)
How to get a 2D plot of this graph on m and p plane? I tried changing `plot3d` to `plot2d` but it did not work.ShaWed, 14 Oct 2015 19:19:40 -0500http://ask.sagemath.org/question/30020/Error rending 3d Scene...http://ask.sagemath.org/question/27300/error-rending-3d-scene/I have been attempting to render 3d objects and have been successful for the whole day until just recently. I am constantly getting the following error:
"error rendering 3d scene -- error downloading /blobs/836a1670-2631-40ea-87a8-a4047e9e432d.sage3d?uuid=836a1670-2631-40ea-87a8-a4047e9e432d"
Here is my code
counter3 = 0
counter2 = 0
counter1 = 0
#array for the list of points
pts = []
# Your substitution
w = WordMorphism('1->12,2->13,3->1')
# Your word you wish to apply the substitution to
toApplyOn = "1"
# Number of times to apply the substition
upTo = 4
# empty graphics object
P=Graphics()
for j in range(upTo):
word = w(toApplyOn)
toApplyOn = word
for x in word:
previousVector = v
if int(x) == 3:
counter3 += 1
if int(x) == 2:
counter2 += 1
if int(x) == 1:
counter1 += 1
v = (counter1, counter2, counter3)
pts.append(v)
if not int(x) == (len(word)-1):
if int(x) == 3:
P += line3d([v,previousVector],color='red')
if int(x) == 2:
P += line3d([v,previousVector],color='blue')
if int(x) == 1:
P += line3d([v,previousVector],color='green')
P+=point3d(pts,color='black')
P
My code is suppose to output a 3D image (a neat looking staircase).
I am using the Sage Math Cloud as my environment. Does anyone else get this error? Does anyone have ideas why I receive this error?OzeraAltThu, 09 Jul 2015 18:48:13 -0500http://ask.sagemath.org/question/27300/