Ask Your Question

david8381's profile - activity

2020-01-02 05:42:36 -0600 received badge  Popular Question (source)
2017-08-11 11:51:11 -0600 received badge  Famous Question (source)
2017-04-10 21:45:57 -0600 received badge  Famous Question (source)
2016-10-20 00:35:01 -0600 received badge  Taxonomist
2016-08-16 06:17:55 -0600 received badge  Notable Question (source)
2016-08-16 06:16:17 -0600 received badge  Popular Question (source)
2016-04-13 18:28:11 -0600 received badge  Notable Question (source)
2016-04-13 18:28:11 -0600 received badge  Popular Question (source)
2014-08-18 17:12:18 -0600 received badge  Student (source)
2014-08-18 16:37:57 -0600 received badge  Famous Question (source)
2014-08-18 16:30:40 -0600 received badge  Popular Question (source)
2014-08-18 16:30:40 -0600 received badge  Notable Question (source)
2014-08-18 16:30:40 -0600 received badge  Famous Question (source)
2014-08-18 16:30:28 -0600 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-25 20:04:31 -0600 received badge  Notable Question (source)
2014-06-22 06:41:38 -0600 received badge  Popular Question (source)
2013-11-29 09:56:18 -0600 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 10:11:16 -0600 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 08:10:03 -0600 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 06:55:44 -0600 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 07:15:14 -0600 commented answer Plotting Sequence of Points

Thank you - that works.

2013-08-27 06:43:54 -0600 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 04:45:59 -0600 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 04:45:58 -0600 received badge  Supporter (source)
2013-07-25 03:28:50 -0600 received badge  Editor (source)
2013-07-25 03:28:29 -0600 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 04:47:01 -0600 received badge  Scholar (source)
2013-07-10 04:47:01 -0600 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 04:29:53 -0600 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.