On Fri, Dec 2, 2011 at 8:24 AM, Julie <[email protected]> wrote:
> Hi all,
>
> I am attempting to obtain coefficients of a generating function to
> obtain probabilites, but in order to obtain the coefficients, I first
> need to expand a power series, which is necessary for my paricular
> function.
> Is there a simple way to expand such a series in sage e.g. 2^x?



sage: f = 2^x
sage: f.taylor(x,0,5)
1/120*x^5*log(2)^5 + 1/24*x^4*log(2)^4 + 1/6*x^3*log(2)^3 +
1/2*x^2*log(2)^2 + x*log(2) + 1


>
> (For my exact problem, the generating function contains 2 variables (p
> and y), and when expanded up to terms where p=1 for example, I have
> the formula:
> (0.030*0.248244^y)y+0.05721*(0.248244^y)p +0.08838*(0.248244^y)
>
> Thus, before being able to extract the coefficients of p^0*y^0, p1,
> y1,p*y etc, I need to expand 0.248244^y as a power series - will the
> same programming also hold for this problem?)


sage: x,y = var("x,y")
sage: f = 2^x*sin(y)
sage: f.taylor((x,0), (y,0) ,5)
1/24*x^4*y*log(2)^4 + 1/6*x^3*y*log(2)^3 - 1/12*x^2*y^3*log(2)^2 +
1/2*x^2*y*log(2)^2 - 1/6*x*y^3*log(2) + 1/120*y^5 + x*y*log(2) -
1/6*y^3 + y

Hope that helps.

>
> Many thanks,
> Julie
>
> --
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to 
> [email protected]
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to