Ask Your Question

holistone's profile - activity

2021-08-24 18:54:11 +0200 edited question raw cell format with Print or convert to html

raw cell format with Print or convert to html Is there a way to get the html version of a RAW cell to show the same as t

2021-08-24 04:08:15 +0200 asked a question raw cell format with Print or convert to html

raw cell format with Print or convert to html Is there a way to get the html version of a RAW cell to show the same as t

2021-08-01 06:48:25 +0200 received badge  Notable Question (source)
2021-04-09 14:59:22 +0200 received badge  Nice Answer (source)
2021-03-21 00:20:43 +0200 received badge  Self-Learner (source)
2021-03-21 00:20:43 +0200 received badge  Teacher (source)
2020-11-30 11:34:22 +0200 received badge  Good Question (source)
2020-11-30 10:46:42 +0200 received badge  Nice Question (source)
2020-11-29 19:56:09 +0200 asked a question How to eliminate truncated graph arrowheads?

The following simple directed graph has truncated arrowheads:

vpos = {'W':(-0.5,0.5),'E':(0.5,0.5),'mW':(-0.5,0),'mE':(0.5,0)}
D1 = DiGraph()
D1.add_edge(('mW','mE','mE-mW'))
D1.add_edge(('W','E','W-E'))
D1.add_edge(('mW','W'))
D1.show(pos=vpos,vertex_size=500,figsize=(2,2))

image description

If I change the last statement to:

D1.show(pos=vpos)

I still get truncated horizontal arrows, but less on the vertical. image description

Any suggestions for preserving full arrowheads? It looks like the clip limits for arrows are different than those for vertices. Setting fig_tight=False has no effect.

2020-11-19 18:13:47 +0200 received badge  Nice Question (source)
2020-11-19 17:13:55 +0200 commented answer Eliminate truncated graph display with large vertices

That works. The fig_tight argument was not in any of the Graph Plotting Options listed in the documentation. Can that be change? or a link added to other options?

I suspect the "tight" bounding box is computed based only on vertex centers, when it should include the vertex size. Even some of the vertices in the set_pos example figure in the documentation are top and bottom truncated. Can the bounding box calculation be updated?

Finally, what are the units for vertex_size (default 200) relative to vertex locations (typically in the range -1.0 - 1.0)?

2020-11-19 06:04:49 +0200 asked a question Eliminate truncated graph display with large vertices

When I increase the vertex size (to allow more room for labels) on Graph plots, the boundary vertices are trimmed. Here's an example:

Kms = [(3, 4, 2), (3, 7, 5)]
T = Graph()
T.add_edges(Kms)
T.show(layout='tree',tree_root=3,tree_orientation='down',figsize=(2,1.5))
T.show(layout='tree',tree_root=3,tree_orientation='down',figsize=(2,1.5),vertex_size=800)

image description

Changing figsize does not solve the problem. How do increase the trim limits so that everything drawn is shown?

2020-11-19 01:32:52 +0200 answered a question How can I add arbitrary text to a Graph object

Thanks to rburing (above) here's a successful example of adding multiple text objects in different colors to a graph: image description

2020-11-18 23:19:02 +0200 received badge  Commentator
2020-11-18 23:19:02 +0200 commented answer How can I add arbitrary text to a Graph object

This works with G.plot() instead of G.show(), and answers my question. Thanks.

2020-11-18 23:15:44 +0200 commented question How can I add arbitrary text to a Graph object

The mode would still show as a node with the same format that the other nodes.

2020-11-18 21:38:30 +0200 commented question How can I add arbitrary text to a Graph object

Thanks, that's a good pointer. The "title" and title_pos" options allows me to add a single text label. But what if I would like multiple text options? Although .show() recognizes "show legend", Graph does not accept "legend_label". I would expect that there is a general way of adding multiple text to a Graph such as D += text("hello world",(1,1))

2020-11-18 20:11:31 +0200 asked a question How can I add arbitrary text to a Graph object

I have created a Graph image such as shown below

image description

using the commands:

D = Graph(E)
D.show(pos=posd,**GPopt)

I would like to add text or a legend (explaining the colors) to the graph, but I have not found a way to add additional text to the Graph object. Suggestions welcome.

2020-10-14 03:09:36 +0200 received badge  Popular Question (source)
2020-02-05 21:51:58 +0200 commented answer Sagemath 9.0 Markdown inconsistency Cocalc vs. Local

If Sagemath provides the Jupyter notebook for CoCalc is it possible for them to provide the SAME Jupyter notebook with their binary downloads for windows and other platforms?

