Ask Your Question

yasar11732's profile - activity

2020-03-11 15:44:41 +0100 asked a question Inconsistency in function return value
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.0, Release Date: 2020-01-01                     │
│ Using Python 3.7.3. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
sage: p = lambda x: (x - 1) / 2
sage: p(11)
5
sage: is_prime(5)
True
sage: is_prime(p(11))
False
sage:

In above example, is_prime function returns true when called like is_prime(5). However, when I give it p(11), which returns 5, as an argument, function returns false.

What is the reason for this behaviour, and how can I fix it?

2020-02-17 20:35:35 +0100 received badge  Popular Question (source)
2020-02-17 20:35:35 +0100 received badge  Notable Question (source)
2020-02-17 20:35:35 +0100 received badge  Famous Question (source)
2018-08-22 19:38:48 +0100 asked a question Scatter Plot is not visible using notebook

I am using following commands to create a scatter plot in SageMath notebook;

from sage.plot.scatter_plot import ScatterPlot
x = ScatterPlot(range(2, 100000), [len(divisors(x)) for x in range(2, 100000)], {'facecolor':'white', 'marker':'s'})
show(x)

However, only thing I am getting is this output;

𝚂𝚌𝚊𝚝𝚝𝚎𝚛 𝚙𝚕𝚘𝚝 𝚐𝚛𝚊𝚙𝚑𝚒𝚌𝚜 𝚙𝚛𝚒𝚖𝚒𝚝𝚒𝚟𝚎 𝚘𝚗 𝟿𝟿𝟿𝟿𝟾 𝚍𝚊𝚝𝚊 𝚙𝚘𝚒𝚗𝚝𝚜.

How can I show a scatter plot using SageMath?

2018-07-29 23:21:45 +0100 commented answer TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'sage.symbolic.expression.Expression'

It appears that I had :)

2018-07-29 23:21:16 +0100 received badge  Scholar (source)
2018-07-29 16:50:44 +0100 received badge  Student (source)
2018-07-29 16:46:33 +0100 asked a question TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'sage.symbolic.expression.Expression'

When I enter following command in Sage Notebook;

var('x k w')
f = x^3 * e^(k*x) * sin(w*x)
show(f)
show(f.diff(x))

I get this error

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-12-e1add3252393> in <module>()
      1 var('x k w')
----> 2 f = x**Integer(3) * e**(k*x) * sin(w*x)
      3 show(f)
      4 show(f.diff(x))

TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'sage.symbolic.expression.Expression'

How can I resolve this issue.