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.Thu, 17 Jan 2019 13:19:37 -0600show all view with same x size of Hanoi's Towershttp://ask.sagemath.org/question/45084/show-all-view-with-same-x-size-of-hanois-towers/
Hi
I did this little program to visualize all Hanoi's Towers steps in Jupyter Notebook sagemath 8.4 ,W10.
why my x-axis is not always the same width size in each view?
figsize=[figSizeXmax,figSizeYmax] does not seem to work.
how can I manage to get the same x length for each graph ?
[Code On Cocalc.com](https://cocalc.com/projects/9c478dc8-084a-43b6-aedc-e027b42adfa8/files/HanoiTower.ipynb?session=default)ortolljThu, 17 Jan 2019 13:19:37 -0600http://ask.sagemath.org/question/45084/Can't display figureshttp://ask.sagemath.org/question/44953/cant-display-figures/hello,
i installed Sage on a new computer this morning,
but i can't display any figures.
That's the error i get :
> /home/xxx/Documents/SageMath/local/lib/python2.7/site-packages/sage/\
repl/rich_output/display_manager.py:592: RichReprWarning: Exception in
_rich_repr_ while displaying object: libtk8.6.so: cannot open shared
object file: No such file or directory
RichReprWarning,
Graphics object consisting of 1 graphics primitive
Anyone got an idea why?
i'm using the notebook of sagemaths
Thanks.tommeTue, 08 Jan 2019 05:15:39 -0600http://ask.sagemath.org/question/44953/What is meant by "graphics primitive" in the sage documentation?http://ask.sagemath.org/question/44100/what-is-meant-by-graphics-primitive-in-the-sage-documentation/ I'm currently learning sage, and I keep seeing the phrase, "graphics primitive" mentioned in the manual, but I'm not quite sure what is meant by that. The closest thing I've found to a definition of it is on the page "Plotting Primitives" where it is defined as "things that know how to draw themselves in 2D". Does this just mean that a primitive is anything predefined by sage, like circles and lines? Also, are there only "graphics primitives" and not any other kind?FubwubsSat, 27 Oct 2018 18:35:38 -0500http://ask.sagemath.org/question/44100/graph vertex labellinghttp://ask.sagemath.org/question/42892/graph-vertex-labelling/I have a graph (poset actually) that has a rational function labelling each vertex. I would like to show just the edges and the vertex labels. If I try to set `vertex_shape='None'` I get a crash deep in matplotlib. If I try anything else I get the marker symbol printed over the label. For example
P = RootSystem(['A',3]).root_poset()
P.show(vertex_color='white')
Will show the graph with circles over the labels. If I shrink the labels, then the edges cover the labels.
If I do
P = RootSystem(['A',3]).root_poset()
P.show(vertex_color='white', vertex_shape='None')
there is a strange crash.deinstTue, 10 Jul 2018 12:11:12 -0500http://ask.sagemath.org/question/42892/Show3d has no partition optionhttp://ask.sagemath.org/question/42820/show3d-has-no-partition-option/ `graph.show(partition = Pi)` works but `graph.show3d(partition =Pi)` doesn't. Is this something that might be fixed in the future? Or is there a workaround? Bjørn Kjos-HanssenWed, 04 Jul 2018 02:19:18 -0500http://ask.sagemath.org/question/42820/Display a graphics object with multiple primativeshttp://ask.sagemath.org/question/42106/display-a-graphics-object-with-multiple-primatives/ I'm trying to show how a set of lines changes with a matrix transformation. The part i am having trouble with is:
g=Graphics()
for c in range(10):
g.add_primitive(parametric_plot(B*vector([x,c]) , (x, 0, 2*pi)))
show(g)
Because it doesn't plott the lines like i wanted but instead gives me
> 'Graphics' object has no attribute 'options'ionsmeFri, 20 Apr 2018 15:02:29 -0500http://ask.sagemath.org/question/42106/Graphics not plotted in same plot?http://ask.sagemath.org/question/41925/graphics-not-plotted-in-same-plot/I'm trying to make a sierpinsky triangle recursively, and i can generate all the triangles (via 3 line segments), however when i go to show my list, the graphics print separately. I saw on the documentation there's a graphics_array, which seems useful, but there weren't many examples and my tinkering with it was pretty much useless, especially since the "adjoin" feature is not yet implemented.
Also tried passing the graphics object "some_lines" to get filled by the function, but it doesn't seem like it accesses the reference. Code attached, maybe you can see a way I can plot all the lines within one sum of graphics, as was my initial attempt:
def draw_tri(some_lines, endpts):
some_lines+=line([endpts[0], endpts[1]], color='blue')
some_lines+=line([endpts[0], endpts[2]], color='blue')
some_lines+=line([endpts[1], endpts[2]], color='blue')
return
def get_mid(x,y):
return (x+y)/2
def recurse_SG(some_lines, n, endpts):
#graphics_sum = graphics_array([line([endpts[0], endpts[1]], color='blue')],3, 1)
if(n==1):
#graphics_sum[i]=draw_tri(endpts)
draw_tri(some_lines, endpts)
else:
recurse_SG(some_lines, n-1, [endpts[0], (get_mid(endpts[0][0], endpts[1][0]), get_mid(endpts[0][1], endpts[1][1])), (get_mid(endpts[0][0], endpts[2][0]), get_mid(endpts[0][1], endpts[2][1]))])
recurse_SG(some_lines, n-1, [endpts[1], (get_mid(endpts[1][0], endpts[0][0]), get_mid(endpts[1][1], endpts[0][1])), (get_mid(endpts[1][0], endpts[2][0]), get_mid(endpts[1][1], endpts[2][1]))])
recurse_SG(some_lines, n-1, [endpts[2], (get_mid(endpts[2][0], endpts[0][0]), get_mid(endpts[2][1], endpts[0][1])), (get_mid(endpts[2][0], endpts[1][0]), get_mid(endpts[2][1], endpts[1][1]))])
show(some_lines, axes=false)Luther13Sun, 08 Apr 2018 20:08:27 -0500http://ask.sagemath.org/question/41925/MatrixPlots with cell entrieshttp://ask.sagemath.org/question/41234/matrixplots-with-cell-entries/ Is there a nice way to combine `MatrixPlot` with something else to have a label in each cell such as in this picture?
![image description](https://i.stack.imgur.com/bgNdN.png)jepstraThu, 22 Feb 2018 11:19:50 -0600http://ask.sagemath.org/question/41234/Plotting in Sagehttp://ask.sagemath.org/question/41250/plotting-in-sage/I have some numbers in two separate arrays, and I want to plot them in such a way that the end result looks more or less like this:
![image description](/upfiles/15194978051374454.png)
Currently, I have a code that looks like this:
res_blue = [...] # data for the blue circles (removed for brevity)
res_red = [...] # data for the red crosses (removed for brevity)
list_plot(res_red, color='red')
But, instead the above code generates only plot with red dots. How can I combine the two arrays in the same plot, choose their color and the shape to be put in the plot?ninhoSat, 24 Feb 2018 12:46:39 -0600http://ask.sagemath.org/question/41250/Plot/Show Png/jpg in sagemath worksheethttp://ask.sagemath.org/question/40501/plotshow-pngjpg-in-sagemath-worksheet/Hello every one, I am testing sagemath for course creation. What is the fastest way to embeed png pictures and diplay them? Something like this: https://paper.dropbox.com/doc/Ubung-Lagebeziehung-Gerade-Gerade-NiPkMCucw7FeDxj15u6aZ?_tk=share_copylink thethaSat, 06 Jan 2018 09:44:00 -0600http://ask.sagemath.org/question/40501/How can i sketch the graph in sage?http://ask.sagemath.org/question/39894/how-can-i-sketch-the-graph-in-sage/ I can't add a picture but i can be described we want to sketch coordinate system in sage and we want to combine with emoji it looks like smiling face eyes should be circle mouth should be triangle who can help to us?selinkirisFri, 01 Dec 2017 10:48:47 -0600http://ask.sagemath.org/question/39894/Can I import a graphic and add to it?http://ask.sagemath.org/question/39285/can-i-import-a-graphic-and-add-to-it/One of my collaborators has made an image of some regions, and now my job is to superimpose a plot on it. So I would like to do something like the following:
pic = load('pic.png')
pts = list_plot(points)
fig = pic + pts
fig.show()
However, I get the error:
IOError: [Errno 2] No such file or directory:
'pic.png.sobj'
Is there a way to get around this, or perhaps convert my png to a sobj? (The path to the file is correct.)diana.davisThu, 26 Oct 2017 14:05:01 -0500http://ask.sagemath.org/question/39285/Sage for win 10 graphics brokenhttp://ask.sagemath.org/question/39207/sage-for-win-10-graphics-broken/I installed Sage 8 native winstall into windows 10, and all graphics plots just give me the broken graphics icon. It works with Sage for Ubuntu on the same windows so it's not my graphics system, IMHO.
Okay, the problem seems to be with Jupyter. If I start the shell from Windows instead, then Sage, then the notebook() for sagenb, the graphics work fine and are very fast. That starts a bash shell, though. Oddly, I have Ubuntu for Windows, ran Sage from that bash shell and it's still slower than the sagenb from the bash shell installed by the windows install. So I guess I'll just run that.cybervigilanteWed, 18 Oct 2017 22:03:02 -0500http://ask.sagemath.org/question/39207/how to plot a circle (without circle())http://ask.sagemath.org/question/38889/how-to-plot-a-circle-without-circle/ Hello,
I know you can plot a circle with circle(x,y,radius), but how do you do it with plot()?germacWed, 20 Sep 2017 15:43:54 -0500http://ask.sagemath.org/question/38889/How to generate graphs random geometric shapes?http://ask.sagemath.org/question/38484/how-to-generate-graphs-random-geometric-shapes/ I would like to create practice problems, rather than reusing old exam questions, to help my students practice solving geometric problems. I would like to use sagetex to produce random variations similar the questions I have listed below. I would supply examples of the pictures, but I do not have enough points to post pictures.
I am wish to be able to make one worksheet where each time it is printed, the values would be randomly assigned and graph would be produced. I know how to assign a random integer value to a variable; however, how to produce the graphs I have no understanding of how to achieve that. Thus for each of the example problems how to make the graph and how to assign the random variability to that graph.
**Example questions**
*The diagram below shows a child’s toy which is made up of a circular hoop, centre O, radius 7 cm. The hoop is suspended in a horizontal plane by three equal strings XA, XB, and XC. Each string is of length 25 cm. The points A, B and C are equally spaced round the circumference of the hoop and X is vertically above the point O.*
- Calculate the length of XO.
- Find the angle, in degrees, between any string and the horizontal plane.
- Write down the size of angle AOB
- Calculate the length of AB.
- Find the angle between strings XA and XB.
*ABCDV is a solid glass pyramid. The base of the pyramid is a square of side 3.2 cm. The vertical height is 2.8 cm. The vertex V is directly above the centre O of the base.*
- Calculate the volume of the pyramid
- The glass weighs 9.3 grams per cm^3. Calculate the weight of the pyramid.
- Show that the length of the sloping edge VC of the pyramid is 3.6 cm
- Calculate the angle at the vertex, BVC
- Calculate the total surface are of the pyramid.
LaoshiSun, 06 Aug 2017 03:20:11 -0500http://ask.sagemath.org/question/38484/Transparency option in streamline plothttp://ask.sagemath.org/question/37728/transparency-option-in-streamline-plot/In most graphics functions it's possible to set the transparency of the plot with the `alpha` option. In a streamline plot, e.g. take
sage: var('x, y')
sage: streamline_plot((y, -x**2 * y - x + y), (x, -3, 3), (y, -3, 3), density=1.4, color='black')
it doesn't work:
sage: var('x, y')
sage: streamline_plot((y, -x**2 * y - x + y), (x, -3, 3), (y, -3, 3), density=1.4, color='black', alpha=0.5)
...
WARNING: Ignoring option 'alpha'=0.500000000000000
...
Is there a workaround for this?
mforetsMon, 29 May 2017 08:20:26 -0500http://ask.sagemath.org/question/37728/Does there exist a GUI web-app that allows for edge contractions and vertex splits?http://ask.sagemath.org/question/35825/does-there-exist-a-gui-web-app-that-allows-for-edge-contractions-and-vertex-splits/I am interested in creating a web-app that allows for graph creation, edge contraction, vertex splits, and then exports to sage.
If anyone knows of something like this already developed please let me know, otherwise any suggestions on how to begin?
ThanksfieldofnodesWed, 30 Nov 2016 11:29:51 -0600http://ask.sagemath.org/question/35825/Drawing Auslander-Reiten quivers with sage possible?http://ask.sagemath.org/question/35638/drawing-auslander-reiten-quivers-with-sage-possible/Hi,
I'd like to draw an Auslander-Reiten quiver with sage. I tried to do this by viewing the Auslander-Reiten quiver as a digraph, but, unfortunately, I was not able to find out how to let sage draw both dashed and solid arrows in one digraph.
Is this possible? If not, is there another way to let sage draw Auslander-Reiten quivers?
Any help would be appreciated.
Edit:
I used the following code:
sage: H=DiGraph()
sage: H.add_edges([(2,1),(2,4),(10,4),(1,3),(4,3),(4,11),(11,6),(3,6),(3,5),(5,7),(6,7),(6,12)])
sage: H.add_edges([(7,8),(7,9),(12,9)])
After having typed
sage: H.show()
a few times I got the following output:
![pic1](/upfiles/1479480509763302.png)
Now, I'd like to draw dahed arrows indicating the Auslander-Reiten translates (e.g. a dashed arrow from 3 to 2).BernFri, 18 Nov 2016 07:49:43 -0600http://ask.sagemath.org/question/35638/Is it possible to embed a plot (or png) within another plot?http://ask.sagemath.org/question/34998/is-it-possible-to-embed-a-plot-or-png-within-another-plot/I have looked at the documentation for 2d plots without any success. I would like to know if it is possible to embed a plot within a plot.
I currently have a set of polygons and I would like to have plots of graphs embedded into each region. Something resembling the attached [image](/upfiles/14752402076305906.png).
Is it possible to achieve this using sagemath's plotting interface?
Thanks!fidbcFri, 30 Sep 2016 07:58:10 -0500http://ask.sagemath.org/question/34998/How to see graph directly after plot() via virtualbox?http://ask.sagemath.org/question/33845/how-to-see-graph-directly-after-plot-via-virtualbox/My laptop is windows7, so I use virtualbox as instructed on the Wiki. However, when I try the plot(), the sage always tell me that "launched png viewer for Graphics object consisting of XX primitives", and so far the only way I can see the image is to save the .png graph somewhere, which is inconvenient. I've seen on Mac that the graph directly popped out after plotting, so is there anyway to let virtualbox to do so?yshuidieSat, 18 Jun 2016 03:07:47 -0500http://ask.sagemath.org/question/33845/Graphics array formattinghttp://ask.sagemath.org/question/33562/graphics-array-formatting/ I'm computing a number of plots (actually collections of 2d polygons) of roughly square aspect ratio, and would like to display them in a reasonable way:
* use two columns
* preserve order
* title each of them
* adjust the size to fill the width of my notebook, disregarding the height
First I displayed each graphics as it arrived, or combined bunches of them into `graphics_array` in order to show them. But my sage notebook (the classical one, not the IPython flavor) failed to preserve order in that case. So I feel that I have to build one big `graphics_array`.
But I've got trouble adjusting its width without specifying its height, and I don't know a suitable height up front. Most of the times if I specify one of the sizes too large, I end up with lots of empty space in one of the directions.
Furthermore, I didn't manage to title the individual graphics, since a `title` attribute to the `polygon2d` call remains without effect, while a `title` attribute to the `show` affects the whole plot and all the nested plots. Constructing an empty `Graphics(title="foo")` doesn't seem to work.
This is on sage 6.10.beta4, so things might have improved since then. If so, I haven't yet found the appropriate locations in the online documentation indicating how this changed.
If you want to try this out: I wanted to format the output of [this code](https://gist.github.com/gagern/e9606b3f12d53ff92c4541e1e7b51d6d) but using two columns and a varying number of rows for each *n*.MvGThu, 26 May 2016 18:41:11 -0500http://ask.sagemath.org/question/33562/Drawing all paths from (0, 0) to (n, n) moving one unit right or uphttp://ask.sagemath.org/question/33201/drawing-all-paths-from-0-0-to-n-n-moving-one-unit-right-or-up/This question is just the same as [this one](http://mathematica.stackexchange.com/questions/112395/how-to-draw-all-paths-from-1-1-to-n-n-by-move-1-0-or-0-1) made for Mathematica. I saw it and I was trying to reproduce it in Sage just for fun, but it's getting longer than I like and I would love to know your approach in Sage. I think it's a great way to learn. This is half of my try:
n=3
A=sum(line([(j, i), (n, i)]) for j in range(n+1) for i in range(n+1))
B=sum(line([(i, j), (i, n)]) for j in range(n+1) for i in range(n+1))
G = Graphics()
G += A + B
G.show(figsize=[4,4], axes=False)
result = []
combinations = [bin(i)[2:] for i in range(1, int('111111', 2))]
for num in combinations:
valid = ''.join(['0']*(6-len(num))) + num
zeros = valid.count('0')
ones = valid.count('1')
if zeros == 3 and ones == 3:
result.append(str(valid))
#At this point all the paths are stored in the variable 'results' in binary form.
#For example '010101' means right, left, right, left, right, left
paths = [[]]
for element in result:
path = []
for index, direction in enumerate(list(element)):
if direction == '0':
path.append((index, index - 1))
else:
path.append((index - 1, index))
paths.append(path)
At this point the list of list called paths is not well constructed. I realized I would have to put some `if` statements to make it work but I'm losing motivation in my solution because it's getting ugly and I don't think is very efficient.
How would you do it?
TARSFri, 22 Apr 2016 22:08:30 -0500http://ask.sagemath.org/question/33201/Insert image into Graphics objecthttp://ask.sagemath.org/question/32417/insert-image-into-graphics-object/ Is it possible to insert an image (let's say, a PNG file) into a Graphics object containing some plots?
I need to create a raster inset into a figure with the list_plot'ted curves.v_2eTue, 02 Feb 2016 06:37:32 -0600http://ask.sagemath.org/question/32417/How to make pygraphviz and sage compatible?http://ask.sagemath.org/question/31070/how-to-make-pygraphviz-and-sage-compatible/ Hi,
I would like sage to help me when I am working with (un)directed graphs and quivers, and so on. After having played around with various possibilities, I would like to convert some stuff into a string and then let sage print something like a .ps - file that contains an image from dot (or something similar to this).
> Unfortunately, I came across the following issue(s) and have no idea what to do now. With the sage version I installed, there is python 2.x as a delivered package. But it seems that sage complains about python3, what doesn't make sense to me.
Could you help me understand and solve the following:
boehmler@boehmler-X55A:~/Schreibtisch/bb/sage-6.9-x86_64-Linux$ ./sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.9, Release Date: 2015-10-10 │
│ Type "notebook()" for the browser-based notebook interface. │
│ Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: import networkx as nx
sage: import matplotlib.pyplot as plt
sage: import matplotlib.image as mpimg
sage: from cStringIO import StringIO
sage: g = nx.dodecahedral_graph()
sage: d = nx.to_pydot(g)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-6-0d33c400a5cf> in <module>()
----> 1 d = nx.to_pydot(g)
AttributeError: 'module' object has no attribute 'to_pydot'
sage: d = nx.to_agraph(g)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-7-d9254026fb59> in <module>()
----> 1 d = nx.to_agraph(g)
/home/boehmler/Schreibtisch/bb/sage-6.9-x86_64-Linux/local/lib/python/networkx/drawing/nx_agraph.pyc in
to_agraph(N)
132 raise ImportError('requires pygraphviz ',
133 'http://networkx.lanl.gov/pygraphviz ',
--> 134 '(not available for Python3)')
135 directed=N.is_directed()
136 strict=N.number_of_selfloops()==0 and not N.is_multigraph()
ImportError: ('requires pygraphviz ', 'http://networkx.lanl.gov/pygraphviz ', '(not available for Python3)')
sage:
Exiting Sage (CPU time 0m3.33s, Wall time 56m28.80s).
After typing
boehmler@boehmler-X55A:~/Schreibtisch/bb/sage-6.9-x86_64-Linux$ sudo -H pip install pygraphviz
I get the message
Wall -Wstrict-prototypes -fPIC -I/usr/include/graphviz -I/usr/include/python2.7 -c pygraphviz/graphviz_wrap.c -o build/temp.linux-x86_64-2.7/pygraphviz/graphviz_wrap.o
pygraphviz/graphviz_wrap.c:130:21: fatal error: Python.h: Datei oder Verzeichnis nicht gefunden
# include <Python.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-6yZh3l/pygraphviz/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-a6o8Fg-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-6yZh3l/pygraphviz
in the end. I would be grateful for any hints how to solve / fix this.
Thanks for the help!
BernWed, 25 Nov 2015 20:42:50 -0600http://ask.sagemath.org/question/31070/How to draw special trees from a list consisting of tuples with Sage?http://ask.sagemath.org/question/30673/how-to-draw-special-trees-from-a-list-consisting-of-tuples-with-sage/ I have the following problem:
Imagine, we have tuples (1,1), (1,2), ... , (1,n), (2,1), (2,2), (2,n), (3,1), ... , (k,n) in a list `L`.
To every tuple `(i,j)` I have associated a list <code>L<sub>{ij}</sub>=[...]</code>. The entries of <code>L<sub>{ij}</sub></code> are special other tuples from `L`, which we call "compatible with the tuple `(i,j)`". So, in general, all the lists <code>L<sub>{ij}</sub></code> are different from one another.
I would like the PC to draw trees in the following manner:
In the first level, there is one tuple T. This was manually chosen from the list `L`.
In the second level, there are all the tuples <code>T<sub>1</sub>, ... , T<sub>r</sub></code>, which are compatible with T. Each of them shall be connected with `T` by a single line.
In the third level, for each tuple <code>T<sub>s</sub></code> of the second line, there are drawn all the tuples that are compatible with <code>T<sub>s</sub></code> **and** at the same time already appeared one level higher (here: in level 2). Call the tuples of this level <code>T<sub>1<sub>1</sub></sub>, ... , T<sub>1<sub>m</sub></sub>, T<sub>2<sub>1</sub></sub>, ... T<sub>2<sub>p</sub></sub>, ...</code>. Each of the <code>T<sub>1<sub>1</sub></sub>, ... , T<sub>1<sub>m</sub></sub></code> shall be connected with <code>T<sub>1</sub></code> by a single line. Each of the <code>T<sub>2<sub>1</sub></sub>, ... , T<sub>2<sub>p</sub></sub></code> shall be connected with <code>T<sub>2</sub></code> by a single line, and so on.
Iterate this, until the process stops (is finished) and you have drawn a tree.
The arrows of the tree are just edges and the points are the tuples, that should be numbered by `(1,1), ... , (k,n)`. Note that not every entry of `L` has to appear in the resulting tree, since the lists <code>L<sub>{ij}</sub></code> need not be a partition of `L`.
Here is a small example:
Let L=[(1,1), (1,2), (1,3), (2,1), (2,2), (2,3)].
Let L_{11}=[(2,2), (2,3), (2,1)].
Let L_{12}=[(1,3), (2,1)].
Let L_{13}=[(1,2)].
Let L_{21}=[(1,1), (1,2),(2,2)].
Let L_{22}=[(1,1), (2,1)].
Let L_{23}=[(1,1)].
This gives the following tree for `(1,1)`:
(1,1)
--------------|--------------
| | |
(2,1) (2,2) (2,3)
| |
| |
(2,2) (2,1)
Not only the tree, but also its "longest" branches (i.e. these, that can no more be extended by the procedure above...in the above example, these are `(1,1)-(2,1)-(2,2)` and `(1,1)-(2,2)-(2,1)` and `(1,1)-(2,3)`) should be returned (there are no repetitions allowed in the branches).
Now, my question is:
> What's the best possibility to solve problems of this kind in a fast way with Sage?
Thanks for the help!BernThu, 12 Nov 2015 10:31:27 -0600http://ask.sagemath.org/question/30673/Typeset latex in SMChttp://ask.sagemath.org/question/30345/typeset-latex-in-smc/In the classical Sage notebook there is the "view" command that
can be used to e.g. get a plot of a graph rendered by pdflatex.
Is there an equivalent in SMC?
For example I want the following code to give me a graph plot rendered by pdflatex.
G=graphs.BullGraph()
G.set_latex_options(format='dot2tex', prog='dot')
view(G)
I can get the corresponding latex code in SMC by
latex(G)
but I have no idea how to render it.Jeremias EpperleinThu, 29 Oct 2015 11:28:20 -0500http://ask.sagemath.org/question/30345/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/Showing a Graphic3d objecthttp://ask.sagemath.org/question/27289/showing-a-graphic3d-object/I have some code which is supposed to spit out a 3d picture. However, my output is "Graphics3d Object" which is not exactly what I want.
# list of points
pts = [(0, 0, 0), (1, 0, 0), (1, 1, 0), (1, 1, 1), (2, 1, 1), (2, 2, 1), (2, 2, 2), (3, 2, 2), (3, 3, 2), (3, 3, 3), (4, 3, 3),(4, 4, 3), (4, 4, 4), (5, 4, 4), (5, 5, 4), (5, 5, 5), (6, 5, 5), (6, 6, 5), (6, 6, 6), (7, 6, 6), (7, 7, 6)]
# some red segments
red_segments = [[pts[i],pts[i+1]] for i in range(len(pts)-1) if i%3==0]
# some green segments
green_segments = [[pts[i],pts[i+1]] for i in range(len(pts)-1) if i%3==1]
# some blue segments
blue_segments = [[pts[i],pts[i+1]] for i in range(len(pts)-1) if i%3==2]
# empty graphics object
P=Graphics()
for rs in red_segments:
P += line3d(rs,color='red')
for gs in green_segments:
P += line3d(gs,color='green')
for bs in blue_segments:
P += line3d(bs,color='blue')
P+=point3d(pts,color='black')
P.show()
I am using the Sage math cloud environment if that at all matters. Does anyone have ideas on how to output the actual 3d graphic that I want instead of the actual object? I'm quite new to using Sage so I apologize if this is a naive question.NomlyWed, 08 Jul 2015 22:28:49 -0500http://ask.sagemath.org/question/27289/In-line graphics for Sage in ipython notebook?http://ask.sagemath.org/question/10988/in-line-graphics-for-sage-in-ipython-notebook/I am running Sage on a local machine (OS X Mavericks) from an ipython notebook. Everything works fine except that I don't have pretty printing or in-line graphics (2D or 3D) -- the graphics launch in Preview.app. Is it possible to obtain either of these features in the ipython notebook interface? sswatsonTue, 04 Feb 2014 03:20:55 -0600http://ask.sagemath.org/question/10988/Naming of Plot Commands in Sagehttp://ask.sagemath.org/question/26814/naming-of-plot-commands-in-sage/I've started teaching myself sage and I'm a bit confused about the naming of some commands in graphics. The most basic command for graphics is perhaps plot with its variants polar_plot, contour_plot, etc. However, I've also seen some variants of plot that are obtained from plot by adding postfixes to it; for instance, plot_vector_field.
Does anyone know the reason why some graphical commands belong to the first category (prefix_plot) and some to the second (plot_postfix)? I'm asking this because of there is a good reason for this, then it can help me remember the names more easily, and if there is no special reason this might be something to suggest for changes in future releases of sage.
PS I asked this question on [stackoverflow](http://stackoverflow.com/questions/30197714/naming-of-plot-commands-in-sage?noredirect=1#comment48502160_30197714) and got a suggestion for asking it here.
EPSTue, 12 May 2015 14:28:03 -0500http://ask.sagemath.org/question/26814/