Ask Your Question

david8381's profile - activity

2022-11-09 21:48:26 +0200 received badge  Notable Question (source)
2020-01-02 12:42:36 +0200 received badge  Popular Question (source)
2017-08-11 18:51:11 +0200 received badge  Famous Question (source)
2017-04-11 04:45:57 +0200 received badge  Famous Question (source)
2016-10-20 07:35:01 +0200 received badge  Taxonomist
2016-08-16 13:17:55 +0200 received badge  Notable Question (source)
2016-08-16 13:16:17 +0200 received badge  Popular Question (source)
2016-04-14 01:28:11 +0200 received badge  Popular Question (source)
2016-04-14 01:28:11 +0200 received badge  Notable Question (source)
2014-08-19 00:12:18 +0200 received badge  Student (source)
2014-08-18 23:37:57 +0200 received badge  Famous Question (source)
2014-08-18 23:30:40 +0200 received badge  Popular Question (source)
2014-08-18 23:30:40 +0200 received badge  Notable Question (source)
2014-08-18 23:30:40 +0200 received badge  Famous Question (source)
2014-08-18 23:30:28 +0200 asked a question Bitwise NOT Operator for Sage?

0b1000 & 0b1001 (AND) 0b1000 | 0b1001 (OR) 0b1000 ^^ 0b1001 (XOR)

All of these work as bitwise operators on the command line -- but how do I do bitwise NOT?

2014-06-26 03:04:31 +0200 received badge  Notable Question (source)
2014-06-22 13:41:38 +0200 received badge  Popular Question (source)
2013-11-29 16:56:18 +0200 asked a question Moving the decimal point

I would like to have my answer expressed not in scientific notation... how would I do this? For example, instead of reporting 2.12345e5, I just want 212345

Thanks!

2013-10-02 17:11:16 +0200 marked best answer How do I assign solutions of an equation to a variable?

You can use the method .rhs() or .right_hand_side() as follows:

sage: a = solve(1-z-z^2==0,z)[0].rhs()
sage: a
-1/2*sqrt(5) - 1/2
2013-10-02 15:10:03 +0200 asked a question How do I assign solutions of an equation to a variable?

a = solve(1-z-z^2==0,z)[0] has the result of a being 'z=-1/2*sqrt(5)-1/2'

But I would like to have just a = '-1/2*sqrt(5)-1/2'

How do I convert the expression to a number?

Thanks!

2013-09-04 13:55:44 +0200 asked a question 3dplot of modulus of complex function

Even though abs(x+I*y) should always be real... I get the following error:

plot3d(abs(x+I*y),(x,-5,5),(y,-5,5)) ERROR: unable to coerce to a real number

2013-08-27 14:15:14 +0200 commented answer Plotting Sequence of Points

Thank you - that works.

2013-08-27 13:43:54 +0200 asked a question Plotting Sequence of Points

How do I plot the sequence {1/n} for n = 1 to 100 in Sage? I browsed plot?, but didn't see it as an option, or I didn't know what it was called.

2013-07-25 11:45:59 +0200 marked best answer Binomial in a Summation

Sum is working only in a symbolic ring. So you can convert your integers to the symbolic ring as follows:

sum(binomial(SR(5),k),k,0,SR(5))

You can also use the add command:

add([binomial(5,k) for k in [0..5]])
2013-07-25 11:45:58 +0200 received badge  Supporter (source)
2013-07-25 10:28:50 +0200 received badge  Editor (source)
2013-07-25 10:28:29 +0200 asked a question Binomial in a Summation

sage: var('k')

k

sage: sum(binomial(5,k),k,0,5)

I get an error "cannot convert k to int"

But if instead I try something like sum(binomial(n,k),k,0,n), everything is just fine.

Anyone know how I can get around this?

2013-07-10 11:47:01 +0200 marked best answer Summing with Euler_phi Error

I guess this is because euler_phi does not accept symbolic argument

sage: var('z')
sage: euler_phi(z)
Traceback (most recent call last):
...
PariError: not an integer argument in an arithmetic function (18)

Nevertheless, you can do

sage: sum((euler_phi(k)/k)*log(1/(1-2*z^k)) for k in xrange(2,5))
1/2*log(-1/(2*z^4 - 1)) + 2/3*log(-1/(2*z^3 - 1)) + 1/2*log(-1/(2*z^2 - 1))
2013-07-10 11:47:01 +0200 received badge  Scholar (source)
2013-07-10 11:29:53 +0200 asked a question Summing with Euler_phi Error

New to sage, having some trouble with summation.

z, k both declared as variables.

sum((euler_phi(k)/k)log(1/(1-2z^k)),k,2,5)

Error: not an integer argument in an arithmetic function (18) If I change it to euler_phi(5)/5 it's fine.