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.Tue, 02 Mar 2021 05:44:48 +0100Jupyter notebook: plot() fails to produce graphhttps://ask.sagemath.org/question/55991/jupyter-notebook-plot-fails-to-produce-graph/ Just installed Sage on my Windows 10 machine. When I try to run plot(sin, (0.0, 10.0)), or any other plot, I only get the error message: "The kernel appears to have died. It will restart automatically." What can I do?
Thanks for your help.
BobbobmccroryTue, 02 Mar 2021 05:44:48 +0100https://ask.sagemath.org/question/55991/Sage on Mac unable to use plot3d due to Java/jmol issueshttps://ask.sagemath.org/question/39422/sage-on-mac-unable-to-use-plot3d-due-to-javajmol-issues/Hi,
I am a relative newbie to the Mac and Sage on the Mac. I tried to run the following code from the Sage tutorial on my Mac in the console mode of sage:
> sage: x, y = var('x,y')
>
> sage: plot3d(x^2 + y^2, (x,-2,2), (y,-2,2))
The error message I get is
> --------------------------------------------------------------------------- RuntimeError
> Traceback (most recent call last)
> <ipython-input-2-878191366deb> in
> <module>()
> ----> 1 plot3d(x**Integer(2) + y**Integer(2),
> (x,-Integer(2),Integer(2)),
> (y,-Integer(2),Integer(2)))
>
> /Applications/SageMath/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in __call__(self, result)
> 244 self.start_displayhook()
> 245 self.write_output_prompt()
> --> 246 format_dict, md_dict =
> self.compute_format_data(result)
> 247 self.update_user_ns(result)
> 248 self.fill_exec_result(result)
>
> /Applications/SageMath/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in compute_format_data(self, result)
> 148
> 149 """
> --> 150 return self.shell.display_formatter.format(result)
> 151
> 152 # This can be set to True by the write_output_prompt method in a
> subclass
>
> /Applications/SageMath/local/lib/python2.7/site-packages/sage/repl/display/formatter.pyc
> in format(self, obj, include, exclude)
> 158 # First, use Sage rich output if there is any
> 159 PLAIN_TEXT = u'text/plain'
> --> 160 sage_format, sage_metadata =
> self.dm.displayhook(obj)
> 161 assert PLAIN_TEXT in sage_format, 'plain text is always
> present'
> 162 if sage_format.keys() != [PLAIN_TEXT]:
>
> /Applications/SageMath/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.pyc
> in displayhook(self, obj)
> 806 self._backend.set_underscore_variable(obj)
> 807 plain_text, rich_output =
> self._rich_output_formatter(obj,
> dict())
> --> 808 return self._backend.displayhook(plain_text,
> rich_output)
> 809
> 810 def display_immediately(self, obj,
> **rich_repr_kwds):
>
> /Applications/SageMath/local/lib/python2.7/site-packages/sage/repl/rich_output/backend_ipython.pyc
> in displayhook(self, plain_text,
> rich_output)
> 264 return ({u'text/plain': msg}, {})
> 265 elif isinstance(rich_output,
> OutputSceneJmol):
> --> 266 msg = self.launch_jmol(rich_output,
> plain_text.text.get_unicode())
> 267 return ({u'text/plain': msg}, {})
> 268 elif isinstance(rich_output,
> OutputSceneWavefront):
>
> /Applications/SageMath/local/lib/python2.7/site-packages/sage/repl/rich_output/backend_ipython.pyc
> in launch_jmol(self, output_jmol,
> plain_text)
> 367 jdata = JmolData()
> 368 if not jdata.is_jvm_available() and not
> DOCTEST_MODE:
> --> 369 raise RuntimeError('jmol cannot run, no
> suitable java version found')
> 370 launch_script = output_jmol.launch_script_filename()
> 371 from sage.env import SAGE_LOCAL
>
> RuntimeError: jmol cannot run, no
> suitable java version found
I believe I have the latest version of Java installed:
> $ java --version
> java 9.0.1
> Java(TM) SE Runtime Environment (build 9.0.1+11)
> Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
Sage version
> $ sage --version
> SageMath version 8.0, Release Date: 2017-07-21
I would appreciate any inputs and advice about how to fix this issue. Thanks in advance!toricwebTue, 07 Nov 2017 17:29:46 +0100https://ask.sagemath.org/question/39422/How can I add arrows at the end of sage plot axis?https://ask.sagemath.org/question/10178/how-can-i-add-arrows-at-the-end-of-sage-plot-axis/Hello everybody!
I have my plot:
import matplotlib.pyplot as plt
plt.clf()
fig = plt.figure()
plot(f(x), (0, 2*pi)).matplotlib(figure = fig)
plt.savefig('')
plt.close()
I want to add arrows at the end of this graph (as on [this image](http://commons.wikimedia.org/wiki/File:Conic_x%5E2%2B2xy%2By%5E2%E2%88%928x%3D0.svg)). But I can't do this. Help me please.AndreWinFri, 31 May 2013 16:59:16 +0200https://ask.sagemath.org/question/10178/No result in published worksheethttps://ask.sagemath.org/question/9890/no-result-in-published-worksheet/Hey guys..
I just can't find out what's the problem. When I am editing my worksheet everything works for this example from the wiki:
srg = srange(-4,4,1/10,include_endpoint=True)
@interact
def dualv(a1=slider(srg,default=1),a2=slider(srg,default=2), a3=slider(srg,default=-1),a4=slider(srg,default=3)):
A1 = arrow2d([0,0],[a1,a2],rgbcolor='black')
A2 = arrow2d([0,0],[a3,a4],rgbcolor='black')
A3 = arrow2d([0,0],[a1,a3],rgbcolor='black')
A4 = arrow2d([0,0],[a2,a4],rgbcolor='black')
p1 = polygon([[0,0],[a1,a2],[a1+a3,a2+a4],[a3,a4],[0,0]], alpha=.5)
p2 = polygon([[0,0],[a1,a3],[a1+a2,a3+a4],[a2,a4],[0,0]],rgbcolor='red', alpha=.5)
A = matrix([[a1,a2],[a3,a4]])
html('<h3>The determinant of a matrix is equal to the determinant of the transpose</h3>')
html("$det(%s) = det(%s)$"%(latex(A),latex(A.transpose())))
show(A1+A2+A3+A4+p1+p2)
But when I publish this worksheet, the plot is not evaluated/shown/rendered. The control-bars are here but not the graphics. I've checked the HTML-contend.. there is none.
<table border="0" width="100%" bgcolor="white">
<tbody>
<tr>
<td valign="top" bgcolor="white" align="left">
<pre></pre>
</td>
</tr>
<tr>
<td valign="top" align="left"></td>
</tr>
</tbody>
</table>
Does anyone know what's the problem here? And could anyone tell me how I can see a log of what the server got from the client and of what the server did in response?
Thank you for any help.
snoocThu, 07 Mar 2013 12:09:04 +0100https://ask.sagemath.org/question/9890/Server/Client hide code, 3D Animation, etc (bachelor thesis)https://ask.sagemath.org/question/9873/serverclient-hide-code-3d-animation-etc-bachelor-thesis/Right now I am evaluting for my bachelor thesis in computer science wich software would be the best to create graphical plots for learning-algorithms like backpropagation (neural networks) oder k-nearest-neighbor (classification) and so on.
Sage seems to be very powerful and covers A HUGE AMOUNT of my needs..
Still.. I could not find an easy way to hide the sourcecode to a user. I require this since I am going to implement some examples for students which they will have to solve on their own. This is why I cannot provide any sourcecode. (%hideall is NOT enough)
I know how I would do this but is there already an easy way to accomplish that?
The other thing is this..
I'd like to create partly interactive 3D animations, for example gradient descent. A student should be able to adapt the learning rate and it would be great if the 3D plot got an animated line that slowly finds its way to the minimal error.
Thank you for your answers.snoocMon, 04 Mar 2013 10:10:29 +0100https://ask.sagemath.org/question/9873/combine sage plot with matplotlibhttps://ask.sagemath.org/question/8273/combine-sage-plot-with-matplotlib/As some others I'm also searching for a convenient way for merging sage Graphics and figures from matplotlib.
Actually I don't understand why this is so difficult since Sage uses matplotlib internally. Nevertheless there seems to be no way for combining plots from both packages.
The best way would be to wrap a matplotlib plot into a Sage Graphics object.
I really love Sage's plot(...)+plot(...) syntax, but unfortunately there are some important plot types missing (e.g. errorbar plot). Of course one can do all plotting in matlotlib, but it would be more convenient to handle sage objects.
I saw in the sage documentation that one can get a matplotlib figure from a Graphics object, but didn't found a way to draw on it with matplotlib.
Does anyone know any way for combining plots from those packages?buergiSun, 14 Aug 2011 16:39:54 +0200https://ask.sagemath.org/question/8273/2D plotting in sage looks wronghttps://ask.sagemath.org/question/7757/2d-plotting-in-sage-looks-wrong/I am a beginner using sage, and I have encountered a problem using the plot function.
Plotting a simple sine or cosine function is not very precise:
t=var('t')
v=plot(sin(t),-pi,pi
The function is clearly positive in t=-pi, where it should be zero.
The mistake becomes even more clear when setting line thickness to 99:
t=var('t')
v=plot(sin(t),-pi,pi,thickness=99)
In this case when x=0 the line is crossing 1 in the upper side and not -1 in the lower side.
This problem occurs in all functions i have encountered so far, as if the function is displayed 1 or 2 pixels off.
It's even worse when plotting arrows:
plot(arrow((0,0), (2,3)))
Here the arrow is clearly not starting in (0,0) as it should.
Is there a solution for this kind of problem?KabiMon, 08 Nov 2010 17:57:25 +0100https://ask.sagemath.org/question/7757/