Ask Your Question

Shai's profile - activity

2022-08-23 21:24:31 +0200 received badge  Notable Question (source)
2021-11-08 21:11:42 +0200 received badge  Popular Question (source)
2021-04-12 11:37:20 +0200 received badge  Famous Question (source)
2020-05-23 14:38:45 +0200 commented answer Plotting surfaces over non-rectangular domain

I can't believe I didn't think of the first one! Thanks - these are both really good answers which I'm certain I'll use.

2020-05-23 14:33:02 +0200 commented answer Plotting surfaces over non-rectangular domain

I'm accepting this one because it would allow me to restrict a whole plot ex post facto which seems really versatile.

2020-05-21 23:56:26 +0200 asked a question Plotting surfaces over non-rectangular domain

I'm wondering if we can plot a surface over non-rectangular domain. E.g.

plot3d(lambda x, y: 2 + sin(x) + cos(y) if y < 2*pi - x else False, (x,x0,x1), (y,y0,y1))

or something. I've tried playing with the domain like

implicit_plot3d( (s,t,2+sin(s)+cos(t)), (s,0,2*pi), (t,0 2*pi - s) )

but again no dice. I'm sure I could just draw a whole bunch of polygons but I wonder if there's a better way.

2019-12-10 01:58:58 +0200 received badge  Notable Question (source)
2019-12-10 01:58:58 +0200 received badge  Popular Question (source)
2019-11-25 13:11:33 +0200 received badge  Notable Question (source)
2018-03-17 18:08:50 +0200 received badge  Popular Question (source)
2017-02-26 21:45:06 +0200 commented question Loaded event for sagecell

I have accomplished this with a plugin for detecting resize events (github) but I'd still be interested if there is a loaded event emited which I could listen to.

2017-02-26 20:36:17 +0200 asked a question Loaded event for sagecell

Hi folks,

I need to call some javascript functions only after a sagecell has been fully loaded on my webpage. I've tried mutation observers and such but nothing is quite right. Does the sagecell emit an event when it has finished doing its thing?

More specifically, I need to resize an outer wrapper-div in the html whenever the sagecell resizes, as it keeps getting cut off. So this would need to work with interacts as well.

2015-09-23 14:44:24 +0200 received badge  Nice Question (source)
2015-09-20 17:24:54 +0200 received badge  Editor (source)
2015-09-20 17:23:40 +0200 commented answer Is there a way to fix my html() lines?

Thanks for the suggestions. My site is built through WordPress which puts everything into and then out of a MySQL database which strips out all of the "\n\r" line breaks in my php files making it impossible to have more than one line of formatted python injected into every cell instance. All I can now do is muddle around with some WordPress regex plugins and see what I can make happen.

2015-09-15 16:24:06 +0200 asked a question Is there a way to fix my html() lines?

Recently, about 8 weeks of my work were gobbled up by the decision to make html() return a string of html rather than to display the html output.

I am using the html() function to produce html output on a teaching website through the SageCell like so:

html('Suppose we wanted to calculate $2+2=4$')

In combination with MathJaX this gives a very favourable output. I don't want to get into why it has to be html, but let's just assume I only want to display with html.

Then there is this http://trac.sagemath.org/ticket/18292

I have hundreds of uses of html() and they are all now showing deprecation warnings. I now need to use pretty_print(html()), apparrently. I won't give my opinion on the sense of this change, I just want to know how to properly fix it.

Is there a nice way to update my work? Is there a nice way of replacing all instances of html() with pretty_print(html())? I cannot do it manually, and search/replace seems to be ruled out by that close bracket.

Please forgive me if this is obvious. I'm an educator hacking my way through webdesign and I have never dealt with a large-scale deprecation like this.

2015-06-06 21:55:15 +0200 received badge  Supporter (source)
2015-06-06 20:35:16 +0200 received badge  Nice Question (source)
2015-06-06 19:21:44 +0200 received badge  Scholar (source)
2015-06-06 19:17:06 +0200 commented answer Student worksheet to embed in website using sage

Thank you for this -- this is certainly a solution I can implement and, in fact, I plan to do so for the next academic year whilst I learn more web design. The LaTeX --> Sage --> Latex --> PDF solution is my ultimate preference simply because I can create every worksheet as a .tex file and use some as hard copies for homework and unit assessments (so absentees can sit a numerically different test without being told the answers from other students!) and then feed others to the VLE so that students can practise to their hearts' content. This ought to bring some unity to my collection of teaching resources and allow me to pass random parameters to polylongdiv, TiKz and other, self-defined macros. [I would upvote both but I have only 11 Karma.]

2015-06-06 19:07:34 +0200 commented answer Student worksheet to embed in website using sage

When I began this site, I chose WordPress hosted through siteground as a way of easily creating an attractive environment for my students with social features and easy admin without too much of a learning curve on my part. I think it should be possible to use sage in conjunction with siteground, based on a few minutes research. All in all, I have managed to get a website running using mostly cut/paste, plugins and my knowledge of LaTeX/Sage/Python. I think that, if I am to get what I want the way I want it, there is no way around learning more about cgi, html and web development as a whole. Thank you for your input! Now I need to stop being lazy and learn how to actually make a website.

2015-06-06 11:06:49 +0200 received badge  Student (source)
2015-06-06 01:09:11 +0200 asked a question Student worksheet to embed in website using sage

As a teacher, I find myself very excited about the below

\documentclass{article}
\usepackage{sagetex}

\begin{document}

\begin{sagesilent}
r1 = randint(1,5)
r2 = randint(1,5)
\end{sagesilent}

\textbf{Problem} What is $\sage{r1}+\sage{r2}$?

\textbf{Answer} The answer is $\sage{r1+r2}$

\end{document}

Now, what I want more than anything is to embed the output onto my website and allow students to hit a 'recompile' button to generate a new random problem. My criteria are flexible: I want the beauty of a typesetted latex document (which probably means embedding a pdf viewer or something) and the ability to call arbitrary latex packages (which rules out MathJax, unless I can somehow call into play Sage's %latex and add_to_preamble commands).

I have tried using a sagecell, but the output from %latex-ing the whole cell doesn't display the graphic, it only displays a string of raw latex. Besides, I really would prefer to write in latex with SageTeX than to write in sage with %latex.

I'm not expecting someone to solve this problem for me, but if anyone has any idea how I could achieve this on another website (with a latex rendering server which supports SageTeX) or something then any advice would be hugely appreciated. Could the sagecloud itself serve its latex/sage/latex routine and send back a pdf or image to display?

I have a good amount of time this summer to learn new things so any kind of solution is welcome!