Skip to content

Commit 15f3d39

Browse files
author
Matthias Koeppe
committed
sage.plot: Update # needs
1 parent 7590409 commit 15f3d39

File tree

6 files changed

+29
-24
lines changed

6 files changed

+29
-24
lines changed

src/sage/plot/graphics.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def is_Graphics(x):
6464
sage: from sage.plot.graphics import is_Graphics
6565
sage: is_Graphics(1)
6666
False
67-
sage: is_Graphics(disk((0.0, 0.0), 1, (0, pi/2)))
67+
sage: is_Graphics(disk((0.0, 0.0), 1, (0, pi/2))) # needs sage.symbolic
6868
True
6969
"""
7070
return isinstance(x, Graphics)
@@ -1359,6 +1359,7 @@ def _set_scale(self, subplot, scale=None, base=None):
13591359
13601360
EXAMPLES::
13611361
1362+
sage: # needs sage.symbolic
13621363
sage: p = plot(x, 1, 10)
13631364
sage: fig = p.matplotlib()
13641365
sage: ax = fig.get_axes()[0]
@@ -1373,6 +1374,7 @@ def _set_scale(self, subplot, scale=None, base=None):
13731374
13741375
TESTS::
13751376
1377+
sage: # needs sage.symbolic
13761378
sage: p._set_scale(ax, 'log')
13771379
Traceback (most recent call last):
13781380
...

src/sage/plot/histogram.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ def histogram(datalist, **options):
274274
275275
sage: nv = normalvariate
276276
sage: H = histogram([nv(0, 1) for _ in range(1000)], bins=20, density=True, range=[-5, 5])
277-
sage: P = plot(1/sqrt(2*pi)*e^(-x^2/2), (x, -5, 5), color='red', linestyle='--')
278-
sage: H+P
277+
sage: P = plot(1/sqrt(2*pi)*e^(-x^2/2), (x, -5, 5), color='red', linestyle='--') # needs sage.symbolic
278+
sage: H + P # needs sage.symbolic
279279
Graphics object consisting of 2 graphics primitives
280280
281281
.. PLOT::

src/sage/plot/line.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ def line2d(points, **options):
590590
591591
A red, blue, and green "cool cat"::
592592
593+
sage: # needs sage.symbolic
593594
sage: G = plot(-cos(x), -2, 2, thickness=5, rgbcolor=(0.5,1,0.5))
594595
sage: P = polygon([[1,2], [5,6], [5,0]], rgbcolor=(1,0,0))
595596
sage: Q = polygon([(-x,y) for x,y in P[0]], rgbcolor=(0,0,1))

src/sage/plot/plot3d/base.pyx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,9 +1998,10 @@ end_scene""".format(
19981998
19991999
This works when faces have more then 3 sides::
20002000
2001-
sage: P = polytopes.dodecahedron() # needs sage.geometry.polyhedron
2002-
sage: Q = P.plot().all[-1] # needs sage.geometry.polyhedron
2003-
sage: print(Q.stl_binary()[:40].decode('ascii')) # needs sage.geometry.polyhedron
2001+
sage: # needs sage.geometry.polyhedron sage.groups
2002+
sage: P = polytopes.dodecahedron()
2003+
sage: Q = P.plot().all[-1]
2004+
sage: print(Q.stl_binary()[:40].decode('ascii'))
20042005
STL binary file / made by SageMath / ###
20052006
"""
20062007
import struct
@@ -2060,9 +2061,10 @@ end_scene""".format(
20602061
20612062
Now works when faces have more then 3 sides::
20622063
2063-
sage: P = polytopes.dodecahedron() # needs sage.geometry.polyhedron
2064-
sage: Q = P.plot().all[-1] # needs sage.geometry.polyhedron
2065-
sage: print(Q.stl_ascii_string().splitlines()[:7]) # needs sage.geometry.polyhedron
2064+
sage: # needs sage.geometry.polyhedron sage.groups
2065+
sage: P = polytopes.dodecahedron()
2066+
sage: Q = P.plot().all[-1]
2067+
sage: print(Q.stl_ascii_string().splitlines()[:7])
20662068
['solid surface',
20672069
'facet normal 0.0 0.5257311121191338 0.8506508083520399',
20682070
' outer loop',

src/sage/plot/plot3d/revolution_plot3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# sage.doctest: needs sage.plot
1+
# sage.doctest: needs sage.plot sage.symbolic
22
"""
33
Surfaces of revolution
44

src/sage/plot/plot3d/transform.pyx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ def rotate_arbitrary(v, double theta):
174174
175175
sage: rotate_arbitrary((1,2,3), -1).det()
176176
1.0000000000000002
177-
sage: rotate_arbitrary((1,1,1), 2*pi/3) * vector(RDF, (1,2,3)) # rel tol 2e-15
177+
sage: rotate_arbitrary((1,1,1), 2*pi/3) * vector(RDF, (1,2,3)) # rel tol 2e-15 # needs sage.symbolic
178178
(1.9999999999999996, 2.9999999999999996, 0.9999999999999999)
179179
sage: rotate_arbitrary((1,2,3), 5) * vector(RDF, (1,2,3)) # rel tol 2e-15
180180
(1.0000000000000002, 2.0, 3.000000000000001)
181-
sage: rotate_arbitrary((1,1,1), pi/7)^7 # rel tol 2e-15
181+
sage: rotate_arbitrary((1,1,1), pi/7)^7 # rel tol 2e-15 # needs sage.symbolic
182182
[-0.33333333333333337 0.6666666666666671 0.6666666666666665]
183183
[ 0.6666666666666665 -0.33333333333333337 0.6666666666666671]
184184
[ 0.6666666666666671 0.6666666666666667 -0.33333333333333326]
@@ -194,7 +194,7 @@ def rotate_arbitrary(v, double theta):
194194
195195
Setup some variables::
196196
197-
sage: vx,vy,vz,theta = var('x y z theta')
197+
sage: vx,vy,vz,theta = var('x y z theta') # needs sage.symbolic
198198
199199
Symbolic rotation matrices about X and Y axis::
200200
@@ -205,37 +205,37 @@ def rotate_arbitrary(v, double theta):
205205
way to tell Maxima that `x^2+y^2+z^2=1` which would make for
206206
a much cleaner calculation::
207207
208-
sage: vy = sqrt(1-vx^2-vz^2)
208+
sage: vy = sqrt(1-vx^2-vz^2) # needs sage.symbolic
209209
210210
Now we rotate about the `x`-axis so `v` is in the `xy`-plane::
211211
212-
sage: t = arctan(vy/vz)+pi/2
213-
sage: m = rotX(t)
214-
sage: new_y = vy*cos(t) - vz*sin(t)
212+
sage: t = arctan(vy/vz)+pi/2 # needs sage.symbolic
213+
sage: m = rotX(t) # needs sage.symbolic
214+
sage: new_y = vy*cos(t) - vz*sin(t) # needs sage.symbolic
215215
216216
And rotate about the `z` axis so `v` lies on the `x` axis::
217217
218-
sage: s = arctan(vx/new_y) + pi/2
219-
sage: m = rotZ(s) * m
218+
sage: s = arctan(vx/new_y) + pi/2 # needs sage.symbolic
219+
sage: m = rotZ(s) * m # needs sage.symbolic
220220
221221
Rotating about `v` in our old system is the same as rotating
222222
about the `x`-axis in the new::
223223
224-
sage: m = rotX(theta) * m
224+
sage: m = rotX(theta) * m # needs sage.symbolic
225225
226226
Do some simplifying here to avoid blow-up::
227227
228-
sage: m = m.simplify_rational()
228+
sage: m = m.simplify_rational() # needs sage.symbolic
229229
230230
Now go back to the original coordinate system::
231231
232-
sage: m = rotZ(-s) * m
233-
sage: m = rotX(-t) * m
232+
sage: m = rotZ(-s) * m # needs sage.symbolic
233+
sage: m = rotX(-t) * m # needs sage.symbolic
234234
235235
And simplify every single entry (which is more effective that simplify
236236
the whole matrix like above)::
237237
238-
sage: m.parent()([x.simplify_full() for x in m._list()]) # long time; random
238+
sage: m.parent()([x.simplify_full() for x in m._list()]) # random # long time, needs sage.symbolic
239239
[ -(cos(theta) - 1)*x^2 + cos(theta) -(cos(theta) - 1)*sqrt(-x^2 - z^2 + 1)*x + sin(theta)*abs(z) -((cos(theta) - 1)*x*z^2 + sqrt(-x^2 - z^2 + 1)*sin(theta)*abs(z))/z]
240240
[ -(cos(theta) - 1)*sqrt(-x^2 - z^2 + 1)*x - sin(theta)*abs(z) (cos(theta) - 1)*x^2 + (cos(theta) - 1)*z^2 + 1 -((cos(theta) - 1)*sqrt(-x^2 - z^2 + 1)*z*abs(z) - x*z*sin(theta))/abs(z)]
241241
[ -((cos(theta) - 1)*x*z^2 - sqrt(-x^2 - z^2 + 1)*sin(theta)*abs(z))/z -((cos(theta) - 1)*sqrt(-x^2 - z^2 + 1)*z*abs(z) + x*z*sin(theta))/abs(z) -(cos(theta) - 1)*z^2 + cos(theta)]

0 commit comments

Comments
 (0)