Ask Your Question

ssss's profile - activity

2021-11-13 16:54:58 +0200 received badge  Popular Question (source)
2020-01-07 22:10:12 +0200 received badge  Editor (source)
2020-01-07 22:07:27 +0200 asked a question plot behavior is odd

I am plotting the function f(x)= (x-x^2)^(2/3). The result is shown only in the interval (0,1). Although, we can compute the result for all real numbers by hand!

f(x)=2+(x-x^2)^(2/3)

    plot(f, x,-1,4, color= 'blue')
        ︡verbose 0 (3698: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 159 points.
        verbose 0 (3698: plot.py, generate_plot_points) Last error message: 'negative number cannot be raised to a fractional power'

My questions are: Why this is happening?! and How can I plot its correct plot?

Thank you in advance!

2020-01-07 21:58:24 +0200 received badge  Scholar (source)
2020-01-07 21:58:20 +0200 commented answer inset() and multi_graphics() are not defined

@eric_g Thanks

2020-01-07 19:35:10 +0200 commented answer inset() and multi_graphics() are not defined

Yes, you are right. Thanks. Can you guide me how I can change sage worksheet kernel (.sagews)? Since the way you mentioned is for Jupyter (.ipynb)

2020-01-07 16:16:37 +0200 asked a question inset() and multi_graphics() are not defined

Hi I am trying to plot two graphics beside each other, in a way that one of them which is smaller is on the upper left side of the other. I tried to run examples of both inset and multi_graphics on sagemath website. But I receive the error of "AttributeError: 'GraphicsArray' object has no attribute 'inset'" for inset, and the error of "NameError: name 'multi_graphics' is not defined" for multi_graphics.

I put my codes below:

Inset:

import matplotlib
G = graphics_array([plot(sin, (0, 2*pi)),plot(cos, (0, 2*pi))])
c = circle((0,0), 1, color='red', thickness=2, frame=True)
G.inset(c)

The error:

Error in lines 6-6
Traceback (most recent call last):
  File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1191, in execute
    flags=compile_flags), namespace, locals)
  File "", line 1, in <module>
AttributeError: 'GraphicsArray' object has no attribute 'inset'

multi_graphics:

g1 = plot(sin(x), (x, -10, 10), frame=True)
g2 = EllipticCurve([0,0,1,-1,0]).plot(color='red', thickness=2,axes_labels=['$x$', '$y$']) + text(r"$y^2 + y = x^3 - x$", (1.2, 2), color='red')
g3 = matrix_plot(matrix([[1,3,5,1], [2,4,5,6], [1,3,5,7]]))
G = multi_graphics([(g1, (0.125, 0.65, 0.775, 0.3)),(g2, (0.125, 0.11, 0.4, 0.4)),(g3, (0.55, 0.18, 0.4, 0.3))])
G

The error:

Error in lines 4-4
Traceback (most recent call last):
  File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1191, in execute
    flags=compile_flags), namespace, locals)
  File "", line 1, in <module>
NameError: name 'multi_graphics' is not defined

I'm working on CoCalc (SageMathCloud) on its unpaid trial server.