[sage-support] Re: Substituting values for variables

2016-06-13 Thread Ralf Stephan
It's a bit unclear to me what you want, but have you tried substituting your expressions, or writing a Python function instead of a symbolic function gamma? -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop

[sage-support] Re: How to write array in sage?

2016-06-13 Thread slelievre
2016-06-12 09:13:00 UTC+2, Sayantan Koley: I'm writing square and multiply algorithm. > but i need to store binary digits in sage. > how to do? > Here is a way to get the binary digits of an integer. sage: a = 41 sage: a.bits() [1, 0, 0, 1, 0, 1] You can also have a look at the S

[sage-support] Re: Substituting values for variables

2016-06-13 Thread saad khalid
Many of these expression shouldn't also simplify down to 0 just through algebra, though the symbolic manipulator usually doesn't recognize that. I try using using CC(gamma(2)), so that I can see if it's equal to 0, but it tells me that it can't evaluate a symbolic expression numerically, even t

[sage-support] Re: Substituting values for variables

2016-06-13 Thread saad khalid
I should add that moving the part where I assign values to the u's to above the definition of gamma, like so: reset() var("G") var('i') G = 5 u = [SR("u_%i"%x) for x in [0..G-1]] u[1] = -1 u[2]= -1 u[3]= -1 u[4]= -1 gamma(k) = (1/G)*sum(-(u[i])^(k-1)/(u[i]-1)^k for i in (1..G-1)) show(1/5 - 3*2

[sage-support] Re: Substituting values for variables

2016-06-13 Thread saad khalid
I should add that moving the part where I assign values to the u's to above the definition of gamma, like so: reset() var("G") var('i') G = 5 u = [SR("u_%i"%x) for x in [0..G-1]] u[1] = -1 u[2]= -1 u[3]= -1 u[4]= -1 gamma(k) = (1/G)*sum(-(u[i])^(k-1)/(u[i]-1)^k for i in (1..G-1)) show(1/5 - 3*2/5

[sage-support] Re: Sage Sum vs Python Sum

2016-06-13 Thread saad khalid
Thanks for the help guys! :) -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sag

[sage-support] Re: Sage Sum vs Python Sum

2016-06-13 Thread kcrisman
> Is there a reason this is appearing in my post? I can't tell if this is a > glitch or something. > It's a 'feature' of Google groups, that when you reply to a post in your email (at least sometimes) then this happens, even if you change the subject line (see https://groups.google.com/for

[sage-support] Substituting values for variables

2016-06-13 Thread saad khalid
Hey everyone: So, I start by making a symbolic function. Gamma(k) is the sum of some variables, u_i. Generating the function by hand is difficult, so I was hoping I could make it so that Sage generates the function and then I can give values for the u_i's, and have it compute the value for me.