Ask Your Question

zplot's profile - activity

2021-07-03 17:55:31 +0200 commented answer Graphic not shown in PyCharm

Thank you very much Lisandra. It worked!

2021-07-03 17:55:25 +0200 marked best answer Graphic not shown in PyCharm

Using sage inside a Python program with PyCharm if I write:

q = sage.all.plot(lambda x: x*x, 1, 10)
q.show()

I get in Python console: "Graphics object consisting of 1 graphics primitive" and the program ends well, but the graphic is not shown. On the other hand if I write:

import matplotlib.pyplot as plt
plt.plot([i*i for i in range(10)])
plt.show()

Graphic is perfectly shown in Plots window inside PyCharm. So matplotlib plots are perfectly shown but sage plots are not.

¿How could I get sage plots using PyCharm?

Thank you.

2021-07-03 17:55:15 +0200 answered a question Graphic not shown in PyCharm

Thank you very much Lisandra. It worked!

2021-07-02 12:24:13 +0200 asked a question Graphic not shown in PyCharm

Graphic not shown in PyCharm Using sage inside a Python program with PyCharm if I write: q = sage.all.plot(lambda x: x*

2021-07-01 00:41:27 +0200 received badge  Nice Question (source)
2021-06-29 09:16:03 +0200 received badge  Student (source)
2021-06-29 08:39:57 +0200 marked best answer cannot convert log(x)/log(2) to int

If I define J(x) function as:

def J(x):
    sum = 0
    print(int(log(x)/log(2)))
    for i in range(1, int(log(x)/log(2)) + 1):
        sum = sum + 1 / i * prime_pi(x**(1/i))
    return(N(sum))

when I try to plot it using:

p = plot(J(x), (x, 1, 20))
show(p)

I get the message:

cannot convert log(x)/log(2) to int

but if try J function acting on any float number I get a perfect value like:

sage: J(123.456789)
34.0333333333333

I have tried to replace int by floor but with the same result. Any help to solve the plotting problem will be welcome. Thank you.

2021-06-29 08:39:57 +0200 received badge  Scholar (source)
2021-06-29 08:39:54 +0200 commented answer cannot convert log(x)/log(2) to int

Thank you very much, Samuel. It worked perfectly.

2021-06-28 23:48:28 +0200 asked a question cannot convert log(x)/log(2) to int

cannot convert log(x)/log(2) to int If I define J(x) function as: def J(x): sum = 0 print(int(log(x)/log(2)))