Ask Your Question

brettpim's profile - activity

2020-06-27 13:19:31 -0600 received badge  Popular Question (source)
2020-06-04 09:36:11 -0600 received badge  Scholar (source)
2020-06-01 16:43:55 -0600 received badge  Supporter (source)
2020-06-01 16:43:50 -0600 commented answer extract coefficients from products and sums of descending products

Thank you @rburing this was very helpful. I have been able to move forward with my computations.

2020-05-26 14:32:51 -0600 received badge  Famous Question (source)
2020-05-22 15:34:35 -0600 received badge  Editor (source)
2020-05-22 15:33:58 -0600 asked a question extract coefficients from products and sums of descending products

I need to extract coefficients of $n$ from some powers, products and sums of descending products and their reciprocals. The first 5 terms (in $x$) of the descending product $(x)_y$ are $$ x^y \left (1 - \frac{y(y-1)}{2x} + \frac{y(y-1)(y-2)(3y-1)}{24x^2} - \frac{y^2(y - 1)^2(y - 2)(y - 3)}{48x^3} + \frac{y(y-1)(y-2)(y-3)(y-4)(15y^3-30y^2+5y+2)}{5760x^4}\right) $$ and the first 5 terms of its reciprocal are $$ x^{-y} \left(1 + \frac{y(y-1)}{2x} + \frac{y(y-1)(y+1)(3y-2)}{24x^2} + \frac{y^2(y-1)^2(y+1)(y+2)}{48x^3} + \frac{y(y-1)(y+1)(y+2)(y+3)(15y^3-15y^2-10y+8)}{5760x^4}\right) $$

I need to extract the coefficients of various powers of $n$ in expressions like

$$ \frac{(l(v-1)-1)(v-1)l(l)_t}{(n-1)_{t+1}} - \left(\frac{(l(v-1)-1)(v-1)l(l)_t}{(n-1)_{t+1}}\right)^2 + \frac{n(v-1)l(l)_{2t}(l(v-1)-1)^2(l(v-1)-2)}{(n)_{2t+3}} $$ where $l = n/v$ and $n$, $t$ and $v$ are symbolic variables.

To encapsulate these descending products and their powers I wrote

def desc_prod(x,y):
    t0 = 1
    t1 = - y*(y-1)/(2*x)
    t2 = (y*(y-1)*(y-2)*(3*y-1))/(24*x^2)
    t3 = -(y^2*(y-1)^2*(y-2)*(y-3))/(48*x^3)
    t4 = y*(y-1)*(y-2)*(y-3)*(y-4)*(15*y^3-30*y^2 + 5*y + 2)/(5760*x^4)
    return (x^y)*(t0 + t1 + t2 + t3 + t4 )

def desc_prod_recip(x,y):
    t0 = 1
    t1 = y*(y-1)/(2*x)
    t2 = (y*(y+1)*(y-1)*(3*y-2))/(24*x^2)
    t3 = (y^2*(y-1)^2*(y+1)*(y+2))/(48*x^3)
    t4 = y*(y-1)*(y+1)*(y+2)*(y+3)*(15*y^3-15*y^2-10*y+8)/(5760*x^4)
    return (x^(-y))*(t0 + t1 + t2 + t3 + t4)

def desc_prod_power(x,y,e):
    t0 = 1
    t1 = - y*(y-1)/(2*x)
    t2 = (y*(y-1)*(y-2)*(3*y-1))/(24*x^2)
    t3 = -(y^2*(y-1)^2*(y-2)*(y-3))/(48*x^3)
    t4 = y*(y-1)*(y-2)*(y-3)*(y-4)*(15*y^3-30*y^2 + 5*y + 2)/(5760*x^4)
    return (x^(y*e))*(1 + multinomial(e-1,1)*t1 + multinomial(e-2,2)*t1^2 + multinomial(e-1,1)*t2  + multinomial(e-3,3)*t1^3 + multinomial(e-2,1,1)*t1*t2 + multinomial(e-4,4)*t1^4 + multinomial(e-2,2)*t2^2 + multinomial(e-3,2,1)*t1^2*t2 + multinomial(e-2,1,1)*t1*t3 + multinomial(e-1,1)*t4 )

def desc_prod_recip_power(x,y,e):
    t0 = 1
    t1 = y*(y-1)/(2*x)
    t2 = (y*(y+1)*(y-1)*(3*y-2))/(24*x^2)
    t3 = (y^2*(y-1)^2*(y+1)*(y+2))/(48*x^3)
    t4 = y*(y-1)*(y+1)*(y+2)*(y+3)*(15*y^3-15*y^2-10*y+8)/(5760*x^4)
    return (x^(-y*e))*(1 + multinomial(e-1,1)*t1 + multinomial(e-2,2)*t1^2 + multinomial(e-1,1)*t2  + multinomial(e-3,3)*t1^3 + multinomial(e-2,1,1)*t1*t2 + multinomial(e-4,4)*t1^4 + multinomial(e-2,2)*t2^2 + multinomial(e-3,2,1)*t1^2*t2 + multinomial(e-2,1,1)*t1*t3 + multinomial(e-1,1)*t4 )

but sagemath does not correctly compute the coefficients in $n$. In an attempt to figure this out I asked a question here about computing coefficients of $n$ correctly and you can see there a very simple instance of sagemath failing to compute the coefficient. In my question I tried to give the simplest situation, where I do not have powers, products nor sums of my descnding products and their reciprocals, but just enough to showcase the behaviour of sage that is getting me stuck. In his answer @dan_fulea suggests that I need to approach my problem differently. Can anyone please give me some advice about the best way to compute the coefficients of any given power of $n$ in expressions like mine.

