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.Sat, 25 Apr 2020 13:53:08 +0200How to correctly plot x^(1/3)https://ask.sagemath.org/question/51005/how-to-correctly-plot-x13/sage: plot(x**(1/3))
This command produces a graph that looks like this:
![image](https://i.imgur.com/cfzNJQH.png)
I was expecting a graph like this:
![image](https://i.imgur.com/7AhRgTD.png)ggSat, 25 Apr 2020 13:53:08 +0200https://ask.sagemath.org/question/51005/Crossings in knot diagramhttps://ask.sagemath.org/question/47250/crossings-in-knot-diagram/ Hi! Given a plot of a knot, I was wondering if it is possible to obtain the position (within the plot) of its crossings, in order to then add some decorations to the diagram. danieleCWed, 24 Jul 2019 11:30:33 +0200https://ask.sagemath.org/question/47250/draw a tree diagramhttps://ask.sagemath.org/question/42510/draw-a-tree-diagram/Good afternoon,
I have defined a recursive function and I would like to vizualise the 'calls' of the function trought a tree diagram. The nodes should be the elements of a group (Extended affine weyl group). So expressions of this type s0*s1*s2*s4*s5*s6*s0*s0*s7 (not hashable). Is there a easy way to do that ? Maybe using just matplotlib? So without instal graphviz. I need something simple like latex \tree. I have just tried something like this
G = graphs.RandomGNM(4,5)
G.relabel({0:'zero' , 1:'one', 2:'two', 3:'three'})
G.show(figsize=[4,4], graph_border=True)
But the labels on the vertices are not readable. Really, I need something like a diagram not a graph.
SaraTue, 05 Jun 2018 18:21:00 +0200https://ask.sagemath.org/question/42510/How to draw special trees from a list consisting of tuples with Sage?https://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 17:31:27 +0100https://ask.sagemath.org/question/30673/edge labels and vertex size causes problemshttps://ask.sagemath.org/question/10776/edge-labels-and-vertex-size-causes-problems/Hi,
I have several problems creating a graph. I want to misuse the graph tools in sagemath to create a flow diagram, but I encountered two problems:
First, the vertex_size option does not work at all in my code and
second, relating to the question
[here](http://ask.sagemath.org/question/1700/getting-edge-labels-in-a-digraph-to-display), is there now a possibility to shift the edge labels?
I work with sage 5.9 in a virtual box environment
from sage.graphs.graph_plot import GraphPlot
h = DiGraph({0:[1,2], 1:[3], 2:[4]})
for u,v,l in h.edges():
h.set_edge_label(u,v,'(' + str(u) + ',' + str(v) + ')')
h1=h.graphplot(save_pos=True, edge_labels=True, talk=True)
h1.show()
print h.get_pos()
h.set_pos({0:[0,0],1:[1,1],2:[1,-1],3:[2,1],4:[3,-1]})
h1=h.graphplot(save_pos=True, edge_labels=True, talk=True, vertex_size=0)
h1.set_vertices(vertex_shape='s')
h1.show()
Thanks in advance.god.oneTue, 26 Nov 2013 04:33:26 +0100https://ask.sagemath.org/question/10776/Is it better practice to show SAGE code on a web use of SAGE?https://ask.sagemath.org/question/10305/is-it-better-practice-to-show-sage-code-on-a-web-use-of-sage/If you go to my page for The Sensible Calculus Book http://users.humboldt.edu/flashman/senscalca_x.html you will find how I've added SAGE to this page- with interacts for graphs, direction fields and Euler's Method for DE's as well as one of the mapping diagram interacts I am developing from the assistance of Jeff Denny, Jason Grout, and others at Sage Edu Days 5 . I would like feedback on this if you have suggestions- I have currently hidden the code from the users using the interact buttons. Is it better practice to show the Sage code?Martin FlashmanMon, 01 Jul 2013 13:27:00 +0200https://ask.sagemath.org/question/10305/Is there some way to have Geogebra and SAGE interact?https://ask.sagemath.org/question/10306/is-there-some-way-to-have-geogebra-and-sage-interact/ On my page for [The Sensible Calculus Book](http://users.humboldt.edu/flashman/senscalca_x.html) you will find how I've added SAGE to this page- with interacts for graphs and one of the mapping diagram interacts I am developing from the assistance of Jeff Denny, Jason Grout, and others at Sage 5 Edu.
ALSO- I have a new demo using Geogebra on the same page to do similar things with graphs and mapping diagrams dynamically. Is there some way to have Geogebra and SAGE interact? Martin FlashmanMon, 01 Jul 2013 13:32:41 +0200https://ask.sagemath.org/question/10306/