ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 26 Apr 2024 13:45:35 +0200Size of objects shown in animationshttps://ask.sagemath.org/question/77098/size-of-objects-shown-in-animations/Hi,
a series of 3d objects looks OK in the notebook, when shown in a loop
with repeated calls to show().
When the same objects are collected in a list, and given
to animate(), the resulting frames show the objects scaled down
to be almost invisible. I tried to influence animate() with
the figsize keyword, but this is ignored..
So my question is:
How to tell animate() to which size the objects in the list should
be rendered in the animated frames?
Thank you
Example code:
# testcase: stupid 3d plot
f(x,y) = (-((x-1))^2 - ((y-1))^2 - 3 )
def desd():
p = plot([])
p = plot3d(f(x,y), (x,-5,5), (y,-5,5), ymin=-4, ymax=4)
return p
# plot in notebook looks OK
tp = desd()
show(tp, frame=False,aspect_ratio=1,figsize=8)
# test animate
ps = []
for _ in range(6):
ps.append(desd())
an = animate(ps,frame=False,aspect_ratio=1,figsize=8 )
show(an)
# looks distorted and much too small in my setupoGpxkGZURxERhHWgFri, 26 Apr 2024 13:45:35 +0200https://ask.sagemath.org/question/77098/threejs does not workhttps://ask.sagemath.org/question/73349/threejs-does-not-work/When I execute `plot3d(lambda u,v:(u^2+v^2)/4-2,(-2,2),(-2,2))`
The Edge browser(firefox deb also) shows a blank space, only an ‘i‘ in the lower right corner. The browser console reports an error.
three.min.js:1
Failed to load resource: net::ERR_FILE_NOT_FOUND
tmp_fm1inkde.html:49 Uncaught ReferenceError: THREE is not defined
at tmp_fm1inkde.html:49:17
jmol works well
plot3d(lambda u,v:(u^2+v^2)/4-2,(-2,2),(-2,2)).show(viewer='jmol')
I use sagemath9.5 installed by 'sudo apt install sagemath' on ubuntu23.04
How can I solve it?netMon, 11 Sep 2023 07:38:09 +0200https://ask.sagemath.org/question/73349/Plot the intersection of two surfaceshttps://ask.sagemath.org/question/67904/plot-the-intersection-of-two-surfaces/ This is a nice 3D plot
var('x,y,z')
U(x,y)=x^(1/2)*y^(1/2)
B(x,y)= (1/16)*x + y
#levels=[0.25,.5,0.75,1,1.25,1.5,1.75,2]
epsilon=0.01
p=plot3d(U(x,y),(x,0,2),(y,0,2),color='lightgreen',opacity=0.7,frame=False)
#for h in levels:
# p+=implicit_plot3d(U(x,y)==h,(x,0,2),(y,0,2),(z,h,h+epsilon),color='red')
# p+=implicit_plot3d(U(x,y)==h,(x,0,2),(y,0,2),(z,0,0.01),color='red')
from sage.manifolds.utilities import set_axes_labels
p+= arrow3d((0, 0, 0), (2.2, 0, 0), color='green')
p+= arrow3d((0, 0, 0), (0, 2.2, 0), color='green')
p+= arrow3d((0, 0, 0), (0, 0, 2.2), color='green')
p+=plot3d(B(x,y),(x,0,2),(y,0,2),color='pink',opacity=0.7,frame=False)
po2={'fontsize':20,'color':'black'}
t=text3d("x",(2.4,0,0),**po2)
t+=text3d("y",(0,2.4,0.0),**po2)
t+=text3d("U",(0.,0.0,2.4),**po2)
p+= text3d(r"U(x,y) = xᐧ⁵yᐧ⁵ ", (1, 1, 2.5), color=(0.5, 0, 0))
p+= set_axes_labels(p, r"x",r"y",r"z", color='lightgreen', fontweight='bold')
show(p,viewer='threejs',frame=False)
But I would like to add the intersection line of `U` and `B` in the plot. I have tried many solution without any success. Could some one gives a little help because I do not understand a word of `https://ask.sagemath.org/question/33418/plot-the-intersection-of-two-surfaces-or-solutions-of-a-system-of-eqs/` which seems normal since it is written thas `This post is a wiki. Anyone with karma > 750 is welcome to impove it`CyrilleWed, 26 Apr 2023 13:08:40 +0200https://ask.sagemath.org/question/67904/Latex in Plot3dhttps://ask.sagemath.org/question/67735/latex-in-plot3d/var('x,y,z')
U(x,y)=x^.5*y^.5
levels=[0.25,.5,0.75,1,1.25,1.5,1.75,2]
epsilon=0.01
p=plot3d(U(x,y),(x,0,2),(y,0,2),color='lightgreen',opacity=0.7,frame=False)
for h in levels:
p+=implicit_plot3d(U(x,y)==h,(x,0,2),(y,0,2),(z,h,h+epsilon),color='red')
p+=implicit_plot3d(U(x,y)==h,(x,0,2),(y,0,2),(z,0,0.01),color='red')
from sage.manifolds.utilities import set_axes_labels
p+= arrow3d((0, 0, 0), (2.2, 0, 0), color='green')
p+= arrow3d((0, 0, 0), (0, 2.2, 0), color='green')
p+= arrow3d((0, 0, 0), (0, 0, 2.2), color='green')
p+= text3d(r"U(x,y) = x^.5 y^.5", (1, 1, 2.5), color=(0.5, 0, 0))
p+= set_axes_labels(p, r"x",r"y",r"z", color='lightgreen', fontweight='bold')
show(p,viewer='threejs',frame=False)
This would be nice if only the text and label have been implemented in 3D. As I could see the track has been open in 2020. Is it implemented now (`https://github.com/sagemath/sage/issues/30226`) ?CyrilleThu, 20 Apr 2023 12:54:26 +0200https://ask.sagemath.org/question/67735/html plot render on VScode jupyterhttps://ask.sagemath.org/question/65084/html-plot-render-on-vscode-jupyter/ I am running sagemath on WSL2, and use jupyter on VScode.
But the html plot render (e.g. plot3d) of sagemath doesn't work. According to *Launching SageMath* page in sage documentation, online three.js is the default render. But
```
plot3d(lambda u,v:(u^2+v^2)/4-2,(-2,2),(-2,2)).show()
```
doesn't give the plot, and only when `online` is assigned to `True`,
```
plot3d(lambda u,v:(u^2+v^2)/4-2,(-2,2),(-2,2), online=True).show()
``` works.
So why this result is different from expected behavior and how can I use `plot3d` without assign `online` manually?
Thanks in advance.
flayedSun, 27 Nov 2022 06:51:42 +0100https://ask.sagemath.org/question/65084/How to set folder for temporary graphics fileshttps://ask.sagemath.org/question/62518/how-to-set-folder-for-temporary-graphics-files/ With Ubuntu changing to Firefox as a snap there is a problem with SageMath's location for temporary files, i.e., `$HOME/.sage/temp/$HOSTNAME/<some random 4 digit number>`, since the snap version of Firefox can't access hidden folders. Is there a way to set another location to hold the html files generates by plot3d? (The files are there but my default browser, Firefox, can't display them.) A less satisfactory solution would be to use a different browser (e.g., Epiphany) just to display these files.richardquintThu, 19 May 2022 02:45:37 +0200https://ask.sagemath.org/question/62518/Choose figsize for 3D plotshttps://ask.sagemath.org/question/61568/choose-figsize-for-3d-plots/Apparently the option figsize does not work in 3D.
sage: var('x, y')
sage: W = plot3d(x^2 + y^2, (x, -2, 2), (y, -2, 2))
sage: show(W, figsize=6)
Any suggestions?gpiresMon, 21 Mar 2022 19:39:14 +0100https://ask.sagemath.org/question/61568/arrow3d with 3d function not displayed in plot3dhttps://ask.sagemath.org/question/61437/arrow3d-with-3d-function-not-displayed-in-plot3d/ HI
SageMath 9.5 Ubuntu WSL2
arrow3d only is ok in plot3d.
arrow3d with 3d function not displayed in plot3d.
but arrow3d with 3d function is ok with implicit_plot3d.
var('x,y,z')
legend_label='f(x,y)'
def addAxis(plt) :
# add axis for real part
plt += arrow3d((0, 0, 0), (xBound, 0, 0), color='blue')
plt += text3d("X", (xBound, 0, 0), color='blue')
plt += arrow3d((0, 0, 0), (0, yBound, 0), color='green')
plt += text3d("Y", (0, yBound, 0), color='green')
plt += arrow3d((0, 0, 0), (0, 0, zBound), color='red')
plt += text3d("Z", (0,0, zBound), color='red')
plt += text3d(legend_label, (xBound,yBound, 0), color='red', fontsize=20,fontweight='bold',fontstyle='italic')
return plt
xBound=2 ; yBound=2 ; zBound=2
f(x,y)=162*x^3*y
plt=Graphics()
plt=addAxis(plt)
# 3 arrows only
show(plt,viewer='threejs',figsize=8)
plt=addAxis(plt)
plt += plot3d(f(x,y),(x,-xBound,xBound),(y,-yBound,yBound), frame=False, color='purple', opacity=0.6)
#zBound=3
#plt += plot3d(f(x,y),(x,-xBound,xBound),(y,-yBound,yBound),(z,-zBound,zBound), frame=False, color='purple', opacity=0.6)
plt=addAxis(plt)
# 3 arrows+function plot
show(plt,viewer='threejs', figsize=8)
plt=Graphics()
plt=addAxis(plt)
plt += implicit_plot3d(f(x,y)-z,(x,-xBound,xBound),(y,-yBound,yBound),(z,-zBound,zBound), frame=False, color='purple', opacity=0.6)
show(plt,viewer='threejs', figsize=8)
ortolljMon, 07 Mar 2022 09:01:01 +0100https://ask.sagemath.org/question/61437/plot3d shows a black windowhttps://ask.sagemath.org/question/55661/plot3d-shows-a-black-window/ I am using Manjaro 20.1 linux with firefox 85 and Chromium 88. I update to sage math 9.2 and now the plot3d only shows a black screen. It works with jmol and tachyon, but not with threejs nor canvas3d.
Any help is appreciated.
Thanks in advance13negroWed, 10 Feb 2021 19:07:25 +0100https://ask.sagemath.org/question/55661/Calimero effect in plot3dhttps://ask.sagemath.org/question/54100/calimero-effect-in-plot3d/ just out of curiosity, what is the reason for this [Calimero effect](https://sagecell.sagemath.org/?q=ujyywl) ? ![image description](https://nospensees.fr/wp-content/uploads/2020/06/calimero.png)?
from sage.plot.plot3d.plot3d import axes
var('x,y,z,r,alpha,beta,gamma',domain='real')
#rNum=1;alphaNum=0;betaNum=pi/4;gammaNum=pi/4
#rNum=1;alphaNum=pi/7;betaNum=pi/7;gammaNum=pi/7
rNum=1.0;alphaNum=pi/12;betaNum=pi/8;gammaNum=pi/6
numL=[r==rNum,alpha==alphaNum,beta==betaNum,gamma==gammaNum]
eqS=r^2==x^2+y^2+z^2
X=solve(eqS,x)[1].rhs()
Y=solve(eqS,y)[1].rhs()
Z=solve(eqS,z)[1].rhs()
Znum=Z.subs(numL)
S = matrix(SR,[X,Y,Z]).transpose()
Snum=S.subs(numL)
#show('S : ',S,'\t S num : ',Snum)
Plt=plot3d(Znum, (x,0,rNum), (y,0,rNum) , frame=False, color="blue",opacity=0.1)
# plot the three axis
Plt+=arrow((0,0,0), (rNum,0,0), color='black')
Plt+=text3d("X",vector([rNum,0,0])*1.1, color='black')
Plt+=arrow((0,0,0), (0,rNum,0), color='brown')
Plt+=text3d("Y",vector([0,rNum,0])*1.1, color='brown')
Plt+=arrow((0,0,0), (0,0,rNum), color='red')
Plt+=text3d("Z",vector([0,0,rNum])*1.1, color='red')
margin=0.1
show(Plt,xmax=rNum+margin,ymax=rNum+margin,zmax=rNum+margin)
ortolljMon, 02 Nov 2020 08:32:27 +0100https://ask.sagemath.org/question/54100/Use of threejs and jmol in sage 9.1 for windowshttps://ask.sagemath.org/question/53861/use-of-threejs-and-jmol-in-sage-91-for-windows/ I have been using SageMath 9.1 in Ubuntu 18.04 and the performance is excellent -- no questions asked.
Now I am trying to use SageMath 9.1 in a Msc level course, but the students' computers are all under Windows 10, and so on the classroom computer I have installed the latest 64 version of SageMath 9.1(with the 3 icons in the desktop, including the Jupyter NB which is the environment I always use). Using it, 3D scenes can only be seen as still images using "viewer='tachyon'". When using "viewer='jmol'" or "viewer='threejs'",there is no error message a scene is created, but it is empty -- blank space, no image. It seems that threejs and jmol are bundled in the repo for the Windows version of SageMath but for some reasons do not work.
In Windows 10 I have anaconda3 installed with Python 3 environment and Jupyter NB. Using it, I have tried to install Sagemath 9.1 from conda-forge using 'conda' (insluding conda-forge as a channel, with and without 'mamba' -- according to the respective instructions in the Sage manual for installing sage from anaconda) and this worked well in Ubuntu but not in Windows 10 -- in the latter case I get error message on the anaconda prompt:
Encountered problems while solving.
Problem: nothing provides requested sage
I have now also installed node.js and npm and, via the latter, also three.js . However, the installed SageMath does not recognize this version, and I do not know how to import it in the installed SageMath 9.1.
As a last measure, I have also installed the latest 64 version of Java and the latest 64 version of jmol (to be used via double-click on jmol.jar in the decompressed jmol bundle). The problem is similar as with threejs: the SageMath 9.1 does not recognize the installed jmol, and I do not know how to make it do so.
This is the situation. Can you help resolve this? I need to be able to use at least one of threejs and/or jmol (preferably, threejs!!) as alternative to tachyon in visualizing 3D scenes. Otherwise, I will have to radically restructure the course without using SageMath, since using Linux instead of Windows is, unfortunately, not an option. ShaolinuxMon, 12 Oct 2020 13:35:15 +0200https://ask.sagemath.org/question/53861/plot3d displaying black graph in jupyter for both 9.0 and 9.1https://ask.sagemath.org/question/52722/plot3d-displaying-black-graph-in-jupyter-for-both-90-and-91/I installed sage 9.1, and also installed its kernel on Jupyter.
Everything other than `plot3d` works fine.
For `plot3d`, the behavior of 9.1 is same as 9.0, it shows a black background.
If drag the mouse on it, it shows an empty frame on white background.
For example:
sage: f = lambda x, y: exp(-x**2-y**2)
sage: W = plot3d(f, (-2, 2), (-2, 2))
sage: show(W, figsize=8)
I tried all the options, with or without switch viewer="threejs".luqiyi@gmail.comTue, 28 Jul 2020 16:38:12 +0200https://ask.sagemath.org/question/52722/Animate 3d surface and add some curves ?https://ask.sagemath.org/question/46284/animate-3d-surface-and-add-some-curves/ I want animate my surface of hyperboloid by adding 2 point then draw a geodesic curve between them .
Thanks for ur help guys Taoufik ahanchaouSat, 20 Apr 2019 08:15:49 +0200https://ask.sagemath.org/question/46284/Vertex list of a surface not readily accessiblehttps://ask.sagemath.org/question/51608/vertex-list-of-a-surface-not-readily-accessible/ While preparing my answer to [this question](https://ask.sagemath.org/question/51567/how-to-plot-projections-of-a-3d-surface-onto-coordinate-planes/), I have been searching how to retrieve faces and vertices from a explicit surface plotted with `plot3d`. There is a fact that confuses me. Consider this code:
sage: surf = plot3d(lambda x,y: sin(x*y), (-pi,pi), (-pi,pi))
sage: len(surf.vertex_list())
0
This means that `surf.vertex_list()` is an empty list. However:
sage: surf = plot3d(lambda x,y: sin(x*y), (-pi,pi), (-pi,pi))
sage: show(surf)
Launched html viewer for Graphics3d Object
sage: len(surf.vertex_list())
1600
Now `surf.vertex_list()` is not an empty list and the vertices can be retrieved. So I wonder what `show(surf)` internally does so that the vertices list becomes accessible. To avoid plotting the surface, I have found that I can replace `show(surf)` by `surf.triangulate()`, but I also wonder if there is a best option.JuanjoThu, 28 May 2020 15:58:33 +0200https://ask.sagemath.org/question/51608/Plotting surfaces over non-rectangular domainhttps://ask.sagemath.org/question/51485/plotting-surfaces-over-non-rectangular-domain/I'm wondering if we can plot a surface over non-rectangular domain.
E.g.
plot3d(lambda x, y: 2 + sin(x) + cos(y) if y < 2*pi - x else False, (x,x0,x1), (y,y0,y1))
or something. I've tried playing with the domain like
implicit_plot3d( (s,t,2+sin(s)+cos(t)), (s,0,2*pi), (t,0 2*pi - s) )
but again no dice. I'm sure I could just draw a whole bunch of polygons but I wonder if there's a better way.ShaiThu, 21 May 2020 23:56:26 +0200https://ask.sagemath.org/question/51485/Plot3D deboxedhttps://ask.sagemath.org/question/51368/plot3d-deboxed/ This code works nicely
var("x,y,z")
f(x,y) = (.5*x^0.4+.5*y^0.4)
z1, z2 = 0, 1.3
ni = 5
dz = (z2-z1)/ni
levels = [z1,z1+dz..z2]
curves = contour_plot(f(x,y),(x,.001,2), (y,.001,2), contours=levels,
cmap="gist_earth")
def col2(x,y):
return float(0.5*dz+floor((f(x,y)-z1)/dz)/ni)
surf = plot3d(f(x,y), (x,.001,2), (y,.001,2), color=(col2,colormaps.gist_earth), plot_points=300)
arrow1= arrow3d((0,0,0), (2,0,0), 1)
arrow2= arrow3d((0,0,0), (0,2,0), 1)
arrow3= arrow3d((0,0,0), (0,0,2), 1)
t1=text3d("x", (2.15,0,0), color=(0.5,0,0))
t2= text3d("y", (0,2.15,0), color=(0.5,0,0))
t3= text3d("EU", (0,0,3.), color=(0.5,0,0))
offset = 0
plane = plot3d(offset, (x,.001,2), (y,.001,2), color=(col2,colormaps.gist_earth), plot_points=300,viewer='threejs')
show(surf+plane+arrow1+arrow2+arrow3+t1+t2+t3)
I know that I could not have presently LaTeX label but I wonder if there is a way to debox it.
CyrilleSun, 10 May 2020 20:53:16 +0200https://ask.sagemath.org/question/51368/plot3d method does not properly work with threejshttps://ask.sagemath.org/question/50051/plot3d-method-does-not-properly-work-with-threejs/ The `plot3d` method allows to embed 2D objects in 3D graphics. It seems to work properly with the jmol viewer. However, it fails when the viewer is threejs. For example, the code
p = sum(plot((5-k)*sin(x), 0, 10, thickness=10,
color=colormaps.jet(50*k)).plot3d(z=k) for k in range(6))
show(p, viewer="jmol")
show(p, viewer="threejs")
yields this result:
![image description](/upfiles/1582626986673771.png)
The first graphic, corresponding to jmol, is correct. The second graphic, produced by threejs, is completely wrong.JuanjoTue, 25 Feb 2020 11:37:40 +0100https://ask.sagemath.org/question/50051/How do i plot a piecewise function with functional constraints?https://ask.sagemath.org/question/49060/how-do-i-plot-a-piecewise-function-with-functional-constraints/ I have to plot a function T(x,x) which equals x*y if x*y>0 and x+y otherwise. I have defined the function:
def T(x,y):
if (x*y>0):
return x*y
else:
return x+y
but it does not work.mattiavTue, 17 Dec 2019 15:34:09 +0100https://ask.sagemath.org/question/49060/Saving notebooks with 3dplotshttps://ask.sagemath.org/question/48061/saving-notebooks-with-3dplots/ Hi I tried both html and .pdf, but the 3dplots seem to have disappeared. Is there a trick to get a copy of your session,
includimg the 3dplots?florinWed, 25 Sep 2019 19:28:27 +0200https://ask.sagemath.org/question/48061/Discontinuous surface color by z-levelhttps://ask.sagemath.org/question/46541/discontinuous-surface-color-by-z-level/Hi there,
I want to plot a surface $z=f(x,y)$ together with the level curves (side by side). I know how to doi it when $f$ is continuous, or even bounded, but I run in trouble for uglier functions. Here are two examples (in CoCalC : a few things need to be adapted to use Jupyter) : the first works
var('x,y,s,t')
h(x,y)= x*y^2/(x^2+y^4)
cm = colormaps.Blues
def c(x,y):
return 0.6+x*y^2/(x^2+y^4+0.005)# Colorier ceci pose des problèmes, à cause de la singularité.
S=plot3d(h,(x,-1,1),(y,-1,1),color = (c,cm), opacity=1, mesh=1)
show(S)
C=contour_plot(h, (x,-1, 1), (y,-1, 1),cmap='Blues',linestyles='solid', colorbar=True)
show(C,figsize=4)
While the second, below, does not work as I would like to
h(x,y)= y/(x^2+y^2)
cm = colormaps.Spectral
def c(x,y):
return float(y/(x^2 + y^2+0.005))# Colorier ceci pose des problèmes, à cause de la singularité.
S=plot3d(h,(x,-1,1),(y,-1,1),color = (c,cm), opacity=1, mesh=1)
show(S, frame_aspect_ratio=[20,20,1])
C=contour_plot(h,(x,-1.5,1.5),(y,-1.5,1.5), cmap = "Spectral",
contours = [-2,-1, -0.5,-0.25,0,0.25,0.5,1,2], colorbar = True,
axes = True,
labels = True, label_colors='black',
label_inline=True, label_fontsize=8,
gridlines = True, axes_labels=['$x$','$y$'])
show(C,figsize=8)
I tried a few things, among other, what can be found https://ask.sagemath.org/question/7581/use-a-colormap-for-implicit_plot3d/[here (old post)](https://ask.sagemath.org/question/7581/use-a-colormap-for-implicit_plot3d/), but the discontinuity seems to cause some problems.
Suggestions?JCThu, 16 May 2019 03:12:51 +0200https://ask.sagemath.org/question/46541/How to combine 3d and 2d plots?https://ask.sagemath.org/question/46508/how-to-combine-3d-and-2d-plots/ Hi, I am trying to include 2d plots of a 3d functions in specific points, fx. if i have a plottet function z=y*z and then i want to plot a function over when y=1 or 2 or 3 and so on. or when x=1 or 2 or 3 and so on.
I am dealing with this assignment:
sage: x,y,z = var('x,y,z')
sage: f = x^2+sqrt(y)
Then i can prepare that one for a 3d plot
sage: P = f.plot3d((x,-5,5),(y,-5,5),color="red",opacity=0.7)
Then i read something somewhere that you can put the cuts in the 3dplot by
sage: plot3d(z=0, **kwds)
and they gave the EXAMPLE:
sage: sum([plot(z*sin(x), 0, 10).plot3d(z) for z in range(6)]) #long
So for my case i try
sage: S = sum([plot(x^2+sqrt(y), -5,5 for y in range(6)])
sage: K = P+S
sage: K.show(aspect_ratio=[1,1,1])
Because i don't know how to include the z axis in the example. So i get some lines but they are lying down on the x/y axis i tried changing the variable y with z but it doesnt change anything.
Please help me!
Kind regards
Martin MårtenssonMartin MårtenssonMon, 13 May 2019 21:52:54 +0200https://ask.sagemath.org/question/46508/Point -> Vector to a pointhttps://ask.sagemath.org/question/46034/point-vector-to-a-point/Hello everyone,
If i have point in 3D
A=point3d((4,3,2),size=10,color='red',opacity=.5)
How to create a vector from the origin to the point.
I know i could define the vector. But I would rather have a point, for plotting reasons
And i would like to plot the Point and the Vector, with automatic labeling of the coordinates.
I have managed to do this like:
from sage.plot.plot3d.shapes2 import frame3d
F=frame3d([0,0,0],vector([10,10,10]),color='red')
A=points((4,3,2),size=10,color='red',opacity=.5)
B=point([(4,3,8)],size=10,color='red',opacity=.5)
t = var('t')
p = vector([4,3,2])
q = vector([0,0,0])
vec=parametric_plot3d(p*t+q, (t,0,1))
#vectB=vector(B.xdata[1],B.ydata[1],B.zdata[1])
e=0.2
eps=vector([4+e,3+e,2+e])
T_A = text3d('A',eps)
#T_B = text3d('B',B)
F+A+T_A+B+vec
Is there any better, way to do it?
Here is the file:
https://share.cocalc.com/share/a3f14e05-7729-406f-97c5-be5b73646381/vector/ebene.sagews?viewer=sharethethaSun, 07 Apr 2019 00:10:33 +0200https://ask.sagemath.org/question/46034/plot3d not displaying - only says "Graphics3d Object"?!https://ask.sagemath.org/question/41731/plot3d-not-displaying-only-says-graphics3d-object/ Hello
I have a problem, I hope you can help. I'm trying to use plot3d, but instead of drawing a plot, it just prints out the text "Graphics3d Object"
Here is an example Sage snippet that exhibits this problem:
f(x,y) = abs(x*y)
X = plot3d(f, (x,105,72), (y,0.8293,55.8271));
show(X)
I have seen some functions plot OK -- I can't see a pattern to when it does and doesn't work. For example, this does work:
f(x,y) = abs(x*y)
X = plot3d(f, (x,0,10), (y,0,10));
show(X)
This bug is repeatable. I am using 64 bit Linux Mint (Ubuntu), and using the notebook in latest Firefox.
Any help much appreciated.
Thank you,
- Daniel
wintersteinFri, 23 Mar 2018 11:08:02 +0100https://ask.sagemath.org/question/41731/3d plots flattened when printing to filehttps://ask.sagemath.org/question/41312/3d-plots-flattened-when-printing-to-file/When I print to file using The Sage Notebook (flask) - clicking the print option and then printing to file using CUPS - everything is displayed correctly except plot3d plots which are squeezed to have a height of a few centimeters while the width remains the same. I do not have the same problem with other types of plots like "plot" or "countourplot".
I do not know whether this has anything to do with my screen being 4k, but it reminds me of similar picture scaling issues I have with maple.
What I get: https://s17.postimg.org/d3q80qlf3/screenshot.png
What I expected: https://s17.postimg.org/72sj3vokv/screenshot.pngPoetastropheWed, 28 Feb 2018 18:48:39 +0100https://ask.sagemath.org/question/41312/"mesh=" juypter vs. -notebookhttps://ask.sagemath.org/question/35802/mesh-juypter-vs-notebook/Perhaps I should send this to some devel or support group ?
Starting command line:
sage -notebook
Comes up and executes:
var('x,y')
plot3d(sin(x-y)*y*cos(x),(x,-3,3),(y,-3,3), mesh=True)
Correctly.
Whereas:
sage -n jupyter
Fails with miscellaneous assertion type errors.
sagemath 7.3 in both cases.
A friend also point out the option "color='yellow' " also fails in jupyter.
----------
Edit (slelievre):
I confirm I can observe this also with Sage 7.4. Here is the error message I get:
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-3-44b2387a145a> in <module>()
----> 1 plot3d(sin(x-y)*y*cos(x),(x,-Integer(3),Integer(3)),(y,-Integer(3),Integer(3)), mesh=True)
/opt/s/sage-7.4/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in __call__(self, result)
244 self.start_displayhook()
245 self.write_output_prompt()
--> 246 format_dict, md_dict = self.compute_format_data(result)
247 self.update_user_ns(result)
248 self.fill_exec_result(result)
/opt/s/sage-7.4/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in compute_format_data(self, result)
148
149 """
--> 150 return self.shell.display_formatter.format(result)
151
152 # This can be set to True by the write_output_prompt method in a subclass
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/formatter.pyc in format(self, obj, include, exclude)
158 # First, use Sage rich output if there is any
159 PLAIN_TEXT = u'text/plain'
--> 160 sage_format, sage_metadata = self.dm.displayhook(obj)
161 assert PLAIN_TEXT in sage_format, 'plain text is always present'
162 if sage_format.keys() != [PLAIN_TEXT]:
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.pyc in displayhook(self, obj)
764 self._backend.set_underscore_variable(obj)
765 plain_text, rich_output = self._rich_output_formatter(obj, dict())
--> 766 return self._backend.displayhook(plain_text, rich_output)
767
768 def display_immediately(self, obj, **rich_repr_kwds):
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/rich_output/backend_ipython.pyc in displayhook(self, plain_text, rich_output)
525 from sage.repl.display.jsmol_iframe import JSMolHtml
526 jsmol = JSMolHtml(rich_output, height=500)
--> 527 return ({u'text/html': jsmol.iframe(),
528 u'text/plain': plain_text.text.get_unicode(),
529 }, {})
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/jsmol_iframe.py in iframe(self)
259 </iframe>
260 """
--> 261 escaped_inner_html = self.inner_html().replace('"', '"')
262 iframe = IFRAME_TEMPLATE.format(
263 script=self.js_script(),
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/jsmol_iframe.py in inner_html(self)
235 """
236 return INNER_HTML_TEMPLATE.format(
--> 237 script=self.js_script(),
238 width=self._width,
239 height=self._height,
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/jsmol_iframe.py in js_script(self)
193 """
194 script = [r"["]
--> 195 for line in self.script().splitlines():
196 script += [r" '{0}',".format(line)]
197 script += [r"].join('\n');"]
/opt/s/sage-7.4/src/sage/misc/cachefunc.pyx in sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ (/opt/s/sage-7.4/src/build/cythonized/sage/misc/cachefunc.c:12716)()
2399 if self.cache is None:
2400 f = self.f
-> 2401 self.cache = f(self._instance)
2402 return self.cache
2403
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/jsmol_iframe.py in script(self)
156 command, obj, meshfile = line.split(' ', 3)
157 assert command == 'pmesh'
--> 158 assert meshfile.startswith('"') and meshfile.endswith('"\n')
159 meshfile = meshfile[1:-2] # strip quotes
160 script += [
AssertionError:rrogersWed, 30 Nov 2016 00:42:58 +0100https://ask.sagemath.org/question/35802/Numerical Integral with variable paramshttps://ask.sagemath.org/question/40618/numerical-integral-with-variable-params/ I am trying to write some code to plot a function of an integral whose integrand depends on two variables, much like the following:
a = var('a')
b = var('b')
plot3d(numerical_integral((x+a+b), 0, 1, params=[a,b])[0],(a,0,1),(b,0,1))
This code raises an error `NotImplementedError: free variable: b`. Which would be the correct way to implement this code?jepstraMon, 15 Jan 2018 16:24:26 +0100https://ask.sagemath.org/question/40618/ParametrizedSurface3D to epshttps://ask.sagemath.org/question/40420/parametrizedsurface3d-to-eps/Can I convert a ParametrizedSurface3D plot to an eps file? I understand it's not a Graphics object, does this mean there's no hope?jdtj2Mon, 01 Jan 2018 15:55:35 +0100https://ask.sagemath.org/question/40420/Remove shadows from axes in plot3d with viewer tachyonhttps://ask.sagemath.org/question/39972/remove-shadows-from-axes-in-plot3d-with-viewer-tachyon/I would like to remove the shadows from the axes that are projected onto a plot3d image I created. Thank you in advance.NonlocalWed, 06 Dec 2017 17:08:42 +0100https://ask.sagemath.org/question/39972/Sagemath 8.0 and Sagemath 8.1 and Windows 10https://ask.sagemath.org/question/39798/sagemath-80-and-sagemath-81-and-windows-10/ It seems that there is no solution to my problem but I am still hoping. I installed the Windows native version of Sagemath and every try to use plot3d (i.e. var('y') plot3d( 4*x*exp(-x^2-y^2), (x,-2,2), (y,-2,2))) runs into the following error:
/opt/sagemath-8.0/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py:590: RichReprWarning: Exception in _rich_repr_ while displaying object: Jmol failed to create file '/dot_sage/temp/Sandman/16196/dir_oUJsU7/preview.png', see '/dot_sage/temp/Sandman/16196/tmp_9jJjSY.txt' for details
RichReprWarning,
Is anybody out there who can help to fix that Sagemath bug?
Thanks for your help!AiKjuSun, 26 Nov 2017 15:38:09 +0100https://ask.sagemath.org/question/39798/How to color a 3d plot by z-level?https://ask.sagemath.org/question/8964/how-to-color-a-3d-plot-by-z-level/I'd like to color a 3d plot based on z-level. I think this is easy to do in Maple or Mathematica, but I've been searching the web for help on doing this in Sage and can't find anything to help with plot3d or implicit_plot3d.
Here's the implicit_plot3d I'm using.
var('x,y,z')
implicit_plot3d(x^2-y^2*z == 0,(x,-4,4),(y,-4,4),(z,-4,4)).show(mesh=True)
Also, are there color maps in Sage that produce plots with colors and lighting similar to the default in Mathematica?
calc314Wed, 09 May 2012 23:27:40 +0200https://ask.sagemath.org/question/8964/