2020-02-05 20:16:05 +0200 received badge  Nice Question (source)
2020-02-05 20:14:34 +0200 commented answer Sagemath 9.0 Markdown inconsistency Cocalc vs. Local

If that's the case, how does it work in the Cocalc.com Sagemath 9.0 version?

Also, if a "single-character bug" I would have expected the bold to terminated by the *'s at the start of "Extended" rather that at the *'s at the end.

2020-02-05 18:34:42 +0200 asked a question Sagemath 9.0 Markdown inconsistency Cocalc vs. Local

I have recently installed the latest Sagemath 9.0 on a Windows 10 machine and noticed a Markdown bold formatting problem that is not present on the Cocalc.com Sagemath 9.0 version. Here is the Markdown:

For each of the 10 questions a student can choose 1 of **3** possibilities: (1) answer T, (2) answer F, or (3) omit. By the **Extended Rule of Products**, there are $3^{10}$ ways of accomplishing this, this is far more than $2^{10}$.

On the local 9.0 install it renders as:

image description

Notice that the bold is not terminated by the ** after the '3'. On the other hand, the same code on Cocalc.com renders correctly with Sagemath 9.0:

image description

Both of these use the latest Chrome browser. Is there any way to correct the Markdown rendering on the local install?

If Sagemath provides the Jupyter notebook for CoCalc is it possible for them to provide the SAME Jupyter notebook with their binary downloads for windows and other platforms? Or just update the Jupyter notebook part of the Sagemath 9.0 Windows executable?

2019-11-15 15:15:07 +0200 commented answer incorrect plot of simple defined function, but works with lambda

Interesting. Is there a list of the "classic Sage traps"?

Coming from python, I would have expected some form of error message. Especially since the symbolic evaluation of h(x) as x^2 is not really correct.

If I change the definition to

def h(x):
    return x^2*(x>=0)+x*(x<0)

which returns the same values, I now get an error with

print h(x)

and this is what I would have expected with the original definition of h(x).

2019-11-15 14:57:10 +0200 received badge  Scholar (source)
2019-11-15 03:49:47 +0200 received badge  Organizer (source)
2019-11-14 22:47:07 +0200 asked a question incorrect plot of simple defined function, but works with lambda

I am trying to produce a plot of a simple defined function with a single if statement. The function works correctly as demonstrated by numerical values, but the corresponding plot is incorrect.

If I create the plot using a lambda definition of the function, the plot is correct. The sample code follows:

def h(x):
    if x<0: return x
    return x^2
for k in (-2..2): 
    print "(%d,%d)"% (k,h(k)),
print 'sample h(x) vs. x pairs'
H = plot(h(x),(-1.5,1.5),linestyle='dotted',color='red',thickness=3)
L = plot(lambda x: x if x<0 else x^2,(-1.5,1.5),figsize=3)
H+L

The following image shows the code and output in a Sagemath notebook. As you can see the plot of h(x) does not properly evaluate the function if statement, but the lambda plot does. image description

2019-09-03 05:38:52 +0200 commented answer Button to copy SageMath cell to clipboard

That's an excellent starting point. Just a few minor modifications. Many thanks.

2019-09-03 05:37:53 +0200 received badge  Supporter (source)
2019-09-02 08:34:04 +0200 received badge  Student (source)
2019-09-02 01:34:12 +0200 commented question Button to copy SageMath cell to clipboard

Yes, please post. Any starting point would be help and I am only interested in the text. The assignments will be simple code with simple text output.

2019-09-01 19:23:23 +0200 edited question Button to copy SageMath cell to clipboard

I will be using a link to a simple SageMathCell html page during Canvas quizzes in an online Discrete Math course. I would like to provide an additional "copy" button on the SageCell page that would allow the student to copy both their code and evaluated output into a textbox in a different browser window.

I realize it is now possible to separately cut and past the code and the output into a different textbox, but I would like to keep it as simple as possible. Any suggestions for the additional html that would add the button are appreciated.

To be more specific, I realize I could create an html button using:

<button onclick="myCopySageInOut()">Copy Sage Cell</button>

and I would need JavaScript code for the myCopySageInOut() function that would copy the input box text, append the output text and place in the clipboard. This is when I could use an example of the JavaScript code.

2019-09-01 19:23:23 +0200 received badge  Editor (source)
2019-09-01 16:46:36 +0200 commented answer Button to copy SageMath cell to clipboard

The "Share" button creates a link to another html page which contains the code and the output and yet another "Share" button, and so on.

I want to be able, in a single step, to copy both the code and the output into the clipboard so it can be pasted into a simple text box in another html page.