Ask Your Question

PerAlexandersson's profile - activity

2022-06-05 03:10:09 +0200 received badge  Famous Question (source)
2020-11-07 21:11:00 +0200 received badge  Notable Question (source)
2019-11-08 15:23:25 +0200 received badge  Popular Question (source)
2014-09-12 11:20:06 +0200 commented answer List all available classes and functions

It is a bit messy to parse; it feels like it should be possible to do from within Sage. In Mathematica, it is quite easy to do this.

2014-09-11 21:04:58 +0200 asked a question List all available classes and functions

How can I get a list of all available classes and the corresponding methods in Sage?

The reason I ask is that I would like to create a syntax file for the editor Kate. I have not found one so far, if there is one, this would also solve my issue.

2013-07-06 12:08:31 +0200 commented answer Strange behaviour

Aha! Cool! That makes sense.

2013-07-06 12:08:12 +0200 marked best answer Strange behaviour

You can try

map(lambda x: x%2,[4,3,2,1,1])

then

sum(map(lambda x: x%2,[4,3,2,1,1]))

will return the desired output.

What happens when you use mod(x,2) is that sage returns an element of $\mathbb{Z}_2$, however the % operator returns an Integer.

2013-07-06 12:08:12 +0200 received badge  Scholar (source)
2013-07-06 12:08:09 +0200 received badge  Supporter (source)
2013-07-05 18:38:03 +0200 asked a question Strange behaviour

I am new to Sage, so please help me understand the following: How come

map(lambda x: mod(x,2),[4,3,2,1,1])

returns the perfectly sane answer [0,1,0,1,1]

but trying to compute the sum

sum(map(lambda x: mod(x,2),[4,3,2,1,1]))

gives the value 1, and not 3. Somehow, it seems that sage thinks that I wish to apply the inner lambda again on the result of the sum.