Ask Your Question

Christopher Davis's profile - activity

2023-05-21 10:18:21 +0100 received badge  Famous Question (source)
2020-02-23 16:28:27 +0100 received badge  Notable Question (source)
2019-05-15 14:40:37 +0100 received badge  Famous Question (source)
2019-05-15 14:40:37 +0100 received badge  Notable Question (source)
2018-06-27 18:28:58 +0100 received badge  Popular Question (source)
2018-06-03 10:50:22 +0100 received badge  Popular Question (source)
2017-09-28 21:35:37 +0100 commented answer Displaying images with matplotlib

Thanks very much for your help! Jeroen's example worked in my sagews

2017-09-28 21:35:01 +0100 commented answer Displaying images with matplotlib

Thanks Jeroen!

2017-09-28 21:34:36 +0100 received badge  Scholar (source)
2017-09-28 21:33:03 +0100 received badge  Supporter (source)
2017-09-27 07:34:45 +0100 received badge  Nice Question (source)
2017-09-27 01:32:58 +0100 asked a question Displaying images with matplotlib

Hi! I'm unable to get some of my old code (written in the Sage notebook around 2011) to work on CoCalc. I found very similar code on the SageMath interact/graphics wiki page at

https://wiki.sagemath.org/interact/graphics#Interact_with_matplotlib

That code also doesn't work for me in CoCalc: no image gets displayed, just the two slider bars. Is there a simple change that needs to be made?

In general, should I expect Sage code to work in a CoCalc Sage worksheet? I admit that I don't know to what extent the two are compatible. Thanks for any advice!

Here is the code from that SageMath Wiki:

# Simple example demonstrating how to interact with matplotlib directly.
# Comment plt.clf() to get the plots overlay in each update.
# Gokhan Sever & Harald Schilly (2010-01-24)

from scipy import stats
import numpy as np
import matplotlib.pyplot as plt

@interact
def plot_norm(loc=(0,(0,10)), scale=(1,(1,10))):
    rv = stats.norm(loc, scale)
    x = np.linspace(-10,10,1000)
    plt.plot(x,rv.pdf(x))
    plt.grid(True)
    plt.savefig('plt.png')
    plt.clf()
2017-09-03 20:51:06 +0100 received badge  Good Question (source)
2017-08-30 13:42:18 +0100 received badge  Nice Question (source)
2017-08-29 11:27:44 +0100 received badge  Student (source)
2017-08-28 20:57:22 +0100 asked a question Seeking advice for classroom installation

I'm teaching a cryptology class in the fall. We are meeting in a computer lab with Windows computers, and ideally I would like students to be able to use the Notebook interface in Sage. Does anyone have any advice or suggestions for how I should set this up? (Currently Sage is not installed.) In the past (around 2012), I believe we had a special server set up, and then students connected to that by typing in a special address in their web browsers.

I'm not considering using CoCalc (because even though we could maybe get funding for a few quarters, I don't think that would be sustainable longterm).

I will pass on any advice from you to my university's IT department.

Thanks very much!