2020-04-20 17:54:21 -0600 commented answer find correct coefficients in $n$

thank you @dan_fulea. I am definitely open to trying to do my calculation a different way. My example was a simplification of what I am really trying to do. Essentially I have a number of different expressions of forms similar to the above and I have to take some sums and products of them and then afterwards I need to extract the coefficients of particular powers of n. I was getting incorrect answers in some small examples and identified the issue that way. What is the method you would recommend for doing what I describe? Thank you for your time and expertise.

2020-02-26 17:59:22 -0600 commented question find correct coefficients in $n$

I just realised that it also has two separate coefficients for $n^{-t-4}$ and $n^{-t-3}$, so there are other issues with .coefficients()

2020-02-26 08:19:16 -0600 received badge  Organizer (source)
2020-02-25 15:32:04 -0600 asked a question find correct coefficients in $n$
def desc_prod_recip(x,y):
    t0 = 1
    t1 = y*(y-1)/(2*x)
    t2 = (y*(y+1)*(y-1)*(3*y-2))/(24*x^2)
    t3 = (y^2*(y-1)^2*(y+1)*(y+2))/(48*x^3)
    t4 = y*(y-1)*(y+1)*(y+2)*(y+3)*(15*y^3-15*y^2-10*y+8)/(5760*x^4)
    return (x^(-y))*(t0 + t1 + t2 + t3 + t4)
n,t = var('n t')
E1 = desc_prod_recip(n,t).expand().simplify()
E1.coefficients(n)

gives the answer:

 [[1/96*t^7 - 1/576*t^6, -t - 4],
 [-1/16*t^4, -t - 3],
 [1/(n^t), 0],
 [1/384*t^8 - 1/30*t^5 - 5/1152*t^4 + 1/32*t^3 + 1/288*t^2 - 1/120*t, -t- 4],
 [1/48*t^6 + 1/48*t^5 - 1/48*t^3 + 1/24*t^2, -t - 3],
 [1/8*t^4 - 1/12*t^3 - 1/8*t^2 + 1/12*t, -t - 2],
 [1/2*t^2 - 1/2*t, -t - 1]]

It seems to detect all the powers of $n$ properly except $n^{-t}$. How can I process this symbolic expression so that sagemath computes the coefficients of $n$ properly?

2020-02-16 19:44:11 -0600 received badge  Notable Question (source)
2019-11-08 16:16:14 -0600 received badge  Notable Question (source)
2019-10-03 14:35:55 -0600 received badge  Popular Question (source)
2019-08-01 23:45:49 -0600 received badge  Popular Question (source)
2019-04-06 07:23:50 -0600 commented answer evaluating derivative of implicit function

thanks rburing

2019-04-05 15:28:44 -0600 asked a question evaluating derivative of implicit function

I am trying to evaluate the derivative of an implicitly defined function

rho = function('rho',u)
u_z_equation = u*z^3 - u*z^2 - z^3 + z^2 - 2*z + 1
implicit = u_z_equation(z=rho)
rho_1 = solve(implicit(u=1),rho(1))[0]
print rho_1
d_rho = solve(diff(implicit,u),diff(rho))[0]
print d_rho(u=1)

But I do not know how to substitute the value I found for rho(1) into the expression for the derivative

2019-02-06 15:39:13 -0600 asked a question jupyter tutorial

My university department is updating the instance of sagemath that we use to 8.6. This will use the new Jupyter interface. I have two questions about the upgrade:

1) The old instance of sage we are running has many users each with their own notebooks. How do we migrate the multi-user environment to sagemath with Jupyter?

2) All of our sagemath users will need to migrate to using Jupyter. Is there a good tutorial for using sagemath in Jupyter? The http://www.sagemath.org/help.html documentation and tutorials in sagemath's website still are referencing the old notebooks.

thanks brett

2019-02-05 10:23:52 -0600 commented answer firefox tab completion sagemath

Is there a tutorial on using sagemath with the jupyter notebooks? I have figure out some of the basic stuff but I logged out and when I tried loging back in it asked me for a "token" and said that I could obtain the token by running "jupyter notebook list" but this command produced:

Error executing Jupyter command 'notebook': [Errno 2] No such file or directory

2019-02-05 10:05:47 -0600 commented answer firefox tab completion sagemath

I have switched sage on the two computers I control to use jupyter, but the sage server that my university provides needs to be updated before it can run jupyter. In the mean time I am still looking for a tab-completion fix in the old notebook with Firefox.

2019-02-03 04:19:23 -0600 received badge  Student (source)
2019-02-02 17:58:29 -0600 asked a question firefox tab completion sagemath

I recently upgraded my computer to Ubuntu 18.10. I think this may have upgraded my Firefox to 65.0. Now in Firefox I have two new (unwanted) behaviours

  • when I try to use tab-completion in the sagemath notebook, the browser moves the active element from the cell to the evaluate button.

  • when I press [backspace] in an empty cell it used to delete the cell and move the cursor to the previous cell. I would use this to delete a series of empty cells. Now it does nothing.

google-chrome is working fine

Is this a new behaviour in firefox, is it an OS/xorg issue or does it involve the sagemath notebook?